on 01-31-2008 2:55 PM
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>
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mordeb,
You can write a user defined function and split.
Regards,
---Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.