on 10-13-2010 5:10 AM
Hi,
I have a requirement to convert the below:
Source Message:
<Message>
<Segment> ..............................0..unbounded
<Field1>Value1</Field1>
<Field2>Value2</Field2>
.
.
<Field20>Value20</Field20>
</Segment>
<Segment> ..............................0..unbounded
<Field1>value1</Field1>
<Field2>value2</Field2>
.
.
<Field20>Value20</Field20>
</Segment>
</Message>
Target Message should be:
<TargetMsg>
<Node>Value1,Value2,Value3,.........,Value20
value1,value2,value3,........,value20</Node>
</TargetMsg
How to do this using only Message mapping?
Thank you,
Pankaj.
Hi Pankaj,
As per your Requirement, you need to do content conversion on your receiver file adapter.
Check for the Receiver content conversion parameters from below link:
http://help.sap.com/saphelp_srm40/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Pankaj,
Do you need new line after each Value1 to Value 20?
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am not using FILE adapter.
Also after converting the format to CSV I have to perform some other functions on the message.
It is actually a CSV embedded inside a XML.
Source Structure:
<Message>
<Data>
<ID>IND123</ID>
<Segment> ..............................0..unbounded
<Field1>Value1</Field1>
<Field2>Value2</Field2>
.
<Field20>Value20</Field20>
</Segment>
</Data>
<Data>
<ID>IND321</ID>
<Segment> ..............................0..unbounded
<Field1>value1</Field1>
<Field2>value2</Field2>
.
<Field20>Value20</Field20>
</Segment>
</Data>
</Message>
Target Message should be:
<TargetMsg>
<Node>ID: IND123
Value1,Value2,Value3,.........,Value20
ID:IND321
value1,value2,value3,........,value20</Node>
</TargetMsg>
Thank you,
Pankaj.
Hi Pankaj,
I understand you would like to achieve the requirement in Message Mapping.
Yes, we can do it in Message Mapping.
Take the First field "Value1" concat with "," and then concat with Next field and so on.....
So, finally your uotput will be Value1,Value2,Value3..............
Hope this help you to fix the issue.
Thanks,
Hi,
It will be very difficult to manage using Standard Functions. You are saying that I concat 20 fields using Concat function. What if the field number increases (suppose 50)? Moreover how to have these details on a newline?
I think this can be achieved using UDF, but I am not sure what code is required.
Thank you,
Pankaj.
Hi,
Use this UDF:
Execution type: All values of a context
Var1, var2 type string
String a="";
String b="";
for(int i=0;i<var1.length;i++)
{
a = var1<i> +"," + var2<i> + "\n";
b= b+ a ;
}
int len1 = b.length();
String str= b.substring(0 , len1-1);
result.addValue(str);
Mapping will be:
Field1---RemoveContext
-
UDF------Node
Field2---RemoveContext
Note:This UDF is prepared only for 2 inputs(u can add remaining fileds and modify this according to ur req).
Thanks
Amit
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.