on 06-22-2007 7:38 AM
Now we have the following data type
<head_line>
<A>1</A>
<B>2</B>
</head_line>
<line_item>
<C>3</C>
<D>4</D>
</line_item>
<line_item>
<C>5</C>
<D>6</D>
</line_item>
We want to seperate the head line and the line item in database tables, so we hope that we can get the following structure after mapping:
<STMT1>
<dbtable>
<table>Table_Name</table>
<access>
<A>1</A>
<B>2</B>
</access>
</dbtable>
</STMT1>
<STMT2>
<dbtable>
<table>Table_Name</table>
<access>
<A>1</A>
<B>2</B>
<C>3</C>
<D>4</D>
</access>
</dbtable>
<STMT2>
<dbtable>
<table>Table_Name</table>
<access>
<A>1</A>
<B>2</B>
<C>5</C>
<D>6</D>
</access>
</dbtable>
but the mapping test continue giving us the error
"14:32:22 Start of test
Compilation of MM_TEST successful Cannot produce target element /ns0:MT_STMT/STMT2[2]/dbtable/access/A. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd Cannot produce target element /ns0:MT_STMT/STMT2[2]/dbtable/access/A. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd
14:32:23 End of test"
here's the mapping text:
/ns0:MT_STMT=/ns0:MT_TEST=
/ns0:MT_STMT/STMT1=/ns0:MT_TEST/head_line=
/ns0:MT_STMT/STMT1/dbtable/table=const([value=Table_Name])
/ns0:MT_STMT/STMT1/dbtable/access/A=/ns0:MT_TEST/head_line/A=
/ns0:MT_STMT/STMT1/dbtable/access/B=/ns0:MT_TEST/head_line/B=
/ns0:MT_STMT/STMT2=/ns0:MT_TEST/line_item=
/ns0:MT_STMT/STMT2/dbtable/table=const([value=Table_Name])
/ns0:MT_STMT/STMT2/dbtable/access/A=/ns0:MT_TEST/head_line/A=
/ns0:MT_STMT/STMT2/dbtable/access/B=/ns0:MT_TEST/head_line/B=
/ns0:MT_STMT/STMT2/dbtable/access/C=/ns0:MT_TEST/line_item/C=
/ns0:MT_STMT/STMT2/dbtable/access/D=/ns0:MT_TEST/line_item/D=
Message was edited by:
YiNing Mao
go thru this blog:
Message Splitting Using the Graphical Mapping Tool
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
You are getting this error when you try to map fields A and B from header segment to access in target node . Do one thing either wirte UDF which will repeat A and B for the number fo occurances of line_item . Or the second option is use the function <i>useAsMany</i> to map A and B from Soruce to target . While using useAsMany function you would need to pass three parameters . First paramer give the field A with the context as Header .In Second sepcify the Line_item and in third Input also specify line_item and then map it to target access node's A field . repeat the same for B field .
Thanks ,
Suvarna
Award pts if it helps .
YiNing Mao,
As per your design, I assume that Header will come only once and Line items will come multiple times, isn't it. If my understanding is correct then please follow the below logic.
Please see the structure defined in the below URL
http://www.flickr.com/photo_zoom.gne?id=602255112&size=o
As per the structure defined in the above URL -( U have to duplicate the STMT Node)
<b>Logic for First STMT</b>
Constant[] -
>STMT[target]
Constant[Table-Name] -
>table[target]
A[source] -
> A[Target]
B[source] -
> B[Target]
<b>Logic for Second STMT</b>
line_item[source] -
> STMT[target] <b>refer</b> http://www.flickr.com/photo_zoom.gne?id=602255092&size=o
Constant[Table-Name] -
>table[target]
Mapping Target A -
>http://www.flickr.com/photo_zoom.gne?id=602255124&size=o
Mapping Target B -
>http://www.flickr.com/photo_zoom.gne?id=602255242&size=o
C[source] -
> C[Target]
D[source] -
> D[Target]
<b>Results.</b>
http://www.flickr.com/photo_zoom.gne?id=602255060&size=o
I defined the target as you gave in the thread, but don't forget to add action attribute for the <DBtable> node.
Fyr :http://help.sap.com/saphelp_nw70/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
I hope it helps, if you have any doubt,reply.
Best regards,
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
mapping of STMT1 is one-one where are for STMT2 u may require to use UDF. In this case change the context of head_line and line_item popint to root node and using a udf coupled with context handeling u can have the strucutre framed for STMT2 as requried....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi mao,
there seems a problem with context handling. iare the contexts rite?
For STMT2 use the following kind of mapping:
/ns0:Resultset_MT/Row/address=SplitByValue(concat(/ns0:PurchaseOrder_MT/Order/Item=, /ns0:PurchaseOrder_MT/Order/Header/Address=))
Here replace item with line_item and adress with A/B
vat we are doing here is :
you want A and B to occur as many times as line_item (for STMT2). so concat line_item and A (and B) then use split by value to insert context at relevant place.
hope it helps.
[reward if helpful]
regards,
latika.
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.