SAP HANA Cloud Integration for data services Document Version: 1.0.6-2014-05-14 Integration Guide for SAP Sales and Operations Planning
Table of Contents 1 About the templates....3 2 Sales and Operations Planning templates....5 2.1 Master data templates....5 2.2 Key figure templates....5 2.3 General purpose templates.... 7 3 Load data using master data and key figure tasks....8 3.1 Change the target table in a data flow....9 4 Load data using general purpose tasks....10 5 Set global variables....11 6 Preload scripts....12 7 Global Variables....13 7.1 Shared global variables....13 7.2 Unique global variables....15 2 2014 SAP AG or an SAP affiliate company. All rights reserved. Table of Contents
1 About the templates SAP HANA Cloud Integration templates for SAP Sales and Operations Planning provide predefined content which serves as the starting point for populating your Sales and Operations Planning (S&OP) application. The templates are designed to meet the specific requirements for S&OP data and reduce the time needed to get up and running with the application. Three types of templates are available in SAP HANA Cloud Integration: General purpose templates Master data templates Key figure templates General purpose templates contain information required by S&OP to process the data after it is loaded. The general purpose templates, SOP_APO_Task and SOP_ECC_Task, contain global variables preload scripts and postload scripts. After using either of these templates to create a task, you add datastore information and your own data flows. Tasks created from the master data and key figure templates contain the data flows, global variables, and scripts necessary to do the following: Extract data from SAP Applications sources (ERP and SCM/APO). Transform it as required for Sales and Operations Planning. Load the data to predefined target tables for the default model (SAPMODEL1) in the staging area of the SAP HANA application cloud. Task elements Each task contains the elements described in the following table: Element Source datastore and tables Target datastore and tables Data flow Global variables Preload script Postload script Description Connects SAP HANA Cloud Integration and the source data. Connects SAP HANA Cloud Integration and the S&OP application target. Defines the movement and transformation of data from source to target. Parameterize the task. Initializes global variables required for task run. Records the timestamp of the most recent run. About the templates 2014 SAP AG or an SAP affiliate company. All rights reserved. 3
Advantages to using templates Because each S&OP implementation is unique, you will almost always need to customize the out-of-the-box tasks and data flows that you create from the S&OP templates. However, using the templates to create tasks and data flows as a starting point has the following advantages over creating tasks from scratch: Template tasks provide the framework and thus reduce the integration development time. Template tasks contain the global variables required to successfully load and process data into S&OP. Preload scripts are configured with default values for these global variables and provide a framework. This eliminates the need to write preload scripts from scratch. Master data and key figure template data flows follow best practice design for optimal integration performance. Master data and key figure template data flows contain mappings from ERP and APO source systems which include joins and predefined filters. Master data and key figure template data flows contain predefined transformations of ERP and APO data. Note To learn about known issues when using SAP HANA Cloud Integration with SAP Sales and Operations Planning, see 1826078. 4 2014 SAP AG or an SAP affiliate company. All rights reserved. About the templates
2 Sales and Operations Planning templates 2.1 Master data templates Tasks created from master data templates load data to staging tables. Tasks created from master data templates must be run prior to tasks created from key figure templates. Information about master data tasks is summarized in the table below. Load order Task name SAP Applications source Source tables or extractors S&OP target table 1 SOP_MD_Location Master ERP 0PLANT_ATTR T001W SOPMD_STAG_SM1LOCA TION 2 SOP_MD_Product Master ERP 0MATERIAL_ATTR MAKT SOPMD_STAG_SM1PROD UCT 3 SOP_MD_Location Prod ERP MBEW MARA SOPMD_STAG_SM1LOCA TIONPRODUCT MARC Must be loaded prior to key figure tasks SOP_MD_Customer Master ERP 0CUSTOMER_ATTR KNVP KNVH SOPMD_STAG_SM1CUS TOMER Must be loaded prior to key figure tasks SOP_MD_Resource SCM /SAPAPO/RES_HEAD SOPMD_STAG_SM1RE SOURCE 2.2 Key figure templates Tasks created from key figure templates load data to the SOPDD_STAGING_KFTAB_SM1BASE staging table. Key figure tasks require that associated master data is already loaded, processed and currently available in the S&OP application. If master data is not loaded into S&OP before key figure data, the key figure data will be loaded but will not be processed properly by S&OP. Information about key figure tasks is summarized in the table below. Task name SAP Application source Source tables/extractors/bapi functions S&OP key figure columns SOP_KF_Actuals ERP 2LIS_12_VCITM_SOP SM1ACTUALSQTY Sales and Operations Planning templates 2014 SAP AG or an SAP affiliate company. All rights reserved. 5
Task name SAP Application source Source tables/extractors/bapi functions S&OP key figure columns VBRK SM1ACTUALSREV VBRP SOP_KF_Inventory ERP MARC MARA SM1INITIALINVENTORYQTY SM1INVENTORYTARGETQTY MARD SOP_KF_OpenOrders ERP 2LIS_11_VAHDR 2LIS_11_VAITM SM1OPENORDERSQTY SM1OPENORDERSREV 2LIS_11_VASTI SOP_KF_SalesForecast Price ERP 2LIS_13_VDITM SM1SALESFORECASTPRICE SOP_KF_CapacityLimit SCM/APO /SAPAPO/RES_HEAD SM1CAPASUPPLY 9ACAPACITY SOP_KF_Consumption SCM/APO BAPI_LOCSRVAPS_GET LIST2 SM1CAPACONSUMPTION* BAPI_PDSSRVAPS_GET LIST SOP_KF_DemandPlanning SCM/APO 9ABPC_EXTRACT SM1DEMANDPLANNINGQTY SOP_KF_StatisticalForecast SCM/APO 9ABPC_EXTRACT SM1SALESFORECASTQTY Note *SOP_KF_Consumption is implemented to extract from a sequence of BAPI function calls via a custom ABAP program. You can download the necessary ABAP program from SAP Note 1772288. Related Information SAP Note 1772288 6 2014 SAP AG or an SAP affiliate company. All rights reserved. Sales and Operations Planning templates
2.3 General purpose templates General purpose templates contain information required by S&OP to process the data after it is loaded. Unlike Master data or key figure templates, these templates do not specify the S&OP target table and source inputs (tables or extractors). Nor do they contain predefined data flows. The general purpose templates are SOP_APO_Task, SOP_ECC_Task, and SOP_File_Task. SOP_APO_Task and SOP_ECC_Task use SAP application datastores as source system. While SOP_File_Task uses a file group datastore as source. Sales and Operations Planning templates 2014 SAP AG or an SAP affiliate company. All rights reserved. 7
3 Load data using master data and key figure tasks You load data to S&OP by running a group of tasks in a specific order. Use the master data and key figure templates to create customized tasks to meet the requirements of your S&OP planning area model. Defining the tasks Define the necessary tasks as described in the following high-level steps: 1. Determine the table and column naming conventions used by your S&OP model. 2. Create tasks using the S&OP templates. You can either create the tasks individually or create multiple tasks at once. If you do the latter, you must perform the Create Multiple Tasks action separately for SAP_APO and SAP_ECC. 3. Within each task, modify the data flows to specify the target tables and columns used in your planning area. Change the target table in a data flow by copying it to a new data flow. 4. For each task, review the default values of the global variables and make changes as needed. Global variables apply to all data flows within a task. Note Certain global variables are used by the S&OP application to process the data after it is loaded. If the global variables are not included in the task, then data will be loaded, but S&OP cannot process it as expected. The required global variables are: $G_PLAN_AREA, $G_SCENARIO, $G_TIME_PROFILE and $G_BATCH_COMMAND. For details on the development workflow, see the Get Started tab of the SAP HANA Cloud Integration Help. Task execution order Load master data first and then load key figure data. This order is required to ensure proper processing of key figure data. Run the tasks in the following order: 1. SOP_MD_LocationMaster 2. SOP_MD_ProductMaster 3. SOP_MD_LocationProd 4. SOP_MD_CustomerMaster 5. SOP_MD_Resource 6. All key figure tasks (run order does not matter) 8 2014 SAP AG or an SAP affiliate company. All rights reserved. Load data using master data and key figure tasks
Note The order in which you run the SOP_MD_CustomerMaster and SOP_MD_Resource tasks does not matter, as long as they are run prior to the key figure tasks. 3.1 Change the target table in a data flow Change the target table in a data flow by copying it to a new data flow. Prerequisites The table must already exist in the target datastore. Context To change the target table: Procedure 1. From the Projects tab, select the task that contains the data flow you want to change and then click Edit. 2. From the Data Flows tab, select the data flow that loads to the target table you want to change and then click Copy to New Target Table. 3. Enter a name for the new data flow. 4. Select a target table and click Copy Data Flow. Results The new data flow contains the same source information and transformations as the original data flow, but loads to the new target. Edit the mappings and column names or make other changes to meet your needs. Load data using master data and key figure tasks 2014 SAP AG or an SAP affiliate company. All rights reserved. 9
4 Load data using general purpose tasks You load data to S&OP by running one or more tasks. You can use the general purpose tasks as a starting point and define your own data flows from scratch. To use the general purpose tasks, follow the workflow described in the Get Started tab of the SAP HANA Cloud Integration Help. Before running a task, ensure that you set the value of each of the required global variables as needed to meet your requirements and environment. 10 2014 SAP AG or an SAP affiliate company. All rights reserved. Load data using general purpose tasks
5 Set global variables Global variables are symbolic placeholders. When a task runs, these placeholders are populated with values. This allows users flexibility of run-time values used in extractions. Context Note Certain global variables are used by the S&OP application to process the data after it is loaded. If the global variables are not included in the task, then data will be loaded, but S&OP cannot process it as expected. The required global variables are: $G_PLAN_AREA, $G_SCENARIO, $G_TIME_PROFILE, and $G_BATCH_COMMAND. Procedure Depending on your requirements and environment, allow the default values or set values in one of the following locations: Option Description Run Now dialog box Use for testing. From the Projects tab, select a task. From the Actions menu, select Run Now. Execution Properties tab of a task Preload script Use for loading data. From the Projects tab, select a task. From the Actions menu, select Edit. Click the Execution Properties tab. Use for testing and loading data.. Set global variables 2014 SAP AG or an SAP affiliate company. All rights reserved. 11
6 Preload scripts Each of the Sales and Operations Planning (S&OP) tasks includes a preload initialization script. If you do not specify values for global variables (symbolic placeholders), during task execution the preload script populates the global variables with default values. 12 2014 SAP AG or an SAP affiliate company. All rights reserved. Preload scripts
7 Global Variables 7.1 Shared global variables Shared global variables are included in all Sales and Operations Planning (S&OP) data integration tasks. Most tasks contain additional unique global variables. Global variables contain default values which are used if the value has not been changed. As needed, change the value of each global variable per your requirements and environment. Certain global variables are used by the S&OP application to process the data after it is loaded. The default value and information about each of the shared global variables is shown in the following tables: Required by S&OP Global variable name Data type Default value for master data task Default value for key figure data task Description Yes $G_PLAN_AREA varchar(50) SAPMODEL1 The Planning Area value is defined in S&OP under Configuration Model Planning Area Definition. The value must contain only uppercase alphanumeric characters and begin with a letter. Spaces are not allowed. Yes $G_SCENARIO varchar(50) Indicates the base scenario. Yes $G_TIME_PRO FILE int -1-1 The Time Profile ID value is defined in S&OP under Configuration Model Planning Area Definition. Yes $G_BATCH_CO MMAND varchar(50) 'INSERT_UP DATE' 'INSERT_UP DATE' Defines how S&OP processes the data loaded Global Variables 2014 SAP AG or an SAP affiliate company. All rights reserved. 13
Required by S&OP Global variable name Data type Default value for master data task Default value for key figure data task Description in the batch execution. Recognized values are 'INSERT_UP DATE' and 'DE LETE'. INSERT_UP DATE updates or adds new data to S&OP. DELETE removes the specified records from S&OP. No $G_LOAD_DATE datetime Sysdate() Sysdate() The load date of the task. No No $G_DE FAULT_TEXT $G_DE FAULT_DATE varchar(1)?? Default text for dimension default rows, foreign keys, and primary keys. Also used as a default for missing descriptions. Datetime 1900.01.01 1900.01.01 Default date for dimension default rows, foreign keys, and primary keys. Also used as a default for missing dates. 14 2014 SAP AG or an SAP affiliate company. All rights reserved. Global Variables
7.2 Unique global variables All Sales and Operations Planning (S&OP) data integration tasks contain shared global variables. Additionally, most tasks contain global variables which are unique to that task. Global variables contain default values which are used if the value has not been changed. As needed, change the value of each global variable per your requirements and environment. The default value and information about each of the unique global variables is shown in the following tables. Actuals (SOP_KF_Actuals) Global variable name Data type Default value Description $G_INITIAL_OR_DELTA varchar(7) 'INITIAL' Identifies whether the task is a first (initial) load or a delta load. Legal values are 'INITIAL' or 'DELTA'. $G_DELTA_DAYS INTEGER 730 or 30 Defines the number of days of data to extract. Default for INITIAL load is 730 days (or 2 yrs). Default for DELTA load is 30 days. To change this value, update the preload script. $G_SDATE DATETIME Calculated in preload script "Starting date for Actuals extraction. This is automatically calculated in the preload script as: <Today's Date> - $G_DELTA_DAYS" Consumption (SOP_KF_Consumption) Global variable Name Data type Default value Description $G_LOGICAL_SYSTEM varchar(255) APOCLNT800 Logical System value required to call BAPI functions (BAPI_LOCSR VAPS_GETLIST2 and BAPI_PDSSRVAPS_GET Global Variables 2014 SAP AG or an SAP affiliate company. All rights reserved. 15
Global variable Name Data type Default value Description LIST). Task will return no data if this value is not correct. Enter the correct logical system name for your SAP Applications system. For example, SYSCLNT001. Customer Master (SOP_MD_CustomerMaster) Global variable name Data type Default value Description $G_PARVW varchar(255) 'AG' Use the value defined by your Business Partner. Allows you to extract customer data for a single value of KNVP.PARVW. The default value used in the template is AG for Soldto party. General Purpose Template (SOP_File_Task) Global Variable Name Data Type Default Value Description $G_FILE_NAME varchar(100) 'C:\Directory' Can be used to specify the file directory that is loaded into S&OP. Set this value in the preload script. $G_FILE_DIRECTORY varchar(100) 'FileName.csv' Can be used to specify the file directory that is loaded into S&OP. Set this value in the preload script. 16 2014 SAP AG or an SAP affiliate company. All rights reserved. Global Variables
Inventory (SOP_KF_Inventory) Global variable name Data type Default value Description $G_MONTHS_FORECAST int 18 Number of months the current inventory will be forecast. For example, 0 is the current month, 18 is 18 months in the future. $G_MATERIAL_TYPE_1 $G_MATERIAL_TYPE _2 varchar(4) varchar(4) ROH' HALB' Extracts inventory data from MARA.MTART for the specified material type. $G_MATERIAL_TYPE _3 varchar(4) FERT' $G_MATERIAL_TYPE _4 varchar(4) HIBE' $G_MATERIAL_TYPE _5 varchar(4) FHMI' Location Master (SOP_MD_LocationMaster) Global variable name Data type Default value Description $G_NODETYPE1 varchar(3) DC Extracts location data for the supply chain network $G_NODETYPE2 varchar(3) B from the specified nodes. $G_NODETYPE3 varchar(3) No default value $G_NODETYPE4 varchar(3) No default value $G_NODETYPE5 varchar(3) No default value Location Product Master (SOP_MD_LocationProd) Global variable name Data type Default value Description $G_MATERIAL_TYPE_1 $G_MATERIAL_TYPE _2 varchar(4) varchar(4) ROH' HALB' Extracts inventory data from MARA.MTART for the specified material type. $G_MATERIAL_TYPE _3 varchar(4) FERT' Global Variables 2014 SAP AG or an SAP affiliate company. All rights reserved. 17
Global variable name Data type Default value Description $G_MATERIAL_TYPE _4 varchar(4) HIBE' $G_MATERIAL_TYPE _5 varchar(4) FHMI' Product Master (SOP_MD_ProductMaster) Global variable name Data type Default value Description $G_MATERIAL_TYPE_1 $G_MATERIAL_TYPE_2 varchar(4) varchar(4) ROH' HALB' Extracts inventory data from MARA.MTART for the specified material type. $G_MATERIAL_TYPE_3 varchar(4) FERT' $G_MATERIAL_TYPE_4 varchar(4) HIBE' $G_MATERIAL_TYPE_5 varchar(4) FHMI' Sales Forecast Price (SOP_KF_SalesForecastPrice) Global variable name Data type Default value Description $G_DAYS_FORECAST int 183 Number of days that the initial forecast values are based on. Default is 6 months (or 365/2). $G_MONTHS_FORECAST int 18 Number of months current sales price will be forecast. For example, 0 is the current month only, 18 is 18 months in the future. 18 2014 SAP AG or an SAP affiliate company. All rights reserved. Global Variables
Global Variables 2014 SAP AG or an SAP affiliate company. All rights reserved. 19
www.sap.com/contactsap 2014 SAP AG or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries. Please see http://www.sap.com/corporate-en/legal/copyright/ index.epx for additional trademark information and notices.