Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
BJarkowski
Active Contributor
Microsoft Azure is much more than just virtual machines. As soon as your account is created you get unlimited access to hundreds of features that you can easily use. I have already presented a few interesting scenarios where you can use a kubernets cluster to host multiple HANA databases or protect your landscape against unexpected events with integrated disaster recovery. Azure Logic Apps is another service that you can use to enhance and optimize SAP landscape. It allows you to build chains of actions and integrate SAP solution with external systems.

Today we are going to build two Logic Applications that can communicate with the SAP system. The first one will periodically scan the Microsoft OneDrive looking for new files which content will be used to create an IDoc. The second app will send us an e-mail notification as soon as the IDoc is sent from the application server.



CREATE LOGIC APPLICATION

To create your first workflow, enter the Logic Application pane and click +Add. Fill the form with the app name, resource group and the location. Confirm by clicking Create.



To build the Logic Apps you can use one of the already existing templates. It’s a great way to learn and understand how the workflows are designed and I highly recommend spending some time to review them.

Our scenario doesn't have a predefined template so I choose to create a Blank Logic App.



Each workflow is executed by a trigger that is associated with an application we want to integrate. You can choose from a wide range of connectors to popular online services like Office 365, Salesforce, Twitter and many others. If you can’t find one you can also use a generic trigger that listens for HTTP requests.

A OneDrive connector is already built-in and exposes five triggers that start the workflow.



The connector configuration is simple and basically comes to providing required authorization to Azure Platform and selecting a directory that should be monitored.



The communication between Logic App and SAP system will be handled by HTTP connector that builds and transmits web requests. The configuration is more complex and gives you the control over the request headers and body, authentication and cookies. The message will be composed by reading the file content.



To enable the communication your SAP system has to listen for HTTP requests and the ICF node /sap/bc/idoc_xml has to be active.



I’m going to use the FLIGHTBOOKING_CREATEFROMDAT01 IDoc to verify the process. In WE20 I have created a new partner profile and defined the IDoc’s message type in the inbound parameters:



My sample IDoc used for testing:
<?xml version="1.0" encoding="UTF-8" ?>
<FLIGHTBOOKING_CREATEFROMDAT01>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<MANDT>000</MANDT>
<DOCREL>740</DOCREL>
<STATUS>56</STATUS>
<DIRECT>2</DIRECT>
<OUTMOD/>
<IDOCTYP>FLIGHTBOOKING_CREATEFROMDAT01</IDOCTYP>
<CIMTYP/>
<MESTYP>FLIGHTBOOKING_CREATEFROMDAT</MESTYP>
<SNDPOR>0</SNDPOR>
<SNDPRT>LS</SNDPRT>
<SNDPRN>KT1CLNT000</SNDPRN>
<RCVPOR>SAPKT1</RCVPOR>
<RCVPRT>LS</RCVPRT>
<RCVPRN>KT1CLNT000</RCVPRN>
<CREDAT>20180923</CREDAT>
<CRETIM>090207</CRETIM>
</EDI_DC40>
<E1SBO_CRE SEGMENT="1">
<RESERVE_ONLY>X</RESERVE_ONLY>
<TEST_RUN>X</TEST_RUN>
<E1BPSBONEW SEGMENT="1">
<AIRLINEID>LH</AIRLINEID>
<CONNECTID>0400</CONNECTID>
<FLIGHTDATE>21102018</FLIGHTDATE>
<CUSTOMERID>00002542</CUSTOMERID>
<CLASS>Y</CLASS>
<COUNTER>00000000</COUNTER>
<AGENCYNUM>00000087</AGENCYNUM>
<PASSNAME>BARTOSZ JARKOWSKI</PASSNAME>
<PASSBIRTH>03041986</PASSBIRTH>
</E1BPSBONEW>
<E1BPPAREX/>
</E1SBO_CRE>
</IDOC>
</FLIGHTBOOKING_CREATEFROMDAT01>

In order to start the test, click on the Run button in the Logic App designer and save the IDoc in the previously defined directory on OneDrive.



Once the job is finished the Azure displays a summary about each step.



You can click on a bar to more detailed information about the job execution. Let’s have a closer look to the HTTP request. The Inputs window displays how the message was constructed and where it was sent. The request body matches the content of the file.

The Outputs window tells you what happened to the message. Status code 200 means the IDoc was successfully received by SAP Application Server. In case of processing issues, you can also refer to the error message in response body.



A quick look to transaction WE20 to confirm the IDocs was imported:



A workflow can be easily enhanced by adding new steps. The bellow configuration will move each processed file to the archive directory and send an e-mail with processing status:



I have resent the same file again. This time the processing failed and l received e-mail notification:





RECEIVE IDOCS FROM SAP

The second workflow will be triggered when an IDoc is sent from the SAP Application Server. The application saves the content of the message on the OneDrive and sends an e-mail with notification.

Create a new Logic App and select HTTP Request to be the trigger.



We will re-use the parts from the first application to save the IDoc as a file and send it through e-mail.



To generate the IDocs in SAP Application Server it is required to define a new HTTP Connection pointing to the Logic App.



Now I create a port for outgoing IDocs referencing previously created HTTP destination:



I use WE19 to generate sample IDocs.



When the message is sent from SAP it triggers a workflow in the Logic App. Below you can see the summary of executed activities.



You can use Azure Logic Apps to build new integration or enhance already working scenarios. The today’s examples are just a small chunk of the workflow capabilities. I highly encourage you to create your own apps and discover more advanced features. The Logic Apps are a good alternative to expensive solutions like SAP PI or Microsoft BizTalk and it’s worth to deeply understand how can they help you to optimize your environment.
9 Comments
Labels in this area