Extend the integration flow

Extend the integration flow

Process Integration – Extend the integration flow

In the previous chapter you have created an integration package and an integration flow that can be called using a REST API. In this chapter, you will refine the integration flow so that it also writes the data in an SAP S/4HANA system. Hence, once an order is created from any system using the REST API, the associated maintenance contract will be written into the maintenance contract database and in parallel a purchase order will be created in the ERP.

Chap_1_

Access the Cloud Integration service

Make sure you are inside the SAP Integration Suite - Integration and APIs section, otherwise access the Lobby and navigate to the Design section in the left-hand menu.

Chap_1

Extend the existing integration flow

In this exercise, you will extend the integration flow from chapter 2 to write the order in the S/4 HANA system - in parallel to the entry of the maintenance contracts database.

  1. Navigate to the Design section of the Cloud Integration service.
  2. Locate your integration package (“Orders_”) and open it.
  3. Navigate to Artifacts section and Open the integration flow (“ProcessOrder_”) by clicking on it.
  4. Click on the Edit button to start making changes.
  • We will now add a representation of the S/4 HANA system into our integration flow to send the sales order to it.
  1. In the integration flow editor, in the palette (i.e. toolbar), click on the Participants icon and select Receiver.

Chap_3
  1. Position the new receiver at the right of your integration flow.

  2. Rename the receiver into S4HANA by changing its Name in the properties panel at the bottom of the editor. Because we now have multiple receivers, it is a good idea to also rename the first receiver (PostgreSQL) into something more meaningful.

  3. Click on the first Receiver (connected through JDBC) and change its name into PostgreSQL.

We will now add another end step of our integration flow. This end message step allows you to send data to a receiver system after the integration flow processing is finished.

Note

the response of the system is sent back to the integration flow caller automatically when using this step. If you wanted to check the response of the system, you would rather use a request-reply step.
  1. In the palette, click on Events and select End message.

Chap_3
  1. Position the end message flow step under the existing one, left from your S/4HANA receiver.
  • We will now connect the end of the integration flow to the S/4HANA receiver using the OData v2 adapter.
  1. Click on the end flow step you just added, select the arrow and click on the S/4HANA receiver.

Chap_3
  1. Select OData as adapter type and OData v2 as message protocol.

Chap_3
  • We will now configure the communication with the S/4HANA system. This is done through the properties of the adapter.
  1. Click on the arrow between the end flow step and the S/4HANA receiver.
  2. Maximize the properties pane using the button at the bottom right corner of your screen.

Chap_3
  1. Configure the Connection as follows:
    • Address:
    • Proxy Type: Internet
    • Authentication: Basic
    • Credential name: AC_S4_OnPrem
    • CSRF Protected: uncheck
    • Reuse Connection: check

The configuration should look like this:

Chap_3
  1. Now click on the Processing tab

  2. Set the Operation Details to POST

  3. Click on Select next to the Resource Path input field to open the OData wizard In the first step, notice that all field are prepopulated with the ones you have entered in the Connection tab.

Chap_3
  1. Click on Step2 and configure the operation as follows:

    1. Operation: Create (POST) (defaulted)
    2. Sub Levels: 1
    3. Select Entity: A_SalesOrder
    4. Generate XML Schema Definition: checked

    Chap_3
  2. Select the following fields:

    1. SalesOrderType
    2. SalesOrganization
    3. DistributionChannel
    4. OrganizationDivision
    5. SoldToParty
    6. PurchaseOrderByCustomer
    7. to_Item/Material
    8. to_Item/RequestedQuantity
  3. Deselect the foreign keys

    1. SalesOrder (at the very top)
    2. to_Item/SalesOrder
    3. to_Item/SalesOrderItem
  4. Click on Finish.

The configuration of your adapter should look like this:

Chap_3
  1. Click on Save in the integration flow editor.

Define the mapping

We will now map the correct fields from the incoming payload onto the payload expected by the S/4HANA system. Note that we will use:

  • an OpenAPI specification file for the incoming message
  • the XSD message structure we have just created from the OData adapter
  1. In the palette, click on Mapping and select Message Mapping.

Chap_3
  1. Position the message mapping flow step to the left of the End flow step you created previously.
  2. Connect the mapping flow step to the end flow step.

Note that there are 2 different approaches for this tutorial step.

You can do the first approach, Import the Mapping to save some time.

You can instead do the second approach, Manual steps, which will teach you about how to create such mappings.

In the interest of time, you will follow the Import the Mapping approach. However, the Manual steps approach is available as an optional exercise.

Import the Mapping

  1. Download the ZIP file locally.
  2. Click on an empty spot of your integration flow canvas.
  3. Click on References
  4. Click on Add
  5. Click on Mapping
  6. Click on Message Mapping >
    Chap_3
  7. Select the ZIP file you have downloaded and click Add >
    Chap_3
  8. Click on your Message Mapping 1 flow step
  9. Click on the Processing tab.
  10. Click on the Select button.
    Chap_3
  11. Select the mapping you just added and click OK >
    Chap_3

Orchestrate the integration flow

We will now finish the configuration of the integration flow by parallelizing the execution of the communication with the Azure PostgreSQL and the S/4HANA system.

  1. Click on the Routing icon of the palette, select Multicast and then Sequential Multicast.

Chap_3
Chap_3
  1. Click on the line between the Start and Converter flow steps. The line should highlight green.

Chap_3
  1. Select the Multicast flow step and then drag and drop the arrow of the contextual menu to the message mapping created previously.

Chap_3
Chap_3
  1. Beautfy your integration flow by using the blue dots and the anchors of the flow steps.

Chap_3

Chap_3

Your integration flow should now look something like this:

Chap_3
  1. Save and Deploy your integration flow so that we can test it.

Test the integration flow

  1. Reuse the API Call you made in the previous chapter in order to test the new integration flow. The endpoint has not changed so just execute the request from Postman (or any other tool of your choice).

Still keep in mind that the order reference must be unique. Replace PXXXXXX-*** with

If everything goes fine, the response of the integration flow should be a 201 code as depicted below.

Chap_3

Note: Please do note down the Sales Order Number as we will be using it in exercise 4.

Chap_3
  1. Check the data in PostgreSQL Maintenance Contract Database using UI exposing its data. Lobby. Filter by your Order Reference Number.
    Chap_3

Note

In case you did not have time to go through all steps, you can also import the integration flow from the

Congratulations! You are now ready for the next lesson!