Skip to Content

R/3 to Java Sending IDOCs Using SapIdoc Jar

In this small blog I would like to share the way how you can post and receive IDocs to SAP using java.


Following are the configurations to be done on the SAP R/3 system to send/Receive IDoc

1)      Create One TCP/IP Destination

Use the transaction SM59

            Provide a name for the RFC Destination, in our case IDOCTEST

            Select connection type as T (TCP/IP connection)

            Give a program ID (This is important), here it’s IDOCTEST

            Add a description

Now your screen should look as follows


2) Creating port and assigning logical Name

            Use the transaction WE21

            Right click on Transactional RFC and select New

            Give a port name

            Select RFC Destination created in step 1

            Your screen should look as follows





3) Creating logical system for the IDOC

            Use the transaction BD54

            Click on new entries

            Provide a Name for the logical system

            Screen shot should look as follows



4) Creating Partner Agreement

            Use the transaction WE20

            Select the partner Number

            Select partner type as LS

            Create outbound partner profile for the ORDERS



Creating inbound parameter for MATMAS as follows


Finally your screen should look as follows



You might be thinking I could not find even a single java code so far, here goes the java part


1)      Create a Java project using NWDS

2)      Create a folder lib and add the following libraries (sapidoc.jar, sapidocjco.jar, sapjco.jar) all of this are downloadable from

3)      Add this jar to the build path


To Test this you need to login to the R/3 system
Use the Transaction WE19
Select Basic Type and Enter ORDERS05
Click on Execute 
Double Click on EDIDC
Fill in the details as follows


Click on Continue.
Click on Standard Outbound Processing

Output expected at the java end

MyIDocServer is listening now…

Incoming IDoc list request containing 1 documents…

Processing document no. 0000000000208036…

Storing IDoc as XML file ‘c:IDOC_ORDERS05_0000000000208036_20081120203757.xml’… done.

Open the file to see the contents received from R/3.

In Java to R/3 Sending IDOCs Using SapIdoc Jar this blog we will see how we can send IDOC from java to R/3

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