OData V2 Protocol Writer Connector > Mappings and mapping tasks with OData V2 Protocol Writer Connector > OData V2 Protocol Writer mapping example
  

OData V2 Protocol Writer mapping example

You work in the sales department and you want to create a sales order in SAP S/4HANA. Create a flat file with the data that you want to add to the sales order. Create a business service in Data Integration to communicate to the OData V2 service. Then, create a Web Services transformation to integrate with the SAP OData V2 API, run the operation, and then write the response from SAP S/4HANA to a flat file.

Create a OData V2 Protocol Writer connection

Before you configure the mapping, create an OData V2 Protocol Writer connection to connect to the OData V2 service in SAP S/4HANA.
    1Click Administrator > Connections, and then click New Connection to create a connection.
    The New Connection page appears.
    2Enter a name for the OData V2 Protocol Writer connection.
    3Enter a description for the connection.
    4Select OData V2 Protocol Writer as the connection type.
    The OData V2 Protocol Writer Connection Properties section appears.
    5Select the name of the runtime environment where you want to run the tasks.
    6Select the authentication type to access the SAP OData V2 service:
    1. aIf you select API Key, specify the API key.
    2. bIf you select the Basic Authentication, enter the user name and password to access the SAP OData V2 service
    7Enter the data serialization format that you want to use to transfer data based on the format that the SAP OData V2 resource supports.
    8Enter the SAP OData V2 service URL.
    9Click OK to save the connection.
    10Click Save to save the connection.
    The following image shows the configured OData V2 Protocol Writer connection: This image displays the configured OData V2 Protocol Writer connection properties.

Create a business service

Create a business service, associate the configured OData V2 Protocol Writer connection, and add the operation for the business service.
    1Click Data Integration > New > Components > Business Services and then click Create.
    The Business Service Details page appears.
    2Enter a name and description for the business service, and specify the location to create the business service.
    3Select the OData V2 Protocol Writer connection that you want to use to make a call to the SAP OData V2 application.
    The following image shows the Business Service Details page:
    All the services available in the catalog service are listed.
    4Click Select Operation, and then click Select.
    5Enter the full name of the required SAP OData V2 API and then click Search. For example, enter API_SALES_ORDER_SRV and click Search.
    The following image shows the API_SALES_ORDER_SRV SAP OData V2 API listed in the search result and the entity selected is A_SalesOrder:
    You can view the API listed in the search result.
    6Select the operation name in the search result, and click Select.
    The Select Operation page appears.
    The following image shows the Select Operation page, with the OData V2 service and entity:
    You can view the Select Operation page:
    7Enter a name and description for the operation, and click OK.
    Repeat steps 4 through 6 to add multiple operations.
    The following image shows the configured business service:
    You can view the configured business service
    8Click Configure to view the metadata and structure of the SAP OData V2 API.
    The Request tab shows the import details, the Response tab shows the export details, and the Fault tab shows the fault code details.

Create a mapping

Create a mapping to include a Web Services transformation midstream in the pipeline.
Include a flat file with the sales details such as the sales order type, organization, channel, and group to create a sales order in SAP S/4HANA. Then, add a Web Services transformation midstream in the mapping that includes the business service to integrate with the SAP OData V2 API. Include a flat file target to write the response from SAP S/4HANA to a flat file.
    1Create a mapping.
    2To add a Source transformation, on the Transformation palette, click Source.
    1. aOn the General tab, enter a name and description for the source.
    2. bOn the Source tab, specify a flat file connection.
    3. cAdd a source object that contains the required inputs to the Web Services transformation.
    4. dIn the Advanced section, set the tracing level to normal.
    3To add a Web Services transformation, on the Transformation palette, click Web Services.
    1. aOn the General tab, you can enter a name and description for the Web Services transformation.
    2. bClick the Web Service tab, select the configured SAP OData business service that you created, and then select the required API object from the operation.
    3. The following image shows the SAP OData business service and selected operation:
    4. cDraw a link to connect the Source transformation to the Web Services transformation.
    5. dOn the Request Mapping tab, map the incoming fields from the flat file with the corresponding fields in the request structure that you want in the sales order.
    6. The following image shows the mapped incoming fields with the request structure:
    7. eOn the Response Mapping tab, map the incoming fields from the response structure with the output fields.
    8. The following image shows the mapped fields between the response structure and the output fields:
    9. fOn the Advanced tab, specify the required configurations.
    4To add a flat file Target transformation, on the Transformation palette, click Target.
    1. aOn the General tab, enter a name and description for the flat file target.
    2. bDraw a link to connect the previous transformation to the Target transformation.
    3. cSelect the output group from the Web Services transformation that you want to connect to the target, and click OK.
    4. dClick the Target tab, create a target at run time, specify the flat file target object, and configure the advanced target properties.
    5. eClick Field Mapping and view the fields that are automatically mapped to the target.
    6. The following image shows the configured flat file properties.
    5Click Save and Run to run the mapping.
    You can also configure a mapping task based on the mapping.
    6When you save and run the mapping task, the Secure Agent creates a sales record in SAP S/4HANA based on the details provided in the flat file source and then writes the response to the target flat file.

Example: Deep insert data

You want to deep insert a business partner entity with multiple bank details to S4 HANA.
  1. 1Create a mapping and include two sources. One of the sources must include the details of the business partner with the primary key. The other source must include the bank details with the primary key and foreign key from the business partner source.
  2. 2Map the two sources to the web service fields and mark the primary and foreign keys:
  3. 3In the Web Service transformation, select the insert operation.
  4. 4Run the mapping.