Integrating with SAP HANA/ECC

Background

Overview

Import SAP Tables from SAP ERP

MS Application PULLS tables from the SAP System using SOAP or RESTful URL created through the SAP System.

  1. MS Application triggers an SAP program using a URL to fetch table records.
  2. SAP Table records are sent to their respective tables in the PlanetTogether system. 

 

Export Production Orders to SAP ERP to create PO

MS Application will PUSH production order data to the SAP System using WebService / RESTful URL

  1. MS Application triggers an SAP program using a URL to create Production Orders in the SAP System.
  2. Production Orders will be saved in SAP ERP HANA / Any DB and a success message will be sent to the PlanetTogether system.

Technology and Approach

System Specifications and Prerequisites

Requirement Specification
Database

Any or HANA Database

Software Requirements

SAP ECC having Support Pack 14 or more

Netweaver 7.*

Or S/4HANA

Required SAP Modules

SAP Material Management (MM) (Mandatory)

SAP Sales and Distribution (SD) (Mandatory)

SAP Production Planning (PP) (Mandatory)

Other Modules as required

Domain Company public domain for URL generation should be registered
Security and Authorization

RFC user should be used to access the ICF service.

RFC user should have the authorization to Insert, Update and Fetch records from SAP.

Authorization to create Production Orders in SAP system.

ABAP transaction authorizations. 

 

Implementation Approach:

  1. Use of SOAP technology by creating WebService
    1. PlanetTogether consumes the URL exposed by SAP.
    2. PlanetTogether triggers the URL to IMPORT/EXPORT data to/from SAP as per the scenario in Overview.
    3. From a security point - PlanetTogether needs to connect to the SAP system with a User ID and Password maintained for the SOAP URL.
    4. This approach is applicable for any SAP ECC or latest version of SAP system.
  2. Use RESTful API creating OData
    1. SAP will expose RESTful URL to PlanetTogether.
    2. PlanetTogether triggers the URL to IMPORT/EXPORT data to/from SAP as per the scenario in Overview.
    3. From a security point -PlanetTogether needs to connect to the SAP system with a User ID and Password maintained in ICF configuration.
    4. This approach is applicable to SAP system where SAP Gateway components are installed.
  3. Required SAP Tables are replicated with all fields in the PlanetTogether SQL database.
  4. Data from SAP will be selected through queries and sent to the PlanetTogether system.
  5. Production Orders will be created in SAP using BAPI for the records in the PlanetTogether system.

SAP Tables and Fields

The following SAP tables are used and replicated in the PlanetTogether SQL Database

Table Name Description
AFKO Order header data PP orders
AFPO Order item
AFRU Order confirmations
AFRUHR Order confirmations for HR
AFRV Confirmation pool
AFVC Operation within an order
AUFU Order confirmations
AUFK Order master data
AUFM Goods movements for order
AFVV DB structure of the quantities/dates/values in the operation
AFVC Operation within an order
CAUFV Generated Table for View
CRCA Work Center capacity allocation
CRHD Work Center header
CRTX Work Center or Production Resource / Tool
EKPO Purchasing Document Item
KAKO Capacity Header Segment
KAKT Capacity description information
KNA1 Customer Master
LTAK WM transfer order header
LTBP Transfer requirement item
MAKT Material master with description
MAPR Material index for Forecast
MARC Plant Data for Material
MBEW Material valuation
MPRP Forecast profiles
PLPO Task list - operation/activity Table
PLKO Task list - header
PROW Forecast values
RESB Reservation / dependent requirements
VBAK Sales order details
VBAP Sales order item details
STOP BOM Item Table

 

Mapping of SAP and PlanetTogether Fields:

TableName
FieldName SAP TABLE-FIELD
Capabilities CapabilityDescription Field not found in standard table can be created separately
Capabilities CapabilityID CRCA-KAPID
Capabilities CapabilityName CRTX-KTEXT
Capabilities ResourceID CRHD-ARBPL
Capacity CapacityDescription KAKT-KTEXT
Capacity CapacityName KAKT-KAPID
Capacity CapacityType KAKO-KAPAR
Capacity EndDateTime KAKO-ENDZT
Capacity ResourceID CRHD-OBJID
Forecasts Customer KNA1-KUNNAR
Forecasts ForecastDescription MPRP-KTEXT
Forecasts ForecastID MPRP-PROPR
Forecasts ItemID MAPR-MATNR
Forecasts Qty PROW-PRWRT
Forecasts RequiredDate Field not found in standard table can be created separately
Items
BatchSize Field not found in standard table can be created separately
Items BatchWindow Field not found in standard table can be created separately
Items ItemDescription MAKT-MAKTX
Items ItemID MAKT-MATNR
Items ItemName MAKT-MAKTX
Items ItemType MARC-DISMM
Items JobSplitQty Field not found in standard table can be created separately
Items LeadTime MARC-WEBAZ
Items MaxBatches Field not found in standard table can be created separately
Items MinBatches Field not found in standard table can be created separately
Items OnHandQty MBEW-SALK3
Items SafetyStockQty MARC-EISBE
Production Order BOM IssuedQty RESB-ENMNG
Production Order BOM ItemID MAKT-MATNR
Production Order BOM OperationID AFVC-VORNR
Production Order BOM ProductionOrderID AFKO-AUFNR
Production Order Details CapabilityRequiredID AFVC-BEDID
Production Order Details DefaultResourceID AFVC-ARBID
Production Order Details OperationCycleHours AFVV-BEARZ
Production Order Details OperationDescription PLPO-LTXA1
Production Order Details
OperationNotes Field not found in standard table can be created separately
Production Order Details PostProcessingHours AFVV-BEARP
Production Order Details QtyProducedPerCycle AFRU-GMNGA
Production Order Details RoutingID AFVC-PLNNR
Production Order Details RoutingName PLKO-KTEXT
Production Order Header ItemID MAKT-MATNR
Production Order Header OperationID AFVC-VORNR
Production Order Header ProductionOrderCommitment Field not found in standard table can be created separately
Production Order Header ProductionOrderCustomerName VBAK-KUNNR
Production Order Header ProductionOrderID AFKO-AUFNR
Production Order Header ProductionOrderName AUFK-AUART,T003O-TXT
Production Order Header ProductionOrderNeedDate AFKO-GLTRP,AFKO-GLUZP
Production Order Header ProductionOrderNotes Field not found in standard table can be created separately
Production Order Header ProductionOrderSalesOrderNumber AFPO-KDAUF
Production Order Header ProductPostProcessingHours AFPO-WEBAZ
Production Order Successor Links
OperationID AFVC-VORNR
Production Order Successor Links ProductionOrderID AFKO-AUFNR
Production Order Updates OperationID AFVC-VORNR
Production Order Updates ProductionOrderID AFKO-AUFNR
Production Order Updates ProductionStatus CAUFV-OBJNR, JEST-STAT
Production Order Updates ReportedFinishDate AFKO-GETRI
Production Order Updates ReportedGoodQty AFRU-LMNGA
Production Order Updates ReportedStartDate AFKO-GSTRI
Production Order Updates RequiredFinishQty AFKO-GAMNG
Purchase Orders ItemID EKPO-MATNR
Purchase Orders PurchaseName EKPO-EBELN
Purchase Orders QtyOrdered EKPO-MENGE
Resources CapacityType CRHD-KAPID
Resources DeparmentName Field not found in standard table
Resources DepartmentDescription Field not found in standard table
Resources DepartmentID Field not found in standard table
Resources PlantID CRHD-WERKS
Resources PlantName T001W-NAME1
Resources
ResourceDescription CRTX-KTEXT
Resources ResourceID CRHD-OBJID
Resources ResourceName CRTX-KTEXT
Sales Orders Customer VBAK-KUNNR
Sales Orders ItemID VBAP-MATNR
Sales Orders LineNumber VBAP-POSNR
Sales Orders QtyOrdered VBAP-KWMENG
Sales Orders QtyShipped VBAP-KLMENG
Sales Orders RequiredAvailableDate VBAK-VDATU
Sales Orders SalesOrderDescription VBAP-ARKTX
Sales Orders SalesOrderName VBAK-AUART
Standard Routing BOM IsFixedQty PLPO-BMSCH
Standard Routing BOM ItemID MAKT-MATNR
Standard Routing BOM OperationID PLPO-VORNR
Standard Routing BOM RoutingID PLPO-PLNNR
Standard Routing Details CapabilityRequiredID Field not found in standard table
Standard Routing Details DefaultResourceID PLPO-ARBID
Standard Routing Details OperationCycleHours PLPO-VGW01,VGW02,VGW03
Standard Routing Details OperationDescription PLPO-LTXA1
Standard Routing Details QtyProducedPerCycle PLPO-VGW01,VGW02,VGW03
Standard Routing Details RoutingID PLPO-PLNNR
Standard Routing Details
RoutingName PLPO-KTEXT
Standard Routing Header ItemID MAKT-MATNR
Standard Routing Header OperationID PLPO-VORNR
Standard Routing Header RoutingID PLPO-PLNNR
Standard Routing Header RoutingName PLPO-KTEXT
Warehouses PlantID LTBP-WERKS
Warehouses WarehouseDescription T300T-LNUMT
Warehouses WarehouseName LTAK-LGNUM

SAP Licensing Requirement

Below is a general document about the licensing for customers with different requirements. Customers who have control and access to their licensing of SAP products are responsible for ensuring that all requirements and limitations are satisfied for use with this integration. 

https://www.sap.com/documents/2015/05/849f654b-277c-0010-82c7-eda71af511fa.html

Getting Started

How to Set Up the Integration

  1. SAP WebService/Odata Projects we will save it in the Transport Request (Transaction SE01).
  2. Co-File and Data File for these Transport Requests will be downloaded by Basis Tem (Refer to the document "Download and Upload TR").
  3. On activation of the WebService or Odata Projects, URLs will be generated as per client domain.
    1. WebService will be activated through Transaction SE80 in SAP which will be saved under "Enterprise Services".
    2. Odata Projects will be activated using Transaction SEGW in SAP
  4. Create User ID and Password in SQL database which will be used to connect SAP system.
  5. SQL database connection will be maintained in SAP with Transaction DBCO using the following parameters:
    1. DB Connection: CLOUD_PLANET
    2. DBMS: MSS
    3. User Name/Password: Created in SQL Database
    4. Connection Info: "MSSQL_SERVER=cloud.planettogether.com MSSQL_DBNAME=PlanetTogether_SAP_Staging"
  6. URLs will be consumed by the PlanetTogether Application.
  7. PlanetTogether will trigger these URLs as per the requirements which will trigger applications in SAP. 

How to Run the Integration

  1. WebService/Odata is created in SAP ERP system to retrieve data.
  2. WebService/Odata is created in SAP and consumed in the MS Application using exposed URL.
  3. The MS Application calls SAP WebService URL.
  4. In case of Import scenario, SAP sends records from tables to SQL Database tables.
  5. In case of Export scenario, SAP receives records from PlanetTogether and creates Production Orders in the SAP system. 
  6. Both interfaces are triggered through the URLs.
  7. Manual Execution steps in SAP:
    1. WebService Execution: Execute the WebService which updates tables in the SQL Server.
      1. Example Table Name: VBAP
      2. Input to Pass a flag: 1 = To Update table
      3. Table Name: VBAP
      4. Output of WebService
      5. Output in SQL for the records from table VBAP
      6. New table in SQL created where the records for which PO to be created in SAP
      7. WebService Execution by passing flag X so that a PO is created in SAP
      8. Response of WebService: with PO created in SAP
      9. The Order Number is inserted in the same table against the record for which PO is created in SAP
    2. Execution of Odata Service URL
      1. We have also created Odata URLs that can be accessed without consumption like the WebService.
      2. You need to pass parameters directly to these URLs as follows:
      3. OData URL: 
      4. http://<CustomerPublicDomain>/sap/opu/odata/sap/ZSAP_TO_SQL_CON_SRV/SapTableToSQLSet(TabCond='01',TabName='VBAK')

        http://<CustomerPublicDomain>/sap/opu/odata/sap/ZSAP_TO_SQL_CON_SRV/CreateSQLPOSet?$filter=Flag%20eq%20%27X%27
      5. Table Updated in SQL:

Execution and Response Time

  1. The execution and response time is dependent on the number of records present in the SAP system.
  2. The following table gives a rough estimation for the number of records which will be fetched from one SAP Table to SQL:
    Number of records in SAP Tables Transfer Time in Minutes
    < 1000 < 1
    1000 to 5000 1 to 5
    5000 to 10,000 5 to 10
    10,000 to 20,000 10 to 20
    > 20,000 > 20
  3. The Transfer Time also depends on the number of free Background Work Processes and maximum time configured for this work process in SAP system.

How to Troubleshoot Issues

SQL Table is not Updated

  1. Compare the number of records in SAP and SQL database for the table.
    1. In SAP:
    2. Transaction SE16: Provide the table name for which you need to compare records.
    3. Click on [ENTER], and you will see the following screen:
    4. Click on the "Number of Entries" to get the total number of records present in the table:
    5. In SQL: The record count is checked using query.
  2. Check the WebService/Odata error log in SAP with Transaction SOAMANAGER or /n/IWFND/ERROR_LOG respectively.
    1. For Webservice: Transaction SOAMANAGER
      1. Click on the Tab Logs and Traces and select SOA Runtime Traces
      2. Click on Error Log from the menu
      3. Here you can see the list of errors (if any) for the latest execution of URLs:
    2. For RESTful Services/Odata Services: Transaction /n/IWFND/ERROR_LOG
      1. Check the Background tasks in Transaction SM50 in SAP
      2. Here, you can see the list of background programs that are executing currently. This transaction is used to check if background tasks are executed for a longer time than they should. 

Production Order is not created in SAP

  1. Check if the Success Message was received from the Interface.
  2. Check if the SQL database tables are updated with the Order Number from SAP.
  3. Check WebService/Odata Error Log in SAP system with Transaction SOAMANAGER or /n/IWFND/ERROR_LOG respectively, as shown in the above scenario.

Download and Upload Transport Requests

How to Download a Request

  1. To download a request, go to AL11, search for "DIR_TRANS" and double-click on it. Here, you will find the values "cofiles" and "data" in the "File Name" column which keeps head of requests and body into them respectively. 
  2. Double-click on the "cofiles" row. Find a request that starts with "K" (as a header) by clicking Ctrl+F and double-clicking on the request. 
  3. Take the name of the Directory. You will need this path as the Source of the request to download.
  4. Open a new session and tun CG3Y tcode to download your request.
  5. In the opened window, put the source path (from the above step) + "\" + request name in "Source of file on application server". In the Target section, put a directory path on your computer and the same name as your request's name for the file name.
    1. If you have a lot of requests, this procedure can be time-consuming. It is recommended to make a list of the requests' names and download them one by one as quick as possible. There is a function module you can use to develop your own program to speed up the procedure. The function module is ARCHIVFILE_SERVER_TO_CLIENT.
  6. Now you have downloaded the header files of the request and you need to repeat the same steps for the body files located in the "data" row (instead of "cofiles") of "DIR_TRANS" and using "R" as the prefix of the request. 

Additional help for this can be found here. 

How to Upload a Request in a New System

  1. To export the request into the target system, you will use the CG3Z tcode. 
  2. Upload the requests in the new system by specifying your local path as the Source of the upload.
  3. Import the uploaded request into the transport request queue on the new system. To do this, run STMS and select "Extras | Other Requests | Add".
  4. Specify "Transport Request" from the list which shows your uploaded requests and select your client as the "Target Client".
Additional help for this can be found here.