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

XI mapping Question

First I know the XML I post below is modeled incorrectly and the Werks field should be a repeating group. I am trying to solve the problem using the graphical mapping program to produce a split of werks by "," into a table modeled from a bapi.

I have tried all kinds of functions in the graphical editor and nothing seems to be able to produce the desired output.

Anyone have any ideas or experience with this type of mapping challenge?

Input:

<ns0:MT_MAT xmlns:ns0="urn:rfmd-com:AGILE_INTEGRATION-MAT_BOM">

<KEY/>

<MATNR>12345</MATNR>

<ACD>A</ACD>

<MTART/>

<WERKS>1200,1300</WERKS>

........

How would I get the mapping program to split the contents of the werks field by "," into:

...........

<ITAB_WERKS>

<item>

<WERKS>1200</WERKS>

<WERKS>1300</WERKS>

</item></ITAB_WERKS>

</ns1:ZAGILE_CREATE_CHANGE_MATERIAL>

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jan 31, 2008 at 03:05 PM

    Hi,

    Use the below code.

    //Advance UDF (type =queue, one input parameter)

    String werks = input[0];

    StringTokenizer st = new StringTokenizer(werks,",");

    while(st.hasMoreTokens())

    {

    result.addValue(st.nextToken());

    }

    Werks--UDF---Werks

    raj.

    Edited by: Raj on Jan 31, 2008 9:06 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 03:02 PM

    Mordeb,

    You can write a user defined function and split.

    Regards,

    ---Satish

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 03:30 PM

    Hi,

    In your case, you can using UDF with cache type of Value, Context or Queue, they should all works.

    You can also use following code:

    ========Using Cache By Value=====

    String[] b = a.split(",");

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

    result.addValue(b<i>);

    ========Using Cache By Context or Queue=====

    String[] b = a[0].split(",");

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

    result.addValue(b<i>);

    in braket (), should be b<i>, but it does not posted this way

    Liang

    Edited by: Liang Ji on Jan 31, 2008 4:36 PM

    Add a comment
    10|10000 characters needed characters exceeded

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.