Export parameter in Message mapping UDF

Hi, I use PI7.1.
I defined an Export parameter in Message mapping "Signature" tab.
And as http://help.sap.com/saphelp_nwpi71/helpdata/en/43/c3e1fa6c31599ee10000000a1553f6/frameset.htm,
I wrote in my UDF as follows:
public String myudf(int var1) {
String str="test";
if(exists("MY_PARA") == true) {
getOutputParameters.setString("MY_PARA", str);
  return str;
However when I ran the test, it said there is "syntax error".
I guess the reason is not found the method exitst() or getOutputParameters. Anybody can help? thanks

Here is a valid sample for a Java Mapping program working with Parameterized Mappings - taken from help.sap.com::
import com.sap.aii.mapping.api.AbstractTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.TransformationInput;
import com.sap.aii.mapping.api.TransformationOutput;
import com.sap.aii.mapping.lookup.Channel;
public class Parametrization_Java
   extends AbstractTransformation {
      public void transform(
         TransformationInput in,
         TransformationOutput out)
      throws StreamTransformationException {
         try {
// Read Import Parameters
            String paramS =
               in.getInputParameters().getString(u201CPARAM_Su201D);
            int paramI =
               in.getInputParameters().getInt(u201CPARAM_Iu201D);
            Channel paramC =
               in.getInputParameters().getChannel(u201CPARAM_Cu201D);
// Use Parameters during Mapping
// Set Export Parameters
               out.getOutputParameters()
                  .setString(u201CPARAM_ESu201D, [String-Wert]);
               out.getOutputParameters()
                  .setInt(u201CPARAM_EIu201D, [Integer-Wert]);
               out.getOutputParameters()
                  .setValue(u201CPARAM_ECu201D, [java.lang.Object]);
         } catch (Exception e) {
            // Exception Handling
Regards,
Volker

Similar Messages

  • How to set EXPORT parameter from message mapping

    Again, ask the question of export parameter.
    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 know there is a blog : https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/8654. [original link is broken] [original link is broken] [original link is broken]
    But it did not talk how to set export parameters.

    Hi,
    i read thread
    How to export parameters from Message Mapping
    and blog
    /people/jin.shin/blog/2008/02/14/sap-pi-71-mapping-enhancements-series-parameterized-message-mappings
    but not found issue
    in this topic
    http://help.sap.com/saphelp_nwpi71/helpdata/en/43/c3e1fa6c31599ee10000000a1553f6/frameset.htm.
    if i writting this code in UDF, i getting an error.
    If use this code:
    GlobalContainer gc = container.getGlobalContainer();
    OutputParameters paras= gc.getOutputParameters();
    paras.setString("EXPORT_PARA ", str);
    the export parameter is defined locally (in transformation step area). In integration process area parameter is equal to NULL.
    How send export parameter to Integration Process? For exapmple, i wanna send parameter to other transformation step in my integration process.
    thx.

  • Use exported parameter from message mapping (via UDF) in next mapping prog

    Is there any chance to assign an exported parameter from one message mapping to another mapping program within an operation mapping?

    Hi,
    Try using  dynamic configuration
    1. Set value in message mapping and
    2. Get value in java mapping
    Refer this link http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
    Regards
    Suraj

  • How to export parameters from Message Mapping

    You can make use of this export parameter only in transformation step of Integration Process. You may use the following "Parameterized Mapping Programs"
    http://help.sap.com/saphelp_nwpi71/helpdata/en/27/db283fd0ca8443e10000000a114084/content.htm
    Regards,
    Prateek

    If you have defined the signature of your UDF then the return value of the UDF must be assigned to the Export paramter of message mapping.
    Basically import parametrs represents the inputs to be passed for that function(message mapping here)
    and export represents the output of that function.
    so in your case if you want toassign the value to Export parameter (ERROR_TEXT) in UDF catch block
    assign the error returned to the ERROR_TEXT field
    http://help.sap.com/saphelp_nwpi71/helpdata/en/43/c3e1fa6c31599ee10000000a1553f6/frameset.htm
    Check this link
    Hope this is clear
    Rajesh
    Edited by: Rajesh on Mar 13, 2009 5:31 PM

  • Message mapping/UDF help..

    Hi experts,
    Can someone let me know whether there is a chance to fulfill the below requirement:
    Input file:
    In the Input CSV file, there is a fixed length field with length 9 char and has leading zeroes (ex: 000000650)
    Output file:
    In the O/p XML file, the corresponding value should be displayed as "6.50" (Have to remove the leading zeroes, right justified and the last two digits should be allocated for decimals)
    Can anyone let me know if we can handle in Message mapping or should we write a UDF? If so can you please provide the code..
    Any help would be highly appreciated !!
    Thnx
    - Ravi

    Hi Ravi,
    UDF:
    Create a function zerosuppress and take the cache as value and take one argument input. Then put the code below:
    //Put this code
    String output = input.replaceFirst("^0+","");
    return output;
    With this function your leading zeros will remove.
    Then map like this:
    source field --> zerosuppress (udf) --> divide by 100 --> target field.
    This should solve your issue.
    Regards,
    ---Satish

  • Badi without export parameter for messages

    Hi Guru's
    I am using a HR related badi for one validation. As per my requirement, In BADI "HRECM00_CONSISTENCY" i need to perform validations.
    If some mismatch in the condition, then i will pass error message and warning messages.
    But in BADI there is no export parameter to give the error message to Portal.
    This messages should be displayed in HR MSS tab in compensation tool managed. I have one parameter in Import with  "TYPE REF"(message handler). I am not sure whether that field will help or not.
    Please clarify this.
    If it is not could you please suggest any alternate way to populate the message to portal.
    Thanks & Regards,
    Ganesh R K

    Hello Ganesh,
    try to call this FM to Added Messages.
    call function 'HR_ECM_ADD_MESSAGE'
          exporting
            message_handler = message_handler
            msgty           = 'E'
            msgid           = 'messageid'
            msgno           = 'Message No'
            msgv1           = 'Prabhu' .
    regards
    Prabhu

  • Message mapping : UDF parameter string type versus default UTF-8 encoding

    Hi,
    I'm facing an issue with character encoding when using an UDF to transform into base64 encoding.
    While thinking about the subject, I'm not 100% sure if it's possible to get it to work corerctly :
    Given :
    -The input XML is encoded UTF-8 ( with a special characeter )
    -The UDF is generated with java parameter type 'string' ( = set of 16bit unicode characters )
    Doubts :
    -What is supposed to happen when a node content ( of message encoded in UTF-8 ) is used as input for the UDF string type parameter  ? Is the node content decoded/encoded correctly by PI automatically ( at input/output versus the internal 16bit unicode character string ) ?
    ( I would assume yes )
    -Is the default charset of the underlying JVM relevant ? Or does pi always use explicit charsets when encoding/decoding ?
    ( I would assume it's not relevant )
    The UDF java code considers the string as a array of chars while processing them. It uses methods .length and .charat on the input string.
    The result is that I have a ISO-8859 encoded string ! ( after decoding it back from the base64 ) 
    What could cause this ?
    regards
    Dirk
    PS If I simply use default functions ( concat etc..) then the resulting xml stays correctly encoded...

    Hi,
    But that would mean that an UTF-8 encoded byte array would be passed unconverted to the UTF-16 unicode string parameter ?
    Shouldn't that trigger an exception ?
    I'm going to make some tests and see if it enlights my knowledge ( empirical )
    Keep you updated,
    thanks
    dirk

  • Message Mapping UDF for lookuping of a value inside field's list of values

    Hey everyone,
    For a FI mapping I'm working on, I was wondering if somebody has some Java UDF which lookups for a value inside the whole list of values which the mapping gathered for a specific field?
    Thanks,
    Ben

    source code --
    //write your code here
    JCO.Repository myRepository;
    // Change the logon information to your own system/user
    JCO.Client myConnection = JCO.createClient(
    // all the client information namely client ,user id pwd etc
    myConnection.connect();
    // create repository
    myRepository = new JCO.Repository( "SAPLookup", myConnection );
    // Create function
    JCO.Function function = null;
    IFunctionTemplate ft = mRepository.getFunctionTemplate("xxxxx"); //Name of RFC
    function = ft.getFunction();
    // Obtain parameter list for function
    JCO.ParameterList input = function.getImportParameterList();
    // Pass function parameters
    input.setValue( a , "xxxxx" ); //import parameter of RFC, a is input argument.
    myConnection.execute( function );
    String ret = function.getExportParameterList().getString( "XXXX" ); //export param
    myConnection.disconnect();
    return ret;
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439
    File Lookup in UDF
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/file%2blookup%2bin%2budf
    Lookupu2019s in XI made simpler
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    SAP XI Lookup API: the Killer
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    Webservice Calls From a User Defined Function.
    /people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function

  • Message Mapping UDF

    Hi Guys,
    For the UDF functions for messagemapping,Its a pain to code it using the dataflow editor provided in the repository.
    We are having the XI version 3.0(SP 20).
    So I decided to use eclipse for coding and debugging the functions and then copy it to the UDF editor for usage.
    Have downloaded the Eclipse-SDK 3.0.02 Version and is going to use the the JDK version(1.4.12)
    Is that Okay?(I mean is it compatible with the XI version).
    I have the aii_map_api.jar already with me.
    What is the above ".jar" for and what do they contain?
    Have read somewhere that I need the aii_mt_rt.jar and aii_utilxi_misc.jar as well.
    What are they for and what do they contain?
    If I need the above said jars,Is there any java plug-in available.
    Thanks
    P

    Hi P,
    For writing UDF's you dont need all these jar file!!!! they are required either for java mapping or module creation..
    BTW you can use any java ide to write this simple piece of java codes (even notepad will do )
    Regards
    Suraj

  • Input-Parameter to message mapping missing

    Hi,
    I have an interface on 7.1 where i use a RFC lookup, and sets the channel using the parameter functionality. After upgrading to EHP 1, the parameter has gone missing on the production system. It is on Dev, but when I try to transport it again, it still does not appear. I get this error in SXMB_MONI: UndefinedParameterException: The input-parameter RFCChannel does not exist
    Any ideas?
    Kind regards
    Mikkel

    Check this SAP note 1307777.

  • Export Parameters in Parameterized Message Mapping does not work.

    Hello, XI-Gurus!
    I have a question: how to use an EXPORT parameter in Parameterized Message Mapping? seems it does not work...
    (I use XI / PI 7.1)
    For example, I have a follow scenario: a large message comes to XI from one BS (message contains a lot of rows), then this large message splits to some small messages (something about 1000 rows in one small message), and send small messaeg one by one from XI to second BS. So, after receive step I use a transformation step with Parameterized Message Mapping to get a total amount of rows in large message (it needs for making condition for loop in IP, for example). I want to use an EXPORT parameter to pass this number from Parameterized Message Mapping to Integration Process. How can I do it?
    Of course, I know the way to how to make this scenario without any parameterizing, but I want to use exactly "Parameterized Message Mapping" like it writes in this help:
    http://help.sap.com/saphelp_nwpi71/helpdata/en/43/c3e1fa6c31599ee10000000a1553f6/frameset.htm
    This topic contains something about procedure how to use an EXPORT parameter, but this procedure does not work. I don't understand how to write this UserDefined Function, which I can set any export parameters.
    I read this blog:
    /people/jin.shin/blog/2008/02/14/sap-pi-71-mapping-enhancements-series-parameterized-message-mappings
    this blog has NO solutions about EXPORT parameters. about IMPORT parameters - everything OK.
    Some topics about how to use export parameters in MM in this forum marked as "answered", but this is not true.
    How to export parameters from Message Mapping
    Export parameter REALLY work in message mapping???????
    Export parameter in Message mapping UDF
    WBR,
    Vsevolod

    Hi Rudolf,
    It still does not works.
    Great thanks for all your answers! If your advice works on your PI-server, it means that my problem not in UDF.
    Step by step:
    1) I create in "Signature" tab two parameters: FILE_NAME, FILE_TYPE (of course, they both Export and xsd:string type)
    2) Then, I goes to "Functions" tab and create new function "testUDF" with one argument var1.
    3) In body of this UDF insert 2 strings:
       getOutputParameters.setString("FILE_NAME" , "Order");
       getOutputParameters.setString("FILE_TYPE" , "PDF");
    4) in "Definition" tab I bind function "Local.testUDF" with one field in my input message and goes to "Test" tab for testing.
    5) And then I have a message window "Problems While Testing":
    Source text of object Message Mapping: mm_ParamMap | urn:****.*.:****:TEST has syntax errors:
    Function testUDF, Line 1:
    cannot find symbol
    symbol  : variable getOutputParameters
    location: class com.sap.xi.tf._mm_ParamMap_
    getOutputParameters.setString("FILE_NAME" , "Order");
    ^
    Function testUDF, Line 2:
    cannot find symbol
    symbol  : variable getOutputParameters
    location: class com.sap.xi.tf._mm_ParamMap_
    getOutputParameters.setString("FILE_TYPE" , "PDF");
    ^
    Note: /usr/sap/PID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapb1562570ca9e11deb3fe00237d301cd6/source/com/sap/xi/tf/_mm_ParamMap_.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details. Note: /usr/sap/PID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapb1562570ca9e11deb3fe00237d301cd6/source/com/sap/xi/tf/_mm_ParamMap_.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    2 errors
    Look at this notes, first writes that I use a deprecated API, second - about unchecked or unsafe operations.
    And I have no idea what's wrong... Can you help me?
    Thanks!
    WBR,
    Vsevolod

  • Export parameter REALLY work in message mapping???????

    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.

    I hope you are referring to Parameterized mapping concept of SAP PI7.1
    To have this in Message Mapping you dont need any UDF/ JAVA code!
    Just follow this blog and you should be done: /people/jin.shin/blog/2008/02/14/sap-pi-71-mapping-enhancements-series-parameterized-message-mappings
    Regards,
    Abhishek

  • Message Mapping activation error-Source code has syntax errors in UDF

    Hi all,
    I wrote a small UDF for sum of 2 numbers:
    import
    udf.*
    public String getsum(String a, String b, Container container) throws StreamTransformationException{
    int c = Integer.parseInt(a);
    int d = Integer.parseInt(b);
    int e = packageDemo.getSum(c,d);
    return e+"";}
    In imported archives, i imported pack.jar
    In D:\udf , I have packageDemo.java, packageDemo.class, aii_map_api.jar, pack.jar(has the other 3)
    packageDemo.java :-
    package udf;
    public class packageDemo{   
        public static int getSum(int a,int b)
            int c= a+b;
            return c;
    Did i miss anything?? Icant activate message mapping for 2 errors:-
    1.package udf does not exist
    2.Function getsum, Line 3:
    cannot find symbol symbol : variable packageDemo location: class com.sap.xi.tf._xml_mm_int e = packageDemo.getSum(c,d); ^Note: /usr/sap/P7R/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapd4214d3099dc11dd9470001d090e4bbe/source/com/sap/xi/tf/_xml_mm_.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.Note: /usr/sap/P7R/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapd4214d3099dc11dd9470001d090e4bbe/source/com/sap/xi/tf/_xml_mm_.java uses unchecked or unsafe operations.Note: Recompile with -Xlint:unchecked for details.2 errors
    Edited by: NagaDurga Nannapaneni on Oct 16, 2008 1:07 PM

    Hi ,
    Think the error is coming because the content in imported archive is not being taken into message mapping at all...so package, class, method ..nothing is identified.
    Can anyone suggest the solution..
    Thanks,
    Durga

  • Message Mapping error in UDF

    I am receiving errors when trying to activate my MM.  I believe the issues are in one of two UDF's.  These UDF's do work in another MM without error.  Below are the error's and UDF's.
    ERRORS:
    Activation of the change list canceled Check result for Message Mapping MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE | http://wawa.com/xi/erp/pos:  Starting compilation  Source code has syntax error:  /usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map5420e070cabe11dcab4b00306ef38da9/source/com/sap/xi/tf/_MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE_.java:3291: cannot resolve symbol symbol : variable container location: class com.sap.xi.tf._MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE_ map = container.getTransformationParameters(); ^ /usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map5420e070cabe11dcab4b00306ef38da9/source/com/sap/xi/tf/_MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE_.java:3293: cannot return a value from method whose result type is void return constant; ^ 2 errors
    UDF's:
    public String getSender(Container container){
    String constant;
    java.util.Map map;
    // get constant map
    map = container.getTransformationParameters();
    constant = (String) map.get (StreamTransformationConstants.SENDER_SERVICE);
    return constant;
    IMPORTS:  com.sap.xi.mapping.parse.dom.;javax.xml.parsers.;java.io.;com.sap.aii.mapping.lookup.;org.w3c.dom.*;
    public String getSeqNum(String fileType,String objNum,String Sender,Container container){
    String request = "<ns0:ZRFC_NUMBER_GET_NEXT xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\"><NR_RANGE_NR>" + fileType + "</NR_RANGE_NR><OBJECT>" + objNum + "</OBJECT><QUANTITY/></ns0:ZRFC_NUMBER_GET_NEXT>";
    InputStream isRequest = new ByteArrayInputStream(request.getBytes());
    SystemAccessor accessor = null;
    String num  = null;
    try{
         // 1. Determine a channel.
         Channel channel = LookupService.getChannel(Sender, "R_RFC_ERP");
         // 2. Get a system accessor for the channel.
         accessor = LookupService.getSystemAccessor(channel);
         // 3. Create a payload according to the data type which the adapter expects.
         //    Use service.getBinaryPayload() for binary payload,
         //    and service.getTextPayload() for text payloads.
         Payload payload = LookupService.getXmlPayload(isRequest);
         // 4. Execute lookup.
         Payload response = accessor.call(payload);
         //Parse response
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         InputStream resStream = response.getContent();
         Document doc = builder.parse(resStream);
         Element sequence = doc.getDocumentElement();
         NodeList number = sequence.getElementsByTagName("NUMBER");
         //Extract Number
         num = DOMUtil.getSimpleElementText((Element) number.item(0));
    } catch (Exception e) {
         return e.getMessage();
    } finally {
         try {
              if (accessor != null) accessor.close();
         } catch (Exception e) {
              return e.getMessage();
    GlobalContainer gc = container.getGlobalContainer();
    gc.setParameter("Num", num);
    return num;
    Any help is appreciated.
    Regards,
    Darrell

    Fauver,
    Just to narrow down the problem first remove the first udf and only use the 2nd user defined function. Also in the 2nd udf you have to change this line:
    try{
    // 1. Determine a channel.
    Channel channel = LookupService.getChannel(Sender, "R_RFC_ERP");
    In the above line instead of Sender you use the business service or business system where R_RFC_ERP RFC communication channel is created in Integration Directory. So you are hardcoding it first.
    Once you have done this changes do save and test it once again. If this works then you can change back to original and your first udf needs to be checked.
    Regards,
    ---Satish

  • UDF in message mapping instead of Java Mapping. Pls advice urgent

    Hi All,
    My scenario
    CRM --- XI -- CRM
    In XI I have to open socket connection.
    Pls refer link:
    /people/saravanakumar.kuppusamy2/blog/2005/12/15/socket-integration-with-xi
    Can Java Mapping code given in above link for socket connection can be used in Message Mapping (CRM -- CRM)UDF?
    Pls advice urgent
    Regards

    Hi Henry,
    I understood your requirement.
    But as per the architecture of XI/PI some message has to trigger your scenario.
    In this case there is no adapter where you can directly communicate with CRM system.
    Do one thing configure a dummy scenario on the sender side.
    Use File adapter for simplicity. once it pools the file with some dummy data in the file it comes to Interface mapping(message mapping) of the PIPELINE steps. Now use the code as you mentioned above(within UDF) for opening socket to CRM system and implement you business logic within that program and write the response to target interface which will infact talk with CRM system.
    Dont forget to do the coding in an infinite loop with some delay (if required). Other wise every time you have to put a message for File Adapter for triggering purposes.
    You can also acheive the same if you use Java Mapping instead of Graphical mapping with UDF(code for Opening socket and business logic). I suggest you to use Java Mapping.
    I dont know how you will comunicate with CRM system on receiver side.?
    Thanks,
    Gujjeti

Maybe you are looking for