Parameterized mapping is a great way to leverage your mapping program to have multiple applications. SAP introduced this technique first in SAP PI version 7.1. Parameterized mapping allows you to transfer values to mapping program or values from the mapping program. Similar to how we use import and export parameters in a function, parameters can be added to SAP PI/PO mapping programs using parameterized mapping technique.
Parameterized mappings are supported in Graphical Message Mappings, Java Mappings and XSLT Mappings.
SAP Versions used in the illustration:
- SAP PO 7.5
Types of Parameters in Parameterized Mapping:
- Import: Values can be passed to mapping program using import parameters before the mapping program is executed. Values for import parameters can be assigned from transformation steps or interface determination.
- Export: Export parameters allow us to transfer values from the mapping program after it has been executed by the integration pipeline process or by monitoring. You can only assign values to Export parameters using User Defined Functions (UDF).
Categories of Parameters in Parameterized Mapping:
- Simple Type: Simple types can be used as either import or export parameters. Data types of parameters of Simple Type are xsd:string and xsd:integer.
- Adapter: Parameter category “Adapter” can be only used as an Import parameter. Adapter parameters are mainly used when you are implementing a mapping lookup. For example, in a JDBC look up scenario you can set the JDBC communication channel name which is used for JDBC look up function in the interface determination.
Step by Step Guide on Parameterized Mapping Configuration:
Example Scenario:
Lets create a simple file to file scenario with two parameters. We will use the import parameter “Parameter_1” to assign a value to output data structure field “Att1“. Value for import parameter “Parameter_1” will be maintained in the Integration Configuration Object (ICO) at design time of Integration Directory.
Step 1 – Create Parameters in Mapping Program.
Go to Signature tab of the mapping program and create parameters.
Here I have created two parameters but we will only be using import parameter “Parameter_1“.
Step 2 – Map the Import Parameter to Required Output Field.
Graphical mapping element constant can be used to assign import parameter to required output element. Select properties of constant mapping element to select the parameter name from the drop down menu.
Step 3 – Create Parameters in Operation Mapping.
Since massage mapping is executed by PI/PO runtime through a corresponding Operation Mapping, we need to create parameters in Operation Mapping and bind them or map them to message mapping parameters.
Create Operation Mapping Parameters:
Again, we will be creating two parameters, but we’ll only use “Import_p1” import parameter for this example.
Step 4 – Bind Operation Mapping Parameters with Message Mapping Parameters.
Select binding and map Operation Mapping parameters with Message Mapping Parameters.
Map Message Mapping parameters with Operation Mapping parameters.
Step 5 – Set Value to Import Parameter at Design Time.
Go to Integration Directory and assign a value to import parameter in Integration Configuration Object (ICO) or Receiver Determination (in dual stack).
In newer Single stack version of PI or PO, parameters can be accessed under the Receiver Interfaces tab of Integration Configuration Object (ICO).
Let’s assign constant value “10” to import parameter “Import_p1” which is mapped to Message Mapping parameter “Parameter_1”.
Test Result:
Test message.
Value “10” maintained in the ICO for Import parameter ‘Import_p1‘ is assigned to attribute “Att1”.
If you have any questions about Parameterized Message technique or need clarifications on any of the steps, please leave a comment below.
Can we pass the parameter value dynamically at runtime
Please elaborate the scenario.
Hi I’m Swathi and I’m new to PI. Can anyone please explain the business cases to go for parameterized mapping
Hi Swathi,
I used it in a previous project to split the target message based on incoming message segment count. Requirement was create multiple iDocs based on number of segments in the incoming message. For example one iDoc for every 100 line items of the incoming message. I wanted number of line items to be configurable. Therefore, if in future client wanted to change the number of line items to 200 or any other value they can do it easily without changing the mapping program. Also it can be used for RFC/JDBC lookup implementations.
Hi ,
AM using file to idoc . In every idoc i have to pass only 999 lines . If i get more than 999 line times i have to create new idoc. Please for this requirement how i can achieve this using parameterized mapping. I achieved this with direct mapping logics but just to know how its working with parameterized mapping.
Thanks in Advance !!!
Hi Rahul,
In this instance you must have hard coded the number of line items as ‘999’ in the mapping program. Using a parametarized mapping, you can make the number of line items configurable. You can maintain number of line items as a single value in ICO and use it in the mapping program. If in future you need to change the number of line items you need to collect, you can easily change in using a configuration without changing the mapping program.
Cheers!
Isuru
Hi Isuru,
What is the difference between Replacewith and Parameterized Mapping i mean the above said requirement of yours (1 to 10 Level_1 Att1 = 10) can we achieved with replace with, then why do you want us to go with complex Parameterzied Mapping? please advise.
Hello Viny,
Parameterized mapping can be used to import values from configuration time. You can maintain the values in ID/iFLow and import them to the mapping program. Replacewith can only transform values in the source message in the mapping program.
Cheers!
Hi Isuru,
What is the difference between Replacewith and Parameterized Mapping i mean the above said requirement of yours (1 to 10 Level_1 Att1 = 10) can be achieved with replace with, then why do you want us to go with complex Parameterzied Mapping? please advise.
Could You please provide me a blog on multi mapping in PI single stack?
hi Sandeep,
I will try my best to include a example on multi mapping. Subscribe to my alerts so that you will be notified when I do 🙂
Cheers!
Hi
I am new to PI. I am just wondering if there is any way that we can use the export parameter on the receiver channel end. I mean for example NFS Adapter, can access export parameter so that i can use it in OS Command section
Hi Krishna,
Probably a adapter module would be the best way to approach this.
Cheers!
Hi,
I’m newer of the SAP PI, can you please explain steps to create RFC lookup.
I am eagerly waiting .
Hi Logu,
I will try to write a post on it in the future.
Cheers!
Isuru
HI ISURU,
I am new for pi. Can you please provide an in-detail steps to configure B2B concept.
Thanks in Advance.
Raghav
Hi Raghav,
Go to any of my posts and subscribe to my newsletter and updates. I will let you know when I write articles on B2B.
Cheers!
Hi Isuru,
what are the functions available in altova map force for xslt mapping which is not available in graphical mapping.
Hi Isuru,
I have a Question like this :
https://answers.sap.com/questions/12919600/layout-mapping-mapping-data-by-plant.html
Are u have an idea?
Hello Yoppy,
Do you want to send messages to different target systems based on certain values from the input message? Or do you want to do it based on a parameter? Please provide more detail on your scenario.
Cheers!
Isuru
Actually I want to send messages to different target systems based on certain values.
My senior teach me to use parameters, but not working. My senior has resigned.
Actually I want to send messages to different target systems based on certain values, but my senior teach for using the parameters. But not working for now and my senior has resigned. I am new in PI.
Actually I want to send messages to different target systems based on certain values, but my senior teach for using the parameters. But not working for now and my senior has resigned. I am new in PI.
Actually I want to send messages to different target systems based on certain values, but my senior teach for using the parameters. But not working for now and my senior has resigned. I am new in PI..
Hi, Could you please provide me an example of export parameters in Parameterized mapping.How to use it and business scenario.
The header part of the page is covering atleast 25% of the view which is making the content difficult to read.