Skip to Content

Introduction

In SAP NetWeaver Process Integration (PI) 7.1, there is support for using parameters in mapping programs.  In general, 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

 

General Properties

Bindings

Since at runtime time, all PI mappings are accessed via a corresponding operation mapping, parameter bindings must be created in order to connect the mapping program and operation mapping parameters. In addition, the actual parameter values can be set at configuration time within the interface determine of the Integration Directory or by using a transformation step in an integration process or monitoring process.

image

Import/Export Parameters

Import Parameters – transfer values to mapping

  • Standard functions only allow for import parameters
  • Values can be passed from both interface determinations and transformation steps

Export Parameters – transfer values from mapping

  • Values can only be assigned to export parameters in user-defined functions
  • Values can only be passed using a transformation step and thus, can only be evaluated within integration processes or monitoring processes

Parameter Category

  • Simple Type – parameters in this category are used to transfer simple typed constants (i.e. xsd:string or xsd:integer) that can be used as import or export parameters.
  • Adapter – parameters in this category are used to transfer the channel name that is to be used for mapping lookups. An adapter type (e.g. JDBC, RFC) must in addition be selected.

 

Using Parameters in Message Mappings

In order to use parameters in message mappings, parameters first have to be defined within the signature tab of the message mapping.

image

Parameters of message mappings can be passed between both standard functions and user-defined functions. Above there are three parameters defined, two of type import and one of type export. Using the parameter ‘dateDelimiter’ as an example, we can, for example, pass this parameter to the standard function concat as shown below.

image

This is done by opening the properties of the concat function and then selecting ‘dateDelimiter’ as the parameter to be used for the function. The parameter will only be listed if it has already been defined as a parameter in the Signature tab.

image

image

 

Operation Mapping Parameters and Bindings

The message mapping parameters must be binded to operation mapping parameters as shown below.

image

 

Setting Parameter Values in Interface Determination

In the Integration Directory, the values can be set at configuration time in the interface etermination object. Once the operation mapping is specified, parameters defined for the operation mapping will be shown at the bottom of the interface determination screen as shown below.

image

 

Setting Parameter Values in Transformation Step of an Integration Process

Values can also be transferred from/to an integration process via a transformation step.

image

To report this post you need to login first.

33 Comments

You must be Logged on to comment or reply to a post.

    1. Jin Shin Post author
      Maybe I made it more complex than it is…  hopefully not.  Once you try it, you’ll see that it’s pretty simple.  Appreciate your thoughts.

      Jin

      (0) 
        1. Jin Shin Post author
          Hi –

          For example, if in a concat function, you use a constant ‘-‘ as the delimiter, this is like “hard coding”.  But one receiver might want to use ‘-‘ but another might want to use ‘/’.  You can use a parameter for this w/o providing additional logic and using the same mapping.

          Regards,
          Jin

          (0) 
      1. Kevin Hannah
        Jin,

        I am trying to apply an input param in an XSLT map using Java enhancement.
        To run the getInputParameters() for the TransformationInput does the transform() method need to be called?
        If so, how to then pass out this InputParameters value from a any “get..”. method called from the XSLT enhancement?

        Any working example of XSLT code with the corresponding Java enhancement class would be very useful.

        — Kevin.

        (0) 
  1. Doug Munford

    Is there any trick to this for XSLT Mappings as opposed to Graphical Maps?<br/><br/>(I can see get the Header Parameters in XSLT OK like SenderParty, SenderSystem but my own Import Parameters all arrive blank from the Test harness)<br/><br/>Operation Mapping contains a Parameter called MyTestParam of SimpleType xsd:string import <br/><br/>I am using a very simple test case inside XSLT mapping just to inlcude the value in a comment<br/><br/><xsl:variable name=”MyTestParam”/><br/><xsl:variable name=”SenderSystem”/><br/><br/>And in the output template<br/><xsl:comment><br/> MyTestParam:<xsl:value-of select=”$MyTestParam”/><br/></xsl:comment><br/><xsl:comment><br/>  SenderSys:<xsl:value-of select=”$SenderSystem”/><br/></xsl:comment><br/><br/>Using the Test tool SenderSystem Header Parameter works but MyTestParam is never filled even though Test Tool prompts for value for it with a ? and I fill it with “MyValue”<br/><br/><!MyTestParam:><br/><!SenderSys:Test_SenderSystem><br/><br/><br/>

    (0) 
    1. Jin Shin Post author
      Hi –

      Sorry for the late reply…  online help has pretty good info on this (http://help.sap.com/saphelp_nwpi71/helpdata/en/43/cf76cb869f05f6e10000000a11466f/frameset.htm).

      I’d mainly pay attention to step 2. under “Activities” in that help link.  Basically you need to “lean” on a parameterized Java mapping.  Once that’s complete, you can use the XSLT with Java enhancement feature to incorporate parameters into your XSLT mapping.

      (0) 
      1. shi wudao
        I wrote a java version transformation and it worked good with export parameter.
        However I can not work it out in graphical message mapping. I refered http://help.sap.com/saphelp_nwpi71/helpdata/en/43/c3e1fa6c31599ee10000000a1553f6/frameset.htm.

        In PI7.1, I add an export parameter “EXPORT_PARA” in the “Signature” tab. Are there any special step to assign this parameter to an UDF? I did not find a way to do it.

        And then I define an UDF,

        public String SetExportPara(String sss, Container container) throws StreamTransformationException{

        String str = “GOOD”;

        GlobalContainer gc = container.getGlobalContainer();
        OutputParameters paras= gc.getOutputParameters();

        if(paras.exists(“EXPORT_PARA “) == true) {
        paras.setString(“EXPORT_PARA “, str);
        }else {
        str = “NOT FOUND EXPORT_PARA”;
        }
        return str;
        }

        And I assign this UDF to one element of my output XML, I tried to run it in IE, it always output “NOT FOUND EXPORT_PARA.
        why?????

        I searched the forum, no answer found.

        (0) 
  2. Doug Munford

    I have attached some sample code for java first to get parameters. I can only get it to work and access the input parameters & output parameters using the new PI7.1 class AbstractTransformation and not the backwards compatible deprecated implementation StreamTransformation. <br/><br/>The XSLT mapping cannot get to the paarmeters because I can’t a handle on where the parameters are… <br/><br/>the only thing I have thought of is to copy the parameters to the DynamicConfiguration section using a Java transformation step first… which is a bit ugly. <br/><br/>Source follows:<br/><br/>(Have really simple MT & DT & SI for basic XML message and transformation copies the input to output) – no config just using Operation Mapopin test tool at his point<br/><br/>bindings are the same for all code samples:<br/>  testparam as an input (and set to the value X)<br/>  testoutparam as an output (in the java only)<br/><br/>New (Working) Java code: (39 lines)<br/><br/>  package test.pi;<br/>  <br/>  import java.io.;<br/>  import java.util.;<br/>  import com.sap.aii.mapping.api.*;<br/> <br/>  public class JavaMapping extends AbstractTransformation  {<br/><br/>  public void transform(TransformationInput in, TransformationOutput out) <br/>      throws StreamTransformationException {<br/><br/>      getTrace().addInfo(“ReceiverService as header:” + in.getInputHeader().get(“ReceiverService”));<br/>      getTrace().addInfo(“testparam as header:” + in.getInputHeader().get(“testparam”)); //Doesn’t work<br/>      getTrace().addInfo(“testparam as string param:” + in.getInputParameters().getString(“testparam”)); // does work<br/><br/>      // copy payload<br/>      copyPayload(in, out);<br/><br/>      // try output parameter<br/>      out.getOutputParameters().setString(“testoutparam”,”testme”); <br/>  }<br/><br/>  private void copyPayload(TransformationInput in, TransformationOutput out) <br/>      throws StreamTransformationException { <br/>         <br/>         InputStream inS = in.getInputPayload().getInputStream();<br/>      OutputStream outS = out.getOutputPayload().getOutputStream();<br/>         int c;<br/>         try {<br/>             c = inS.read();<br/>             while (c != -1) {<br/>                 outS.write(c);<br/>                 c = inS.read();<br/>             }<br/>         } catch (IOException e) {<br/>             throw new StreamTransformationException(e.getMessage());<br/>         }<br/>     }<br/>  }<br/><br/><br/><br/>Output from test window:<br/><br/>12:20:43 Start of test<br/><br/>     Loaded class test.pi.JavaMapping<br/> <br/>     Call method execute of the application Java <br/>     mapping test.pi.JavaMapping<br/> <br/>     *** START APPLICATION TRACE ***<br/> <br/>     ReceiverService as header:Test_ReceiverService<br/> <br/>     testparam as header:null<br/> <br/>     testparam as string param:X<br/> <br/>     Dynamic config parameters follow:0<br/> <br/>     *** END APPLICATION TRACE **<br/> <br/>     Java mapping test/pi/JavaMapping completed. <br/>     (executeStep() of test.pi.JavaMapping).<br/><br/>    Execution of mapping on server took 57 milli-seconds<br/>    Executed successfully<br/>12:20:44 End of test<br/><br/><br/><br/><br/><br/><br/>Old (deprecated) Java code (47 lines) – doesn’t get or set user defined parameters – fine with Std parameters<br/><br/><br/>  package test.pi;<br/>  <br/>  import java.io.;<br/>  import java.util.;<br/>  import com.sap.aii.mapping.api.;<br/> <br/>  public class OldJavaMapping implements StreamTransformation {<br/><br/>  private Map param;<br/><br/>  private AbstractTrace trace = null;<br/><br/>  public void setParameter(Map param) {<br/>      this.param = param;<br/>  }<br/><br/>  public void execute(InputStream in, OutputStream out) <br/>      throws StreamTransformationException {<br/><br/>      trace = (AbstractTrace) param.get(StreamTransformationConstants.MAPPING_TRACE);<br/><br/>      trace.addInfo(“ReceiverService as string param:” + param.get(“ReceiverService”));<br/>      trace.addInfo(“testparam as string param:” + param.get(“testparam”));<br/><br/>      // copy payload<br/>      copyPayload(in, out);<br/><br/>      // try output parameter<br/>      param.put(“testoutparam”,”testme”); <br/><br/>  }<br/><br/>  private void copyPayload(InputStream in, OutputStream out) <br/>      throws StreamTransformationException { <br/>         <br/>         int c;<br/>         try {<br/>             c = in.read();<br/>             while (c != -1) {<br/>                 out.write(c);<br/>                 c = in.read();<br/>             }<br/>         } catch (IOException e) {<br/>             throw new StreamTransformationException(e.getMessage());<br/>         }<br/>     }<br/>  }<br/><br/><br/>Results:<br/><br/>12:23:04 Start of test<br/> <br/>     Loaded class test.pi.OldJavaMapping<br/> <br/>     Call method execute of the application Java <br/>     mapping test.pi.OldJavaMapping<br/> <br/>     *** START APPLICATION TRACE ***<br/> <br/>     ReceiverService as string param:Test_ReceiverService<br/> <br/>     testparam as string param:null<br/> <br/>     *** END APPLICATION TRACE **<br/> <br/>     Java mapping test/pi/OldJavaMapping completed. <br/>     (executeStep() of test.pi.OldJavaMapping).<br/><br/>    Execution of mapping on server took 36 milli-seconds <br/>   E xecuted successfully<br/>12:23:04 End of test<br/><br/><br/><br/><br/>Unfortunately the $inputparam for XSLt does not contain the passed parameter. I am testing this all with the Operation Mapping test tab (using the trace output). (It is very much like the old java)<br/><br/><br/>Simple Style sheet (that returns the original document and chucks in some comments – and trace log courtesy of the Java extension)<br/><br/><?xml version=”1.0″ encoding=”UTF-8″?><br/><xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” xmlns:ns=”urn:test” xmlns:java=”http://xml.apache.org/xslt/java“><br/>  <xsl:output method=”xml” indent=”no”/><br/>  <xsl:strip-space elements=”“/><br/>  <xsl:variable name=”ReceiverSystem”/><br/>  <xsl:variable name=”testparam”/><br/>  <xsl:variable name=”inputparam”/><br/>  <xsl:template match=”“><br/>    <xsl:copy-of select=”.”/><br/>  </xsl:template><br/>  <xsl:template match=”/“><br/>    <xsl:element name=”{name()} namesapce=”{namespace-uri()}”><br/>      <xsl:comment>testparam:<xsl:value-of select=”string($testparam)”/></xsl:comment><br/>      <xsl:comment>ReceiverSystem:<xsl:value-of select=”$ReceiverSystem”/></xsl:comment><br/>      <xsl:comment>Javacall test:<xsl:value-of select=”java:test.pi.XsltJavaExtension.testcall(‘test’,$inputparam)”/></xsl:comment><br/>      <xsl:copy-of select=”.”/><br/>    </xsl:element><br/>  </xsl:template><br/></xsl:stylesheet><br/><br/><br/><br/>Java extension (compiled as class): (55 lines)<br/>Note this also skims through Attachments & Dynamic Config and you could ignore that bit<br/><br/><br/>  package test.pi;<br/><br/>  import java.util.;<br/>  import com.sap.aii.mapping.api.;<br/><br/>  public class XsltJavaExtension {<br/><br/>     private static AbstractTrace trace = null;<br/><br/>     public static String testcall(String myStr, <br/>                                  Map inputparam)<br/>     {<br/>        // Setup to write trace information and write one message<br/>        trace = (AbstractTrace)inputparam.get(<br/>                   StreamTransformationConstants.MAPPING_TRACE );<br/>        trace.addDebugMessage(“testcall():\nmyStr = ” + myStr);<br/>        <br/>     // check if testparam available as normal input parameter<br/>     trace.addDebugMessage(“testparam:” + (String)inputparam.get(“testparam”));<br/><br/>     // Loop through all input parameters and echo names to trace<br/>     trace.addDebugMessage(“List of inputparam:”);<br/>          Set set = inputparam.entrySet (  ) ; <br/>          Iterator iterator = set.iterator (  ) ; <br/>          while (iterator.hasNext()){  <br/>               Map.Entry entry = (Map.Entry)iterator.next(); <br/>               trace.addDebugMessage(entry.getKey().toString());<br/>     }  <br/><br/>     // Loop through all DynamicConfiguration just in case it was in there<br/>        DynamicConfiguration conf = (DynamicConfiguration) <br/>                inputparam.get(“DynamicConfiguration”);<br/>        trace.addDebugMessage(“Dynamic config parameters follow:” + conf.size());<br/>        Iterator it = conf.getKeys();<br/>        while (it.hasNext()){  <br/>           DynamicConfigurationKey key = (DynamicConfigurationKey)it.next(); <br/>           trace.addDebugMessage(“dynamic parameter:” + key.getName());<br/>        }<br/><br/>     // Check input attachments<br/>     InputAttachments ia = (InputAttachments) inputparam.get(“InputAttachments”);<br/>        if (ia == null) {<br/>           trace.addDebugMessage(“InputAttachments empty”);<br/>        } else {<br/>           if (ia.areAttachmentsAvailable() != true) {<br/>             trace.addDebugMessage(“No input Attachments available”);<br/>           } else {<br/>              trace.addDebugMessage(“Input Attachments available:”);<br/>           }<br/>        }<br/><br/>        // return string passed in as input<br/>        return myStr;<br/>     }<br/>  }<br/><br/><br/><br/>Regds Doug.<br/>

    (0) 
  3. Anoop Garg
    Hi Jin,

    I have used this feature with normal message mapping & it worked absolutely fine.

    However, when I tried this parameterized feature in multimapping, it shows error at run time.
    Here,I am using a parameter for RFC Look Up during multimapping.At run time, it shows “parameter(XYZ) used for RFC Look Up doesn’t exist”.

    To add,if I just tested my message mapping(Multimapping) & operation mapping alone(not at runtime),it worked fine there too.

    Please provide info if this feature also supported in multimapping or not for PI 7.1.

    Regards,
    Anoop

    (0) 
    1. Jin Shin Post author
      Hi Anoop –

      You need Note 1307777 (XI mapping: No parameterization for split mapping).

      Regards,
      Jin

      (0) 
      1. Anoop Garg
        Thanks a lot Jin for Information.

        I have searched almost all SAP Notes for PI 7.1 before posting here but seems this one was missed out by me 🙂

        Regards,
        Anoop

        (0) 
  4. Liang Ji
    Hi, Jin:

    This is nice blog, but I have some doubts: saying  there are two mapping programs In an OM,, does the export parameter from first mapping program automatically become import parameter of second one ?

    Regards.
    Liang

    (0) 
    1. Jin Shin Post author
      Hi Liang –
      Parameters don’t get passed between mapping programs (e.g. when 2 mappings are chained in an OM).  Also remember export parameters can only be accessed in an integration or monitoring process.

      Regards,
      Jin

      (0) 
  5. Gabriel Sagaya Selvam Panneer Selvam
    Hi,
    When I worked with DateTimeStamp mapping with various delimiters like :,-,+ in Interface Determination Its working fine. But when I filled the delimiter as / I am getting the error message as
    Thrown: java.lang.IllegalArgumentException: The value for the input paramter DATEDELIMITER must not be null! at com.sap.aii.ib.core.mapping. execution.InputParameter.(InputParameter.java:23) ~.
    In order to work with the Delimiter /, What should we fill in the Interface Determination parameter value.
    (0) 
    1. Jin Shin Post author
      There shouldn’t be a specific limitation for using ‘/’ for a delimiter as far as I know.  The only Note that’s somewhat related to this is 1346533, but is not your exact symptom. If the problem persists, please open a customer message with SAP support in case it’s a bug.

      Regards,
      Jin

      (0) 
    2. Rakesh D

      Hi Gabriel,

      I have the exact same issue as we have multiple special characters in over parameters.

      Can you please tell us how you found a work around?

      Thank you,

      Rakesh.

      (0) 
    1. Jin Shin Post author
      Thanks for your comments.  In a business process?  Not necessarily, but more the purpose of extracting particular values from payload content within ccBPM (integration process).
      (0) 
  6. Santhosh Kumar Vellingiri
    Jin, can the export parameter used as below…?
    assign value to it in transformation step of BPM -> send message sync from BPM -> in the interface determination read this export parameter in operation mapping(in both MM & XSLT) ….??

    ~SaNv…

    (0) 
    1. Jin Shin Post author
      No, afraid not.  Export parameters can only be used within the integration process.  In interface determination, only import parameters can be used.
      (0) 
  7. padmini udayakumar
    Hi,
       We tried using JDBC Lookup to retrieve data from a DB. But in the message mapping while saving, it throws an error Binding rec0: check update method.
    Can you please suggest on this, how to resolve the issue.

    Thanks
    Padmini

    (0) 
  8. Goradindla Sreerama Reddy
    Hi Jin,

    we know that we give the RFC parameter in Receiver Determination but when we do transport it to QA these parameters are not getting changed automatically to requried business system. how to over come this.

    Regards
    Sreeram.g.reddy

    (0) 
  9. Sergei Panov
    Hello, Jin!

    I am using the Adapter type parameter (RFC channel) for a parameterized Message Mapping.

    Standalone this mapping works fine, but when I am trying to use it in ccBPM – I cannot find the way to specify this parameter for the mapping.

    Is there a restriction for using Adapter type parameters in Integration Processes or you can suggest a workaround?

    Thank you very much,
    Sergei.

    (0) 
    1. Jin Shin Post author
      In the integration process, you need to define a “configurable parameter” of adapter type RFC (toggle bottom view).  Later, in the Integration Directory, when you define your integration process there, there should be a place where you can set the parameter for the channel in the Integration Process component – can’t remember exactly, but you should see it.

      Regards,
      Jin

      (0) 
  10. Rakesh D

    Hello Jin,

    Is there a character limit for the parameters? And any exception for special characters? If yes, any escape sequence characters that need to be employed?

    Regards,

    Rakesh.

    (0) 

Leave a Reply