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: 
former_member184681
Active Contributor


Many times have I been wondering: are RFC calls and IDoc flat files the only way to deliver IDoc messages to an SAP system? Is there really no possibility to post an IDoc in XML form over HTTP? And it was not only me to think about that - there are also many questions about that in SDN. Finally, I am happy to announce you that the solution you have been looking for does exist. Moreover, this can be achieved in only a few simple steps, that I will show you below.

Now, before you judge me: I do know the functionality of SAP PI and other integration platforms. I do appreciate their role in system landscape. I do enjoy their functionality. And I finally I do prefer implementing integration scenarios using them. But sometimes it just happens that you need to work without them. Do not say never. Never do you know what might the future bring. And if I still did not convince you – just agree that it is worth knowing that this is all possible.

Step 1


Create inbound IDoc configuration in your system as normally. Define a new logical system if required, create a partner profile entry for inbound messages of the desired type, assigning the related process code.

Step 2


Check the configuration of the Internet Communication Framework (t-code SICF) in your system. What is really important is the Information on Port and Host (Ctrl+Shift+F12) button:



In my case, the configuration looked like that:



If you need further assistance in SICF configuration, check this link:
http://help.sap.com/saphelp_nw04/helpdata/en/69/ac75addb6811d6b2ca00508b5d5c51/frameset.htm

Step 3


You can make a connection test from SICF. Find the sap\\public\\ping service on the list, right-click on it and choose "Test service". In the popup window that appears, choose to allow connection (for instante, "Always allow"). Your internet browser's window will be called with the following path:

http://[server]:[port]/sap/public/ping?sap-client=[client]

The [server] and [port] will be  equal to what you've seen in Step 2, and [client] will be your system's client. As a result, you should see a simple HTML page saying: "Server reached successfully".

Performing this step is not required, but can help you verify that your configuration is really working and you most probably will not experience problems in further steps.

Step 4


Prepare your application that will post the IDocs to the SAP system. Use the path:

     http://[server]:[port]/sap/bc/idoc_xml?sap-client=[client]

to pass the data from your application to SAP. Here is an example of an IDoc XML data that I used to send IDoc message to SAP:

<?xml version="1.0" encoding="UTF-8"?>

<DEBMAS06>

     <IDOC>

          <EDI_DC40>

               <DOCNUM>20120114120000</DOCNUM>

               <IDOCTYP>DEBMAS06</IDOCTYP>

               <MESTYP>DEBMAS</MESTYP>

               <SNDPOR>HTTPDEMO</SNDPOR>

               <SNDPRT>LS</SNDPRT>

               <SNDPRN>HTTPDEMO</SNDPRN>

               <RCVPOR>SAPxxx</RCVPOR>

               <RCVPRT>LS</RCVPRT>

               <RCVPRN>xxxCLNT100</RCVPRN>

          </EDI_DC40>

          <E1KNA1M segment="1">

               <KUNNR>47</KUNNR>

               <NAME1>Test Customer</NAME1>

               <KTOKD>0004</KTOKD>

               <SORTL>TEST</SORTL>

               <ORT01>City</ORT01>

               <LAND1>PL</LAND1>

               <LZONE>A</LZONE>

               <SPRAS>L</SPRAS>

               <STRAS>Street</STRAS>

          </E1KNA1M>

     </IDOC>

</DEBMAS06>

Step 5


If your connection was successfull, you will receive the following HTML document as a response to your call:

<html>

     <head>

          <title>IDoc-XML-inbound ok</title>

          <h1>IDoc-XML-inbound ok</h1>

     </head>

     <body>

     </body>

</html>

You can now see your IDoc message in SAP. Here is the IDoc that I posted:



This is it, we made it!

Make sure to follow these rules when sending IDoc data:



  1. Do not use any white spaces or carriage return characters in your XML data. I only used them in the example above to ensure the data readability. But if you use them when sending data, they will be replaced with the hash mark (#), causing errors in IDoc processing in SAP.

  2. You will need to use the Unicode (UTF-8) enconding while sending data.

  3. You will have to comply with some rules while creating your IDoc's XML. In particular, use the root tag named like your IDoc type (DEBMAS06 in my exmaple), then the <IDOC> tag, followed by <EDI_DC40> Control Record. Provide Control Record details as usually. Finally, build the IDoc structure according to your IDoc type definition. You might need to create a complex, deeply nested structure, depending on your requirements.

  4. Each segment node you send has to be marked with segment="1" attribute. Otherwise, it will be interpreted as a field, which will cause an error in IDoc processing.

  5. You will have to use unique IDoc numbers in the DOCNUM field of IDoc control record. Otherwise, your IDoc will be rejected as a duplicate. The DOCNUM given will not become the IDoc number in SAP.

  6. You might want to use an XML Schema for a particular IDoc type to help you generate the correct message. Use we60 t-code in your ECC system for this purpose, type the desired message, then from the top menu choose Documentation -> XML Schema.


Alternative - IDoc over SOAP


Alternatively, it is also possible to send IDocs to SAP over SOAP protocol. You can even receive synchronous technical response. If you are interested, you might want to check these links:

"SOAP for IDOC demystified" blog by Martin Dejl

"Connecting a third party to SAP ECC using HTTP XML format" wiki by Jonathan Eaton and Ricardo Poeta

15 Comments
Labels in this area