Skip to Content

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:

/wp-content/uploads/2012/01/20120114_01_121648.png

In my case, the configuration looked like that:

/wp-content/uploads/2012/01/20120114_02_121649.png

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:

/wp-content/uploads/2012/01/20120114_03_121650.png

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

To report this post you need to login first.

14 Comments

You must be Logged on to comment or reply to a post.

  1. Former Member

    Hi Grzegorz!

    Thanks for your blog, I always find something useful.

    I`ve emplemented the idoc PORDCR04 and ORDERS05 via xml and faced with immediate processing of idoc on receiver side (SAP ERP). The idoc is written with status 64 and the only way to process it is run program RBDAPP01 or hand process in tcode BD17.

    Maybe you have some suggestions about this issue?

    Best regards,

    Sergey.

    (0) 
    1. Grzegorz Glowacki Post author

      Hi Sergey,

      Most probably this is simply because of your partner profile setting in ECC. Change it to “Trigger immediately” and IDocs will be processed right away.

      Regards,

      Grzegorz

      (0) 
      1. Former Member

        Grzegorz,

        i forget to note, that in partner profile in ECC parameter “Trigger immediately” has been already checked.

        Any other idies?

        Do I need to specidy inbound port XML-HTTP?

        Best regards,

        Sergey.

        (0) 
      2. Former Member

        Grzegorz,

        I`ve resolved problem. The cause is the blocked user WF-BATCH.

        For immediate processing fm IDOC_INBOUND_XML_VIA_HTTP generates event, that triggers the idoc processing via task TS30200090.

        Hope, this help to someone else.

        Best regards,

        Sergey.

        (0) 
  2. Former Member

    Grzegorz,

    Thanks for writing such a wonderful blog ,Please can you explain what are the we21 steps for this , do we need any standard program to register or any SOAMANAGER settings to be done. any help will be appreciate and helpful.

    Many Thanks ,

    Prasad.

    (0) 
    1. Grzegorz Glowacki Post author

      Hi Prasad,

      There is no need for WE21 configuration, you’re with this method you are sending IDocs over HTTP using SICF, it is sort of alternative for RFC or files that require a port.

      However, e.g. the partner profile in WE20 or other IDoc configuration you need to create normally.

      Regards,

      Greg

      (0) 

Leave a Reply