Skip to Content
author's profile photo Former Member
Former Member

UDF Creation

Dear Experts,

I am new to PI and want to build one logic using UDF in sap PI 7.1.

I have attached the payload, where input data is coming in multiple segments, so I need to capture the data For SUMME based condition on SUMID

If SUMID == "011'


SUMME == " " (In the given payload valuse is "2612.00").

Please provide the UDF code for this requirement.. (246 B)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Sep 02, 2013 at 11:00 AM


    Why u want a UDF for this? It can be easily handle using graphical mapping?

    Just for your reference, i have attached the UDF code, but don't use this as stated above use graphical mapping.

    int count = 0;for(int i=0;i<var1.length;i++){if(var1[i].equals("011")){result.addValue(var2[i]);count =  count+1;break;}}if(count==0)result.addSuppress();


    Amit Srivastava

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 02, 2013 at 11:25 AM

    Hi Sumit,

    As Amit said is better to use a standard function, it's easier to maintain and you avoid further problems in a PI upgrade.

    You can use the standard booelan functions IF or IFwithoutElse depending if you need to map SUMME tag in the case that SUMID != "011':


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 02, 2013 at 06:18 PM

    Hi Sumit,

    I assume you don't need the source value for SUMME in case if SUMID 011.

    Normally in case of FIDC02 IDocs, the values are calculated in ECC based on tax codes/country codes and not from source and this is the reason you are doing this.

    So just right click on the target segment E1EDS01. Do duplicate subtree. map the additional segment E1EDS01 created to a constant null. Map SUMID to constant 011 and SUMME to constant null.

    Isn't it what you need ?


    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Sumit,

      I have faced this issue of suppressing the values in the target structure based on conditions.

      I use the below java code to suppress the empty values. These empty values are produced upon using "if" standard function.

      public void removeEmptyValues(String[] inputQ, ResultList result, Container container) throws StreamTransformationException{

      // beginning of removeEmptyValues

      for(int i=0; i<inputQ.length; i++)


      if( inputQ[i].equals("") )






      // end of removeEmptyValues


      Hope it helps!

      Best Regards,

      Anand Patil

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.