iDoc Control Record Mapping in SAP PI/PO

Let’s look at how to set the iDoc Control Record in iDoc receiver scenario in SAP PI/PO single stack version. Due to evolution of SAP XI/PI/PO architecture, iDoc communications method as well as configurution of iDoc adapter and iDoc Control Records have changed.

In this example we will look at how to configure or set the iDoc Control record in the receiver iDoc_AAE adapter in Process Orchestration PO 7.5 single stack system. Depending on the Control Record element, method of assigning the value to the element differs.

Let’s first look at what iDoc control record fields are mandatory, then at the different ways to set these mandatory iDoc control record fields with an example.

 

Mandatory iDoc Control Record Fields:

  • TABNAM – Table Name
  • DIRECT – Direction
  • IDOCTYP – iDoc Type
  • MESTYP – iDoc Message Type
  • SNDPOR – Sender Port
  • SNDPRT – Sender Partner Type
  • SNDPRN – Sender Partner Number
  • RCVPOR – Receiver Port
  • RCVPRN – Receiver Partner Number

 

Two Main Methods to Set iDoc Control Record Parameters:

  • Applying Control Record from Payload.

If this configuration is activated at the receiver iDoc_AAE adapter Communication Channel, you can use the mapping program to set values to different iDoc Control Record header fields. You can implement your own custom logic to determine each iDoc Control Record field in Message Mapping.

Receiver iDoc_AAE communication channel configuration to set Control Records from Payload.
Receiver iDoc_AAE communication channel configuration to set Control Records from Payload.
  • Applying Control Record from Payload Deactivated.

When ‘Apply Control Records from Payload’ is deactivated at the receiver iDoc_AAE adapter communication channel, iDoc Control Records are set at runtime by combination of System Landscape Directory (SLD) configuration, Integration Directory (ID) configuration of the integration scenario and Interface name.

 

XML File to iDoc Interface to Demonstrate iDoc Control Record Assignment.

In the example iDoc Control Records will be set with ‘Apply Control Records from Payload’ option deactivated in the receiver iDoc_AAE communication channel.

Scenario: Let’s assume you have third party HR system which sends employee details in a XML format which triggers a custom iDoc Type in SAP. Third party HR system is represented as a Business Component in SAP PI/PO Integration Directory under name ‘HR_System’. Receiver SAP Business System’s name is ‘AFX’ and logical system’s name is ‘AFXCLNT200’. How you can access Logical System’s name under Adapter Specific Message Attributes (ASMA) is shown on screen shots below.

You should already have the HR system registered in SAP back end system as ‘TESTHR’. Partner profile name in SAP system corresponds to the Logical System Name of the Business Component HR_System in PI/PO Integration Directory.

Example interface overview with technical detail of each component
Example interface overview with technical details of each component

 

Disable or Map Blank Values to Mandatory iDoc Control Record Fields in Target Structure.

In the message mapping either disable or map the mandatory Control Record parameters with a blank value, else you cannot activate the message mapping program. All required iDoc Control Record fields of the target structure should be mapped or disabled in the target structure.

Mandatory iDoc Control Records Disabled

Mandatory or required fields in target iDoc structure are disabled
Mandatory or required fields in target iDoc structure are disabled

 

Mandatory iDoc Control Records mapped with blank values

Required fields of the iDoc target structure control records are mapping with a blank value
Required fields of the iDoc target structure control records are mapping with a blank value

 

Segment field of the target iDoc structure is mapped with value '1'
Segment field of the target iDoc structure is mapped with value ‘1’

Configure Receiver iDoc Communication Channel.

Deactivate ‘ Apply Control Records from Payload’ in the receiver iDoc_AAE adapter Communication Channel.

iDoc_AAE adapter Communication Channel Configuration with 'Apply Control Records from Payload' deactivated.
iDoc_AAE adapter Communication Channel Configuration with ‘Apply Control Records from Payload’ deactivated.

 

How does iDoc_AAE Receiver Adapter Determine each Mandatory iDoc Control Record Parameter?

  • TABNAM – Table Name

This is set as a constant value ‘EDI_DC40’.

  • DIRECT – Direction

Constant value ‘1’.

  • MESTYP – iDoc Message Type

This is determined from the Inbound Service Interface name, which is the iDoc Interface name in format <Message Type>.<iDoc Type>. In this example Message type is ‘ZMSG_TY_EMPLOYEE_DETAIL’.

Therefore the MESTYP is set as ‘ZMSG_TY_EMPLOYEE_DETAIL’.

Control Record parameter Message Type MESTYP set from the interface name
Control Record parameter Message Type (MESTYP) set from the interface name
  • IDOCTYP – iDoc Type

Similar to MESTYP (Message Type), IDOCTYP (iDoc Type) is also determined from the Inbound iDoc Interface Name.  In the example iDoc Type is  ‘ZEMPLOYEE_DETAIL’.

IDOCTYP set as ‘ZEMPLOYEE_DETAIL’.

Control Record parameter iDoc Type IDOCTYP set from the interface name
Control Record parameter iDoc Type (IDOCTYP) set from the iDoc Inbound Interface name
  • SNDPOR – Sender Port

Constant SAP+SYSID of the Integration Server is assigned to SNDPOR (Sender Port). SYSID in of SAP backend in this scenario is AFX. Therefore, SNDPOR set as SAPAFX.

  • SNDPRT – Sender Partner Type

Constant value ‘LS’.

  • SNDPRN – Sender Partner Number

Sender Business Component’s Adapter Specific Message Attribute (ASMA) Logical System name. In this example Logical System Name of the third party ‘HR_System’ Business Component is configured as ‘TESTHR’.

‘TESTHR’ should be the partner profile name in SAP for third party HR system.

Logical System name of the sender Business Component "HR_System" under Adapter Specific Message Attributes (ASMA)
Logical System name of the sender Business Component “HR_System” under Adapter Specific Message Attributes (ASMA)

Register corresponding Logical System Partner Profile for HR system in SAP backend using we20. Configure inbound parameters to allow communication of custom iDoc Type with the external system.

Partner Profile for logical System TESTHR in SAP backend system AFX. Transaction we20
Partner Profile for logical System TESTHR in SAP backend system AFX. Transaction we20
  • RCVPOR – Receiver Port

Determined from the port of the receiver iDoc_AAE adapter. We connect to SAP system from PI/PO using a RFC destination and iDoc_AAE adapter protocol tRFC.

  • RCVPRN – Receiver Partner Number

This is an SAP back end, and RCVPRN is set from the Business System’s Logical System name under Adapter Specific Message Attributes (ASMA).

Logical System name of the receiver SAP Business System "AFX" under Adapter Specific Message Attributes (ASMA)
Logical System name of the receiver SAP Business System “AFX” under Adapter Specific Message Attributes (ASMA)

Test XML to iDoc Interface.

Send a test message to check if iDoc Control Record fields are populated in target SAP system correctly. Go to we02 or any other iDoc monitoring transaction in SAP to view the created iDoc.

iDoc Control Records iDoc Type (IDOCTYP) and Message Type (MESTYP) assigned in target SAP system.
iDoc Control Records iDoc Type (IDOCTYP) and Message Type (MESTYP) assigned in target SAP system.

 

iDoc Control Record parameters Sender Partner (SNDPRN), Sender Partner Type (SNDPRT), Sender Partner Port (SNDPOR) assigned from PI in target SAP system. iDoc Control Record view in we02
iDoc Control Record parameters Sender Partner (SNDPRN), Sender Partner Type (SNDPRT), Sender Partner Port (SNDPOR) assigned from PI in target SAP system.

 

How to Override iDoc Control Record Parameters?

You can override these parameters using ‘Override iDoc Control Headers’ option in receiver iDoc communication channel. Specify the name of the Control Record field and Corresponding value to override the parameters.

Activate Override Sender from Control record at receiver iDoc_AAE adapter Communication Channel and assign values to SNDPRN
Override iDoc Control Record parameters at receiver iDoc_AAE adapter Communication Channel and assign value to SNDPRN and SNDPRT

If you activate ‘Override iDoc Control Headers’ in receiver iDoc_AAE Communication Channel and assign values to Control Record fields as above, automatically determined values would be replaced by configuration values. In this example, Sender Partner Number (SNDPRN) will be populated in the iDoc as 100012 instead of TESTHR. Also Sender Partner Type (SNDPART) value LS will be overwritten as KU in the iDoc.

Override Only SNDPRN from Payload.

If you just want to override the sender partner related control records such as SNDPRN, SNDPRT, etc. from the payload, activate ‘Apply Sender from Payload’ in receiver communication channel. Now you can set sender related parameters from mapping program.

Activate 'Apply Sender from Payload' in receiver iDoc_AAE adapter
Override iDoc Control Record parameters at receiver iDoc_AAE adapter Communication Channel

 

Activate Override Sender from Control record at receiver iDoc_AAE adapter Communication Channel and assign values to SNDPRN
Override iDoc Control Record parameters at receiver iDoc_AAE adapter Communication Channel and assign value to SNDPRN and SNDPRT

Set Receiver RCVPRN from Payload.

Similarly receiver related Control Records can be overwritten by mapping program (payload) by activating ‘Apply Receiver from Payload’.

 

Set Optional iDoc Control Parameters from Mapping Program.

Use the mapping program to set values to other optional iDoc Control Record fields.

Optional iDoc Control Record parameter MEDCOD (Message Varient) mapped using message mapping
Optional iDoc Control Record parameter MEDCOD (Message Varient) mapped using message mapping.

 

Optional iDoc Control Record parameter MESCOD value assigned from message mapping program in PI. Image shows the field with constant value 'XX' assigned in transaction we02.
Optional iDoc Control Record parameter MESCOD value assigned from message mapping program in PI.

If you have any questions about iDoc Control Record determination in SAP PI/PO receiver iDoc_AAE adapter, please leave a comment below.

Add a Comment

Your email address will not be published. Required fields are marked *