[SAP CPI] – HOW TO SEND XML IDOC IN SAP/ECC BY HTTPCLIENT

Hi guys, in this article I will talk about how to create Sales Order in SAP ECC by send IDOC XML from Http client (ex : Postman, SOAPGUI,…). This article is base of next article, create Sales Order from SAP CPI. Here we go.

Message Type : ORDERS

Basic Type : ORDERS05

Template XML of IDOC :

<?xml version="1.0" encoding="UTF-8"?><ORDERS05><IDOC BEGIN="1"><EDI_DC40 SEGMENT="1"><CIMTYP></CIMTYP><DOCNUM>3</DOCNUM><TABNAM>1</TABNAM><DIRECT>2</DIRECT><IDOCTYP>ORDERS05</IDOCTYP><MESTYP>ORDERS</MESTYP><SNDPOR>SAPPID</SNDPOR><SNDPRT>LS</SNDPRT><SNDPRN>PIDCLNT120</SNDPRN><RCVPOR>SAPECD</RCVPOR><RCVPRT>LS</RCVPRT><RCVPRN>ECDCLNT190</RCVPRN><REFINT>SG33</REFINT></EDI_DC40><E1EDK01 SEGMENT="1"><CURCY>VND</CURCY><ZTERM>Z003</ZTERM></E1EDK01><E1EDK14 SEGMENT="1"><QUALF>012</QUALF><ORGID>ZCDN</ORGID></E1EDK14><E1EDK14 SEGMENT="1"><QUALF>008</QUALF><ORGID>1123</ORGID></E1EDK14><E1EDK14 SEGMENT="1"><QUALF>007</QUALF><ORGID>10</ORGID></E1EDK14><E1EDK14 SEGMENT="1"><QUALF>006</QUALF><ORGID>10</ORGID></E1EDK14><E1EDK14 SEGMENT="1"><QUALF>016</QUALF><ORGID>SG33</ORGID></E1EDK14><E1EDK03 SEGMENT="1"><IDDAT>012</IDDAT><DATUM>20220315</DATUM></E1EDK03><E1EDK03 SEGMENT="1"><IDDAT>002</IDDAT><DATUM>20220315</DATUM></E1EDK03><E1EDK05 SEGMENT="1"><ALCKZ>+</ALCKZ><KSCHL>ZDP0</KSCHL><KRATE>0</KRATE></E1EDK05><E1EDKA1 SEGMENT="1"><PARVW>AG</PARVW><PARTN>9999990142</PARTN><IHREZ></IHREZ><BNAME></BNAME></E1EDKA1><E1EDKA1 SEGMENT="1"><PARVW>Z1</PARVW><PARTN>5000010685</PARTN></E1EDKA1><E1EDKA1 SEGMENT="1"><PARVW>Z8</PARVW><PARTN>5555555555</PARTN></E1EDKA1><E1EDK02 SEGMENT="1"><QUALF>001</QUALF><BELNR>SG3332000000001</BELNR></E1EDK02><E1EDKT1 SEGMENT="1"><TDID>Z050</TDID><E1EDKT2 SEGMENT="1"><TDLINE>17:00 - 20:00|</TDLINE><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z060</TDID><E1EDKT2 SEGMENT="1"><TDLINE>5000010685|000|000|000||.|2022/03/15|17:00 - 20:00|0|EIB01</TDLINE><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z070</TDID><E1EDKT2 SEGMENT="1"><TDLINE>.</TDLINE><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z080</TDID><E1EDKT2 SEGMENT="1"><TDLINE>DC07|DC720</TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z090</TDID><E1EDKT2 SEGMENT="1"><TDLINE>test1</TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z110</TDID><E1EDKT2 SEGMENT="1"><TDLINE>, ., PHƯỜNG NAM THANH, ,</TDLINE><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z120</TDID><E1EDKT2 SEGMENT="1"><TDLINE></TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z130</TDID><E1EDKT2 SEGMENT="1"><TDLINE></TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z030</TDID><E1EDKT2 SEGMENT="1"><TDLINE>, ., ., ., .</TDLINE><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2><E1EDKT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z150</TDID><E1EDKT2 SEGMENT="1"><TDLINE>0</TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z160</TDID></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z040</TDID><E1EDKT2 SEGMENT="1"><TDLINE></TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z140</TDID><E1EDKT2 SEGMENT="1"><TDLINE></TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z010</TDID><E1EDKT2 SEGMENT="1"><TDLINE>9999990142</TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z020</TDID><E1EDKT2 SEGMENT="1"><TDLINE>test1</TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z180</TDID><E1EDKT2 SEGMENT="1"><TDLINE></TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z170</TDID><E1EDKT2 SEGMENT="1"><TDLINE></TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z210</TDID><E1EDKT2 SEGMENT="1"><TDLINE>EIB01</TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z220</TDID><E1EDKT2 SEGMENT="1"><TDLINE>2022-03-15T00:00:00+07:00</TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z230</TDID><E1EDKT2 SEGMENT="1"><TDLINE>17:00 - 20:00</TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z240</TDID><E1EDKT2 SEGMENT="1"><TDLINE></TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z250</TDID><E1EDKT2 SEGMENT="1"><TDLINE>1</TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z260</TDID><E1EDKT2 SEGMENT="1"><TDLINE></TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z280</TDID><E1EDKT2 SEGMENT="1"><TDLINE></TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z300</TDID><E1EDKT2 SEGMENT="1"><TDLINE></TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z310</TDID><E1EDKT2 SEGMENT="1"><TDLINE></TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z320</TDID><E1EDKT2 SEGMENT="1"><TDLINE>11.450.000</TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><TDID>Z330</TDID><E1EDKT2 SEGMENT="1"><TDLINE>0</TDLINE></E1EDKT2></E1EDKT1><E1EDKT1 SEGMENT="1"><E1EDKT2 SEGMENT="1"><TDLINE></TDLINE></E1EDKT2></E1EDKT1><E1EDP01 SEGMENT="1"><POSEX>10</POSEX><MENGE>1.00</MENGE><MENEE>CAI</MENEE><CURCY>VND</CURCY><PSTYV></PSTYV><LGORT>1001</LGORT><E1EDP02 SEGMENT="1"><QUALF>083</QUALF><BELNR>SG33</BELNR></E1EDP02><E1EDP05 SEGMENT="1"><ALCKZ>+</ALCKZ><KSCHL>VKP1</KSCHL><BETRG>11450000</BETRG><KRATE>11450000</KRATE></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>-</ALCKZ><KSCHL>ZDC1</KSCHL></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>-</ALCKZ><KSCHL>ZDC2</KSCHL></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>-</ALCKZ><KSCHL>ZDC3</KSCHL></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>-</ALCKZ><KSCHL>ZDC4</KSCHL></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>-</ALCKZ><KSCHL>ZDC5</KSCHL></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>+</ALCKZ><KSCHL>NETW</KSCHL><BETRG>10409091</BETRG></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>+</ALCKZ><KSCHL>ZMSI</KSCHL><KOTXT>10409091</KOTXT><BETRG>1040909</BETRG><MSATZ>O3</MSATZ></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>+</ALCKZ><KSCHL>ZSC1</KSCHL></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>+</ALCKZ><KSCHL>ZCC1</KSCHL></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>-</ALCKZ><KSCHL>ZDI1</KSCHL></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>-</ALCKZ><KSCHL>ZDI2</KSCHL></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>-</ALCKZ><KSCHL>ZSC2</KSCHL></E1EDP05><E1EDP05 SEGMENT="1"><ALCKZ>-</ALCKZ><KSCHL>ZCC2</KSCHL></E1EDP05><E1EDP05 SEGMENT="1"><KSCHL>ZGP1</KSCHL><BETRG>0</BETRG><KRATE>0</KRATE></E1EDP05><E1EDP05 SEGMENT="1"><KSCHL>ZGP2</KSCHL><BETRG>0</BETRG></E1EDP05><E1EDPA1 SEGMENT="1"><PARVW>Z2</PARVW><PARTN>5000010685</PARTN></E1EDPA1><E1EDPA1 SEGMENT="1"><PARVW>Z5</PARVW><PARTN></PARTN></E1EDPA1><E1EDPA1 SEGMENT="1"><PARVW>Z6</PARVW><PARTN></PARTN></E1EDPA1><E1EDPA1 SEGMENT="1"><PARVW>Z3</PARVW><PARTN></PARTN></E1EDPA1><E1EDP19 SEGMENT="1"><QUALF>002</QUALF><IDTNR>000000000010000001</IDTNR></E1EDP19><E1EDPT1 SEGMENT="1"><TDID>Z350</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z360</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z370</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z380</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z390</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z400</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z410</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z420</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z430</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z440</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z340</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z310</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z330</TDID><E1EDPT2 SEGMENT="1"><TDLINE>X</TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z325</TDID><E1EDPT2 SEGMENT="1"><TDLINE>1001</TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z300</TDID><E1EDPT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDPT2><E1EDPT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDPT2><E1EDPT2 SEGMENT="1"><TDFORMAT>=</TDFORMAT></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT=""><TDID>Z327</TDID><E1EDPT2 SEGMENT=""><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z470</TDID><E1EDPT2 SEGMENT="1"><TDLINE>06</TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z480</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z490</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z500</TDID><E1EDPT2 SEGMENT="1"><TDLINE>SG33</TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z510</TDID><E1EDPT2 SEGMENT="1"></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z520</TDID><E1EDPT2 SEGMENT="1"></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z530</TDID><E1EDPT2 SEGMENT="1"></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z540</TDID><E1EDPT2 SEGMENT="1"></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z550</TDID><E1EDPT2 SEGMENT="1"></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z560</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z570</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z580</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z590</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z600</TDID><E1EDPT2 SEGMENT="1"><TDLINE></TDLINE></E1EDPT2></E1EDPT1><E1EDPT1 SEGMENT="1"><TDID>Z610</TDID><E1EDPT2 SEGMENT="1"><TDLINE>SG33</TDLINE></E1EDPT2></E1EDPT1><E1EDC01 SEGMENT="1"><E1EDC05 SEGMENT="1"><ALCKZ>-</ALCKZ><KSCHL>ZDC6</KSCHL></E1EDC05></E1EDC01></E1EDP01></IDOC></ORDERS05>

Every time you use this file to send SAP, you have change the IDOCNUM of file.

Step 1 : Active Service Idoc_XML

Go to T-Code : SICF and find service with name : idoc_xml

Run Test Services, and take a look URL of service. This url will use later.

The Endpoint will like this : https://<host name>:<portnumber>/sap/bc/idoc_xml ? sap-client =xxx

Step 2 : Test service by Http client SOAP UI

Open SOAPUI, choose REST and post endpoint in it.

  • (1) : Method = POST
  • (2) : Host name
  • (3) : Resource
  • (4) : Parameter : sap-client = xxx
  • (5) : Body : XML data IDOC
  • (6) : Media Type : application/xml

Some case

Case 1 : IDOC NUMBER (DOCNUM) exist

Case 2 : Send OK

Check on SAP, T-Code = WE02

Case 3 : If all property of XML set by constant as below

Will get error with message as below

Summary

This is all step how to send IDOC XML from Http client to SAP ERP. This article will be base of next article how to send IDOC XML from SAP CPI to SAP ERP through SAP Cloud Connector. If have any question, kindly leave your comment in below. Thanks for your reading.

Regards.

Joseph.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.