Hi Guys,
Continue serial of SAP IDoc articles, in this topic i will show you detail information of SAP IDoc header. It will help you transfer or receive data between SAP PO and SAP ERP | SAP S4 HANA.
To understand principle concept of SAP IDOC, you can access my previous topic here https://dangvinhcuong.com/2019/02/22/sap-idoc-tutorial/

1 – What is IDOC header ?
IDOC Header segment is a table where you can find information of logical system and business document information. In SAP ERP view we can call as “Control Record”.
In IDoc Header contain status and information of business document:
– SAP IDoc Number: unique number generated by SAP when create IDOC
– Message direction: Direction of messages (Inbound / Outbound)
– Status of message: Current status of IDOC was created in SAP
– Basic type: Business document related has been created in SAP

Routing information for IDOC Message
In partner group as picture below, you can see detail information of sender and receiver system, those information need to setup in partner profile tcode : WE20
Partner’s system information help SAP identify message technical information of message before create IDOC.
Port help SAP know version of IDOC will communicate with SAP and RFC (Remote Function Call) get detail connection and credential to SAP System. To define Port you can use tcode : WE21. Define RFC Connection use tcode: SM59


2 – IDOC Header Information
IDoc header fields
Segment Name | Field Name | Remarks |
EDI_DC40 | TABNAM | Name of table structure |
MANDT | SAP Client | |
DOCNUM | SAP IDoc Number | |
STATUS | Status of IDoc | |
DIRECT | Direction | |
OUTMOD | Output mode | |
TEST | Test flag | |
IDOCTYP | Name of basic type | |
MESTYP | Message type | |
SNDPOR | Sender port (SAP system, external subsystem) | |
SNDPRT | Partner type of sender | |
SNDPRN | Partner number of sender | |
RCVPOR | Receiver port | |
RCVPRT | Partner type of receiver | |
RCVPRN | Partner number of receiver |
3 – Inbound IDOC Header Mapping

In SAP PO message mapping

In detail Inbound IDOC header we need to provide information in EDI_DC40 segment:
1. Technical table
2. Business object type (Basic Type and Message Type)
3. Direction of message (inbound / outbound)
4. Sender partner system
5. Receiver partner system
In SAP PO receiver communication channel
In the receiver channel, SAP PO capture IDOC Header from partner system or from message mapping payload and attach information then send to SAP ERP.

In receiver SAP System (SAP ERP, SAP CAR, SAP S4HANA)
IDOC Messages come to SAP system via RFC(Remote Function Call) connection, based on Header information SAP will allow IDOC creation. Business document again will be created base on business routing what we defined in “Partner profiles” function (tcode : we20 )


Each message type SAP have different behavior to process IDOC and create business documents.
Example:
When we create Sales Order, SAP will create Sales Order IDOC and Sales Order document on SAP immediately. But when we send sales per receipt to SAP CAR, SAP CAR will send messages into inbound Queues first then business user need to show the system when data should create receipt document.
There are an interesting question with message mapping when we have multi SAP destination system environments.
Normally, in SAP landscape we have three environments
DEV – Development Environment
QAS – Testing Environment
PRD – Production Environment.
So sender and receiver system/port in IDOC header can be different. To avoid manual setting message mapping we have two solutions:
IDOC Header can be provided by source system
IDOC Header can adjusted via “Values Mapping” then SAP PO consultant can manual adjust Integration Builder function without and transportation require.
4 – Outbound IDOC Header receiving
In outbound scenario, IDOC header configuration steps (Partner Profile) in SAP also the same with Inbound scenario.
But there are some notes you need to consider:
– if SAP send to another SAP system then partner type should be “Customer”.
– if SAP send to SAP PO then partner type is “Logical System”
– Message type will be defined in “Outbound” group in partner profile


Conclusion, to understand detail of header IDOC information help SAP PO consultant configuration properly. Functional consultant can perform inbound / outbound do unit test with SAP IDOC independently
Thank you for your attention and let me know any idea by comment article below.
Cuong Dang
Thanks my friend. This articles is very helpful 🙂
LikeLike
Thanks and have a nice day bro
LikeLike
Partner Type KU (CUSTOMER) is also used in B2B scenarios that move via pi/po.
LikeLike
Yup thanks
LikeLike
An impressive share! I have just forwarded this onto a colleague who had been doing a little homework on this. And he actually ordered me breakfast because I stumbled upon it for him… lol. So allow me to reword this…. Thank YOU for the meal!! But yeah, thanx for spending some time to talk about this matter here on your web page.
LikeLike