To get Dynamic values of Control record of IDoc using Parameterized mapping / using UDF approach.
Applies to: SAP NetWeaver Process Integration 7.1
Scenario: File to IDoc
Summary: This blog is related with the requirement which I have handled recently in File to IDoc interface. As we know that in standard practice usually we disable the control record of IDoc structure in mapping and get the control record‘s fields value during runtime, in this case IDoc adapter reads values from configuration time.
But here I have to populate the Control Record values of SNDPRT, SNDPRN, RCVPRN, and RCVPRT in mapping itself. However as we move transports to different environments like DEV to QA and PRD the above values changes and I can’t do hard code in the mapping in respective environment.
To counter this requirement we have two options:
1. Use of Parameterized Mapping
2. UDF
This blog will explain these two approaches
As we know that Parameterized Message Mapping is a technique in SAP PI for the ability to pass parameters to/from mapping programs gives them more flexibility and applicability by allowing for the transfer of values at configuration time (e.g. Integration Directory).This is similar to the concept of using parameters for a program method or procedure. Currently, parameterized mappings are supported for:
- Message Mappings
- Java Mappings
- XSLT Mappings
Use of Parameterized Mapping
Following is the step by step implementation of parameterized mapping
Step 1. Define the Parameters in Message Mapping in Signature tab
Step 2. Assign the Parameters to respective fields in Message Mapping
Step 3. Define the Parameters to be used in binding in Operation Mapping
Step 4. Assign Operation mapping Parameters to the Parameters of the Message Mapping
Step 5. Assign Operation mapping Parameters to the Parameters of the Message Mapping.
Here we can give the values as per requirement
UDF Approach: –
In this approach we need to write a UDF which can get PI system details from respective environment.
Step 1. Write a UDF to get the PI system name
Step 2. UDF will return the PI system name on the basis of return value populate the SNDPOR value
For example if PI system is DP1 then SNDPOR value will be SAPDX1
Assign LS to SNDPRT
Step 3. Mapping of RCVPOR value and maintain the Fix values table as per requirement.
Here on the basis of PI system landscape respective value RCVPOR value will be populated.
Step 4. Assign LS to RCVPRT .
Step 5. Assign the RCVPRN value as per logic .
Maintain the Fix values table as per landscape.
Here on the basis of PI system landscape respective RCVPRN value will be populated.
In this UDF approach we don’t have to maintain values for Control record fields in DEV, Quality and PRD environment as like we have to maintain in interface determination in case of parameterized mapping approach. UDF approach is one time job ,we can maintain the different landscape values in fixed table and as per logic it can fetch control record field values as per the respective environment( for e.g. DEV, QA and PRD).