There are quite some and detailed posts on emulating the process to post IDoc xml over HTTP and also posting IDoc using SOAP protocol. However, there are times where we want to test these scenarios ourselves using some kind of tools/ Applications. This document details on some of the various tools which we could use to post IDoc XML to sap.
IDoc xml over HTTP
You could follow the blog here from Grzegorz Glowacki for detailed step-by-step procedure to set up the configuration.
In nutshell these are the steps to post IDoc xml to SAP over HTTP:
- Maintain distribution model in BD64 & generate Inbound Partner Profiles. Use WE20 to set up partner profiles manually.
- Check HTTP is enabled ( which is true in almost every case ) . Tcode SMICM è GoTo è Services (Shift +f1).
- Activate the idoc_xml service in SICF . Path /sap/bc/idoc_xml/ Virtaual Host is usually the default one.
- Ping http://[server]:[port]/sap/public/ping?sap-client=[client] to get response “Server reached successfully”.
Tools to post Idoc XML :
- Mozilla Firefox browser with RESTClient addon by Chao ZHOU.
The UI is simple and straightforward. One could click and add additional custom headers & Authentication for the message easily.
Once you install the add on, click on the RESTCLIENT add on to trigger the below screen. Select Method “POST” and enter the url as http://<server>:<port>/sap/bc/idoc_xml?sap-client=<client>
Click on the header and add the header as text/xml and click on Authentication to add the basic authentication as below.
Once you enter the above details and press “SEND” to post the XML to SAP. You should get response as “IDoc-XML-inbound ok”.
IDoc is successfully posted as shown below.
WE05 / WE09 in SAP:
- Google Chrome with Postman addon by www.getpostman.com with better UI and more features like the possibility to run scripts before request is called and save test cases etc. I like this personally because of the ease of the UI and the possibility to see the History. The working of this tool is similar to REST CLIENT add-on on Mozilla.
Enter the URL/ Endpoint along with selecting basic authorization. Select the format as text/xml in the headers and press SEND to post the IDoc to SAP. Status code 200 represents a successful posting to SAP.
SoapUI is a free and open source cross-platform for testing SOAP and REST services. It has got easy-to-use graphical interface , enterprise-class features and has multiple options when it comes to creating test scenarios. More about SOAP UI here. Download latest version of SOAP UI from here
First step would to create a new REST project as shown below. Click on new REST project and input the endpoint/URL where the IDoc needs to be posted to:
Enter the URL and press enter.
Choose the authentication as Basic and select the Authenticate pre-emptively option.
Now choose the method as “POST” along with selecting the media type as text/xml as shown below. Copy paste the IDoc xml with out any whitespaces and paragraph breaks into the REQUEST /INPUT window as shown below and press on submit.
When the IDoc is successfully received at the recipient SAP system, following success message is shown in SOAPUI.
- Use textfixer to remove the white spaces between the tags and paragraphs in the xml. Formatted XML should like the one below:
<?xml version=”1.0″ encoding=”UTF-8″?><ADRMAS03><IDOC BEGIN=”1″><EDI_DC40 SEGMENT=”1″><TABNAM>EDI_DC40</TABNAM><DOCREL>702</DOCREL><DIRECT>2</DIRECT><OUTMOD>3</OUTMOD><IDOCTYP>ADRMAS03</IDOCTYP><MESTYP>ADRMAS</MESTYP><STD></STD><SNDPOR>WSO2</SNDPOR><SNDPRT>LS</SNDPRT><SNDPRN>WSO2</SNDPRN><RCVPOR>NL</RCVPOR><RCVPRT>LS</RCVPRT><RCVPRN>ERDCLNT400</RCVPRN></EDI_DC40><E1ADRMAS SEGMENT=”1″><OBJ_TYPE>KNA1</OBJ_TYPE><OBJ_ID>0030000005</OBJ_ID><CONTEXT>0001</CONTEXT><E1BPAD1VL SEGMENT=”1″><TITLE>0001</TITLE><NAME>Jhon</NAME><NAME_2>Nestle</NAME_2> <CITY>NL</CITY><POSTL_COD1>sdsd</POSTL_COD1><POSTL_COD2>NL</POSTL_COD2><PO_BOX>123456789</PO_BOX><PO_BOX_CIT>AM</PO_BOX_CIT><STREET>sdsd</STREET><HOUSE_NO2>4545</HOUSE_NO2><COUNTRY>NL</COUNTRY><COUNTRYISO>NL</COUNTRYISO></E1BPAD1VL><E1BPAD1VL1><ADDR_GROUP>BP</ADDR_GROUP></E1BPAD1VL1><E1BPADFAX SEGMENT=”1″><COUNTRY>NL</COUNTRY><COUNTRYISO>NL</COUNTRYISO><STD_RECIP>X</STD_RECIP><HOME_FLAG>X</HOME_FLAG><CONSNUMBER>001</CONSNUMBER></E1BPADFAX><E1BPADSMTP SEGMENT=”1″><E_MAIL></E_MAIL><STD_RECIP>X</STD_RECIP><HOME_FLAG>X</HOME_FLAG><CONSNUMBER>001</CONSNUMBER></E1BPADSMTP><E1BPADURI SEGMENT=”1″><URI_TYPE>HPG</URI_TYPE><URI>http://www.google.com</URI><HOME_FLAG>X</HOME_FLAG><CONSNUMBER>001</CONSNUMBER></E1BPADURI></E1ADRMAS></IDOC></ADRMAS03>
- Always use the addition encoding=”UTF-8″ in the xml message.
- Some times you get error “IDoc ‘0000000000000000’ has already been received, therefore reception is refused”. To over come this error message, you need to put an external break-point in the include LEDINF10 after the select statement on SRRELROLES. Now make the retrun code to “1” after the select on SRRELROLES , to post the Idoc with out any error. The cause of the error (“I think”) could be due to inconsistency in buffer refresh. Every time an IDoc is posted from one of the above tools, SAP tries to select an IDoc with number 0000000000000000 from SRRELROLES, which seems to always exist and eventually the error.
Fix as described above:
- You could use function module IDOC_XML_TRANSFORM to transform an existing IDoc into XML format.