SAP is a vast application and has various ways to connect it. IDOC (Intermediate Document) is one such way in which SAP can talk to third party applications. In simple terms, IDOC is an SAP object that carries data business data to and from SAP in the form of electronic message. It stands for Intermediate Document.
It can be triggered in SAP system or EDI system. This depends on the direction in which IDOCs is sent and is called as Inbound IDOCs and Outbound IDOCs accordingly.
Read how to integrate SAP using real time RFC calls.
In case of outbound data exchange, IDOCs is triggered in SAP through document message control which is then sent to EDI subsystem. EDI converts the data from IDOCs into XML or equivalent format and then sends the data to partner system through Internet. In this article, we will be using non-SAP system to receive the IDOCs from SAP. IDOCs are specially useful when exchange of information needs to be done as per EDIFACT or ANSI standards.
IDOCs Structure
There are three parts of an IDOC. Understanding IDOCs structures is a crucial part since each of these parts plays an important role. These three parts are listed below.
-
- Control Record
- Data Record
- Status Record
These records are stored in the transparent tables in SAP. These are EDIDC, EDID4 and EDIDS respectively.
Control Record
It contains the information such as IDOC number, direction, status, Basic Type, Message Type, Partner (sender/receiver).
Data Record
It will have the IDOCs segment which contains the necessary information to for the receiver end. In general word, we can say the body of IDOCs.
Status Record
As name suggest, it shows the processing status of the IDOCs. It will help us to the track the various stages of IDOCs.
As mentioned earlier, we will be using non-SAP system to receive the IDOCs from SAP. For this, we have to configure our SAP. We will be using Logical system to receive the same.
How to Configure IDOCs in step by step manner
Having understood about IDOCs, now let us look at how to configure an exchange of information in a step by step manner. The details are listed below.
-
- Creating a new RFC Destination of Type G.
- Goto SM59 and click on create button
- Creating a new RFC Destination of Type G.
- Provide the following inputs. Please ignore any warning message like Query string now allowed.In below case, as you can see the target system in a PHP application.
- Creating a port to configure for IDOCs communication to non-SAP system.
- Goto WE21, place your cursor on XML HTTP Port and click on create
- Enter the following values. Please note that RFC destination is a drop-down which needs to be selected (we created it in the above step).
Defining the logical system in SAP.
Go to transaction BD54. (This will create a workbench transport). Click on new entries and provide the below and save.
- Maintain partner profile (WE20) for outbound IDOCs related to Orders, Delivery, Invoices, Catalog, Catalog Items).
- Go to WE20,
- Select partner type as logical system and click on create.
- Provide partner no as same as defined in point d.
- Add outbound parameters for the outbound IDOCs CHRMAS and CLSMAS. We will be using this for our example.
- Maintain ALE distribution model to be able to communicate master data (BD64).
-
- Goto transaction and click on edit and press Create Model View
- Press save and click on the distribution model and press Add Message Type. Give sender as the SAP system which is sending the data. Give Receiver as APPSECONN. Give message type as, DEBMAS and DOCMAS one by one.
- Now, we have setup the configure environment. We will be testing it using the remote application.
Step 1 : Put the remote application host address in using WE21
Step 2 : Perform a connection test.
- I have written a PHP script at remote end to receive the IDOCs.
Code Snippet:
Remote Server Status
Step 3 : Go to bd91 (CHRMAS) and select the logical system with your given charactestics.
Step 4: Click on execute. We will receive the IDOCs information data as XML form at receiver end.
By following the above steps, we are successfully able to receive the IDOCs information at remote location. Also,We can use this process to any e-commerce website based on the business requirement.
About us and what we do
We are passionate about seamlessly connecting SAP with other applications in your landscape. Our consultants are not only expert in SAP integration, but can also enable you to write an SAP adapter for your application and help your application talk to a SAP system.