Advanced UDF

Hi all,
this is a file to idoc scenario.there are 2 parameters that may required to be passed to below udf.
taxamt,dtl
taxamt is a fieldname,dtl is rootnode which has about 15 fields.
int   i = 0;
  for ( int j = 0; j < b.length ; j ++)
  if (b[j].equals(ResultList.CC))
   {     result.addContextChange(); i = i + 2; }
  else{
    if (a<i>.equals("000000000"))
       result.addValue("U0");
//   else if (a<i>.equals(ResultList.CC)){}
   else
     result.addValue("U1");
taxamt----
dtl----
                             UDF                      tax_code
r1
r2
r15
the problem i am facing is that there are about 11 line items in my fileeg U1,U2......U11.
all these elements must be sent to the receiver Idoc.I could able to receive only 1 line item.
Please correct my code so that I can receive all the line items..
Thanks,
Srinivasa

Hi,
did you check the occurrance of the line item in target idoc structure? if it is 1:1 then change it to 1: unbound...
it shd work...
Karna,,,

Similar Messages

  • Container in advanced UDF

    Hi,
    could you please tell me the use of Container in advanced UDF ?? Preferrably with examples
    thanks
    kumar

    Kumar,
    Refer below links it will be more helpful.
    http://help.sap.com/saphelp_nw70/helpdata/en/78/b4ea10263c404599ec6edabf59aa6c/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/b3/9a2aeb24dc4ab6b1855c99157529e4/content.htm
    Best Regards,
    raj.

  • Advanced UDF  using context

    Hi
    I have wrote a below Advanced UDF (using context). But I want to return string array "temp" through "result". My below code throug error as last "result" statement is wrong. If anybody knows how to define this statement could you plz help me out ?? Any help in this regard is highly appreciated.
    String[ ] temp = new String[1000000000];
    for (int i = 0; i < a.length; i++) {
    if ((Integer.parseInt(a<i>) == 11) || (Integer.parseInt(a<i>) == 12) || (Integer.parseInt(b<i>) == 4)) {
    temp<i> = "1";
    temp<i> = "0";
    // String temp1 = Arrays.toString(temp).
    result = (temp [ ]);
    Thanks in advance
    kumar

    If you need to output the value of 'temp',then you can try this code : -
    String temp = null;
    for (int i = 0; i < a.length; i++) {
    if ((Integer.parseInt(a) == 11) || (Integer.parseInt(a) == 12) || (Integer.parseInt(b) == 4))
    temp = "1";
    result.addValue(temp);
    else
    temp = "0";
    result.addValue(temp);
    Regards
    Priyanka

  • Difference between Simple and Advance UDF

    Hi,
    Could you please help me what is the Defference between Simple and Advanced User Defined Functions.
    Thanks and Regards,
    Nag.

    Hi Nag,
    Here is the Information for your request as follows.
    <u>1. Simple UserDefined Function:</u>
    Simple functions, which can process individual field input values for each function call. Simple functions, therefore, expect strings as input values and return a string.
    <u>2. Advanced User Defined Function:</u>
    Advanced functions, which can process non–single string field input values for each function call. You can pass either all field values of a context or the whole queue for the field in an array when calling the function.  Each input field is passed as an array of String.  Returned values are stored in a String array, ResultList.
    Cheers,
    AshokKumar.

  • Advance UDF --- Remove Context

    Hi all
    I want to use RemoveContext function in UDF ...as this will be based on few conditiond.
    Hence i can not use the standard removeContext node function..
    can any one tell me the code for doing the same..
    Sheetal

    you can have a remove context functionality outside the UDF itself.
    Right click the source field and change the context from the parent node to the top(root) node to remove all contexts.
    Note: you can indeed ADD context etc in a UDF - http://help.sap.com/saphelp_nw04/helpdata/en/b1/83a09f668320419dbe00a741e0fe6a/content.htm

  • UDF's and XSLT Mapping

    Hi,
         I am very much confused when to use UDF's and when to use XSLT etc. Please make me to understand with good examples.

    HI,
    UDF's are user defined functions are of two types,simple UDF which takes in one input and gives out one output and the second one is advanced UDF where in u can access more than one fields,and the result is passed on to ResultList.
    UDF can be used in graphical mapping depends upon the requirement.
    1) If u wanted to do manuplication in data which can not be done by using the standared XI function that time we go for UDF.
    2) For doing Lookup we write the code in UDF and pass the value to R3 system.
    3) If u need to compare the input value and pass the other value based on comparision that time can go for UDF.
    There are many different requirement for which we can go ahead with UDF.
    What is XSLT:
    XSLT stands for EXtensible Stylesheet Language Transformations. It is an XML based language for transforming XML documents into any other formats suitable for browser to display, on the basis of set of well-defined rules.
    It can be used to transform
    •     XML to XML - From one XML data format to another
    •     XML to Text
    •     XML to HTML/XHTML
    •     XML to PDF
    A few example cases in which an XSLT mapping can be used:-
    &#61692;     When the required output is other than XML like Text, Html or XHTML (html displayed as XML )
    &#61692;     When default namespace coming from graphical mapping is not required or is to be changed as per requirements.
    &#61692;     When data is to be filtered based on certain fields (considering File as source)
    &#61692;     When data is to be sorted based on certain field (considering File as source)
    &#61692;     When data is to be grouped based on certain field (considering File as source).
    Advantages of using XSLT mapping
    &#61692;     XSLT program itself defines its own target structure.
    &#61692;     XSLT programs can be imported into SAP XI. Message mapping step can be avoided. One can directly go for interface mapping once message interfaces are created and mapping is imported.
    &#61692;     XSLT provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.
    &#61692;     File content conversion at receiver side can be avoided in case of text or html output.
    &#61692;     Multiple occurrences of node within tree (source XML) can be handled easily.
    &#61692;     XSLT can be used in combination with graphical mapping.
    &#61692;     Multi-mapping is also possible using xslt.
    &#61692;     XSLT can be used with ABAP and JAVA Extensions.
    But at the same XSLT has the disadvantages also.
    Thnx
    Chirag

  • UDF mapping to split string

    Hi,
    I'm starting with UDF functions.
    How can i split source string at '-' and take first part into target.
    ex : 123-456 -> 123
    Easy points for those who know...
    Thanks in advance,
    Laurent.

    Hi Laurent,
    Use an Advanced User Defined Function. Adavnced user Defined Functions can return Multiple values.
    UDF1:
    1.Takes renmark as input.
    2.Does the split on the basis of ;
    3. Splits each split of step 2 on the basis of /
    4. Add the output of step 3 to the resultlist with a context change.
    UDF2:
    1.Takes renmark as input.
    2.Does the split on the basis of ;
    3. Splits each split of step 2 on the basis of /
    4. Add the output of step 3 to the resultlist with a context change.
    For Advanced UDF's,
    http://help.sap.com/saphelp_nw04/helpdata/en/f8/2857cbc374da48993c8eb7d3c8c87a/content.htm.
    You can try this piece of code in your mapping...
    You need 3 UDFs each for <detail>, <field1>,<field2>
    UDF1: For <detail>
    String arr[] = a[0].split(";");
    for (int i=0;i<arr.length;i++)
    result.addValue(arr);
    UDF2: For ><field1>
    String str = a[0];
    String str1 = null;
    String sarr1[] = str.split(";");
    for (int i=0; i<sarr1.length;i++)
    str1 = sarr1;
    String sarr2[] = str1.split("/");
    for (int j=0; j><sarr2.length;j++){
    result.addValue(sarr2[j]);
    j++;
    result.addContextChange();
    UDF2: For ><field2>
    String str = a[0];
    String str1 = null;
    String sarr1[] = str.split(";");
    for (int i=0; i<sarr1.length;i++)
    str1 = sarr1;
    String sarr2[] = str1.split("/");
    for (int j=0; j><sarr2.length;j++){
    j++;
    result.addValue(sarr2[j]);
    result.addContextChange();
    ..All these functions requires one input <remark>
    Hope this helps you ..
    *Reward with points if helpful*
    Regards,
    Shibani

  • Needed UDF in Shabarish Vijayakumar's weblog

    Hi,
    In the Shabarish Vijayakumar's weblog
    /people/shabarish.vijayakumar/blog/2005/08/03/xpath-to-show-the-path-multiple-receivers
    1. I need code for the following UDFs
    “ChkSum” and “AnyError”
    and
    2. how Constant (RDFILE) can be created  ?
    Thanks,
    ss
    Message was edited by:
            s s

    Hi Mudit,
    I tried the code as advanced UDF but it gave me
    <b><u>Source code has syntax error:</u></b> 
    C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:86: cannot resolve symbol symbol : variable amount location: class com.sap.xi.tf._RD_MM_ for(int i=0;i<amount.length;i++) ^
    C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:88: cannot resolve symbol symbol : variable amount location: class com.sap.xi.tf._RD_MM_ totAmount=totAmount+Integer.parseInt(amount); ^
    C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:90: cannot resolve symbol symbol : variable sum location: class com.sap.xi.tf._RD_MM_ if(totAmount==Integer.parseInt(sum[0])) ^
    C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:97: cannot resolve symbol symbol : variable Input1 location: class com.sap.xi.tf._RD_MM_ if(Input1.equals("true") && Input2.equals("0")) ^
    C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:97: cannot resolve symbol symbol : variable Input2 location: class com.sap.xi.tf._RD_MM_ if(Input1.equals("true") && Input2.equals("0")) ^
    C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:98: cannot return a value from method whose result type is void return "0"; ^
    C:/usr/sap/SXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapfc96f4b0a30f11dba64f001676478b29/source/com/sap/xi/tf/_RD_MM_.java:100: cannot return a value from method whose result type is void return "1";
    what went wrong ?
    Thanks,ss

  • Advanced Mapping question.

    All,
    we have 2 input messages, that need to be mapped into the output message.
    <source1>
    <response><id>1</id><cat>prodid</cat><value>PRD01</value></response>
    <response><id>1</id><cat>name</cat><value>Name01</value></response>
    <response><id>1</id><cat>price</cat><value>20.00</value></response>
    <response><id>2</id><cat>prodid</cat><value>PRD02</value></response>
    <response><id>2</id><cat>name</cat><value>Name02</value></response>
    <response><id>2</id><cat>price</cat><value>30.00</value></response>
    </source1>
    <source2>
    <product><id>1</id><prodid></prodid><isbn>isbn1</isbn><name></name><price></price></product>
    <product><id>1</id><<prodid></prodid><isbn>isbn2</isbn><name></name><price></price></product>
    </source2>
    The target is exactly similar to source2 message. But the values of the nodes <prodid>, <name>, <price> needs to be populated from source1 message by matching the <id> and node name.
    <target>
    <product><prodid>PRD01</prodid><isbn>isbn1</isbn><name>Name01</name><price>20.00</price></product>
    <product><prodid>PRD02</prodid><isbn>isbn2</isbn><name>Name02</name><price>30.00</price></product>
    </target>
    How can we do this using Advanced UDF?
    Thanks

    Check the following SAP Help link. It has a similar example.
    http://help.sap.com/saphelp_nw04/helpdata/en/d9/cea942ad920c31e10000000a1550b0/frameset.htm
    Thanks.

  • Advanced User Defined Function

    Dear All,
    I have a target structure as follows:
    <Item>
       <Record10>
          <RecordType>
          <BankCode>
          <AccountID>
          <Amount>
       </Record10>
       <Record50>
          <RecordType>
          <Segment1>
          <segment2>
          <segment3>
       </Record50>
    </Item>
    I want to fill the elements in the Record50 in a special way by using some logic. Sometimes I may have to create multiple Record50 structures. So I'm using an advanced user defined function to do this.
    My mapping is as follows:
    Source Structure -> myFunction()->Record50
    And in myFunction() I wrote the following piece of code:
    result.addValue("50");
    result.addValue("PayRef1");
    result.addValue("Address");
    result.addValue("Nil");
    I expect the output to be:
       <Record50>
          <RecordType>50</RecordType>
          <Segment1>PayRef1</Segment1>
          <segment2>Address</segment2>
          <segment3>Nil</segment3>
       </Record50>
    But the output is like this:
    <Record50>50</<Record50>
    <Record50>PayRef1</<Record50>
    <Record50>Address</<Record50>
    <Record50>Nil</<Record50>
    Can somebody tell me how to proceed? I tried to insert a context change in the beginning, but then the Record50 itself is not appearing.
    Thanks,
    Sandeep

    Hi,
    Advanced UDF will not create you like you expected.
    You need to do like this
    Source>myFunction1()-><RecordType>
    And in myFunction() you do code:
    result.addValue("50");
    Source>myFunction2()-><Segment1>
    And in myFunction2() you do code:
    result.addValue("PayRef1");
    so on..
    Thanks,
    Prakash

  • UDF: how to find out the context in in-queue has been changed? (java)

    Hi,
    does anybody know?
    Is there som function for this? Because I have a inbound queue with 2 separate contexts, let's say:
    A
    B
    C->changes context
    X
    Y
    Z-?changes context
    Let's say I need to return first values in each context. how to do that in UDF?
    Thank you,
    Olian
    Edited by: Olian Saludew on Aug 12, 2008 7:11 PM

    Hi,
    Create the Advanced UDF as below
    While creating the UDF select the Cache parameter as Context
    Then just use below code.
    here a---> Source field
    result.addValue(a[0]);
    This will always take only 1st value of queue.
    Thanks
    swarup

  • Not able to see UDFs created in Pricelist

    Hi all,
    I have created 2 separate UDF one in Pricelist and second in pricelist row level.
    Now when I tried to open pricelist window within Inventory I am not able to see the UDF window.
    Please note I have already checked View UDF in main menu
    Thanking in advance

    A UDF can only be created at Pricelist level.  When you create a UDF in Master Data > Price List  you can see this UDF as a column when you open Inventory > Price lists  (perhaps after Group drop down)
    Please click on Form Setting when you are on the Price Lists window and see if Visible and Active is checked

  • Sample UDFs

    Hi,
    I am new to UDF's. Can anybody tell me the difference between simple UDF & Advanced UDF with some example code?
    Thanks
    Narayana

    Hi Narayana,
    the differnece is the simple UDF take a values with occurance 1of type string as input and process and produces a tring value as output.
    Advanced UDF takes entire queue as input and writes the value to this queue.
    Standard functions - http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
    UDF - http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
    /people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio
    http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d046c490-0201-0010-84b6-9df523cbca31
    Thanks,
    Ram

  • Context Vs Queue in UDF

    Can you give an idea about Context Vs Queue in UDF????

    Hi ! Gabriel
    this indicated which values from your XML will be inserted into your funciton
    either one - value
    from one context only - context
    or all - queue
    <b>check this page to understand</b>
    <b>Working with Contexts or Queues</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/f8/2857cbc374da48993c8eb7d3c8c87a/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/f8/2857cbc374da48993c8eb7d3c8c87a/content.htm
    <b>look into this link that explains about the same.</b>
    value ---> is a value for the input parameter. It may be a single value or multiple values.
    Queue-----> it is an entire instance of XML message. That means, if you have duplicates of a node, all those contexts will be includedin Queue, which is passed to UDF.
    Context -
    > refers to a particular context of the XML message.
    Please refer to the following document which comprehensively explain differences b/w the various options with examples
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a6638https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a6638
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/58cd3b11571962e10000000a11402f/frameset.htm
    <b>There r 2 types of UDF - Simple and Advanced</b>- Simple UDFs uses Value, wherein we can manipulate only one value (input is one String). Therefore a single string is expected as input and the output would also b a single string.
    - Advanced UDFs uses Context or Queue, where you manipulate many values (input is an array of Strings).
    This will help u
    http://help.sap.com/saphelp_nw2004s/helpdata/en/40/7b8e40496f6f1de10000000a1550b0/content.htm
    Thanks!!
    Regards
    Abhishek

  • Difference between Context and Queue in UDF

    hi,
    i am trying to write udf but i have doubt when do i select Contect and when do i select Queue as my udf ? How do we decide which one i select ?
    Thanks & Regards
    Naveen

    when u go 4 advanced udf functionalites u need this. for simple udf not req to play with queue nor context. the input when using a context or queue will be an array of strings but in simple udf's it is just a single string that u will be accessing. u can also check here:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/40/7b8e40496f6f1de10000000a1550b0/content.htm

Maybe you are looking for

  • Cannot edit a page shortly after editing a page

    I am using Contribute CS4. I am able to connect to a site and make changes. When I go to edit a page, I see the .lck file created on the server. I can publish the change. However, after I publish my change, I cannot go back and make further edits w/o

  • Total costs field in trx PRAP has double value

    Dear experts, Everything in the Travel Expenses module works fine. All the entered trips can be approved without problems and posted to FI. However, when I want to execute an approval of several trips at one time with transaction PRAP I noticed that

  • Firewire (AV) Videocam with USB-only New iMac

    This has probably been answered somewhere but can't find it. What sort of connector is required to connect my Sony DCR HC52 camcorder to a new 21.5-inch: 3.06GHz USB-only computer? My current 4-year old MacBook Pro has the firewire input, which works

  • HOW DO I VIEW A PUBLISHER FILE?

    anyone know how i can view a publisher file on my mac for free? I do have ms office 2011

  • Query Formula with boolean return values

    Hi, In my query, I have a  formula column which returns a boolean value 0 or 1. I need to add these values, but I cannot add them as boolean.  Is there a way that I could convert the boolean values to number/integer so I can add them? Thanks in advan