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.

SAP Integration Services by Veon Contact Banner

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

Screenshot of IDOCs structures

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).

Screenshot of Control Record sender and receiver in SAP

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.

Screenshot of Data Record IDOCs segment in SAP

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.

Screenshot of Status Record in SAP

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

Screenshot of new RFC configuration

  • 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.
    Screenshot of RFC Destination SAP-DEMO
  • 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

Screenshot of configure for IDOCs communication to non-SAP system

  • 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).

Screenshot of adding XML HTTP port in SAP

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.

Screenshot of Defining the logical system in SAP by using transaction BD54

  • 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.

Screenshot of maintain partner profile in SAP

  • Add outbound parameters for the outbound IDOCs CHRMAS and CLSMAS. We will be using this for our example.

Screenshot of outbound parameters for IDOCs CHRMAS and CLSMAS

Screenshot of outbound parameters for IDOCs CHRMAS in SAP

  • Maintain ALE distribution model to be able to communicate master data (BD64).

Screenshot of Maintain ALE distribution model to be able to communicate master data (BD64).

    • Goto transaction and click on edit and press Create Model View

Screenshot of Creating Model view of SAP Integration ALE

  • 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

Screenshot of Connection test in SAP for HTTP Connection

Step 2 : Perform a connection test.

Screenshot of Perform a connection test

  • I have written a PHP script at remote end to receive the IDOCs.

Code Snippet:

Screenshot of PHP script at remote end to receive the IDOCs

Remote Server Status

Screenshot of Remote Server Status

Step 3 : Go to  bd91 (CHRMAS) and select the logical system with your given charactestics.

Screenshot of selecting the logical system with your given characteristics

Step 4: Click on execute. We will receive the IDOCs information data as XML form at receiver end.

Screenshot of IDOCs information data as XML form at receiver

Screenshot of CHRMAS XML data

Screenshot of Status Monitor for ALE messages

Screenshot of IDoc Display Id

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.

Contact us for a free assessment