on 08-29-2013 7:54 AM
Hi Guys,
we have our outbound structure like
<MT_HEADER>
<Record>(0:unbound)
<Status>(0:unbound)
<Item>(0:unbound)
<fields>
Our Target structure is
<Item>
<fields>
<Status>(0:unbound)
<Index>
<Desc>
For every item we split and create a file to target using multimapping. Status field was added recently in the structure. All da statuses that comes under one <Record> should be mapped for all the items.
Ex: If they are 5 statuses under one Record node. Each item should have those 5 status fields with index 0 to 5 and respective status.
Sample example:
Source:
<MT_HEADER>
<Record>
<Status>Yes</Status>
<Status>EX</Status>
<Item>
<Field>UED</Field>
<Item>
<Field>EUR</Field>
Expected output after multimapping is
File1:
<Item>
<Field>UED</Field>
<Status>
<Index>1</Index>
<Desc>Yes</Desc>
<Status>
<Index>2</Index>
<Desc>EX</Desc>
File2:
<Item>
<Field>EUR</Field>
<Status>
<Index>1</Index>
<Desc>Yes</Desc>
<Status>
<Index>2</Index>
<Desc>EX</Desc>
Hello,
I believe u are already done with Item's and Field's mapping and the only part where u r stuck is Status target field mapping. So u can refer the below attached UDF for the same:
Execution Type: All values of a context
Input Var1 and Var2
for(int i=0;i<var1.length;i++)
{
for(int j=0;j<var2.length;j++)
{
result.addValue(var2[j]);
}
if(i+1<var1.length)
result.addContextChange();
}
Mapping:
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, and of course as Peter mentioned, XSLT would probably fit in, too
Have a look at <xsl:template match="<XPATH>"> and <xsl:value-of select="<XPATH>"/>
HTH
Cheers
Jens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not perfectly positive but this might also be possible using only graphical mapping / multi - mapping. So there might not be need for UDF.
I once did this for an IDoc splitting on one field (TANUM) utilizing built-in functions like "CopyValue", "useOneAsMany" and shifting Context on TANUM field.
If you want to go the graphical mapping way, you may want to read some stuff about
message split
context
built-in functions
http://scn.sap.com/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-part-ii
general about graphical mapping
http://scn.sap.com/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i
http://scn.sap.com/docs/DOC-22620
Cheers
Jens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Mahesh,
Can you also do it with XSLT? That would be easier than a UDF.
Best regards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
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.