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.
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.
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:
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:
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.
Prepare your application that will post the IDocs to the SAP system. Use the path:
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″?>
If your connection was successfull, you will receive the following HTML document as a response to your call:
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:
- 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.
- You will need to use the Unicode (UTF-8) enconding while sending data.
- 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.
- 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.
- 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.
- 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: