on 07-31-2009 3:08 PM
Dear friends,
I've a issue regarding message mapping within PI 7.0
This is how my source structure looks like:
<?xml version="1.0" encoding="UTF-8"?>
<stop>
<stopreference/>
<action>
<actionreference>1</actionreference>
<shipment>
<shipmentreference>11</shipmentreference>
<goods>
<goodsreference>111</goodsreference>
</goods>
<goods>
<goodsreference>111</goodsreference>
</goods>
</shipment>
</action>
<action>
<actionreference>2</actionreference>
<shipment>
<shipmentreference>22</shipmentreference>
<goods>
<goodsreference>222</goodsreference>
</goods>
</shipment>
</action>
</stop>
The target structure looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<Test>
<STOPDETAILS>
<item>
<EXTERNAL_STOP/>
<EXTERNAL_ACTION/>
<EXTERNAL_SHIP/>
<EXTERNAL_GOOD/>
</item>
</STOPDETAILS>
</Test>
In the source message the stop is the header and within a stop there can be 0 or more actions, within action there can be 0 or more shipments and within a shipment there can be 0 or more goods...
My target message is a flat XML structure...
The customer wants to see an Item target structure for every goods, the shipment, the action and the stop. If the there are no goods, they wants just to see the shipment, the action and the stop...and so on...
So its look like this:
stop 1 - action 1 - shipment 1 - good 1
stop 1 - action 1 - shipment 1 - good 2
stop 1 - action 1 - shipment 2 - good 1
stop 1 - action 1 - shipment 2 - good 2
stop 1 - action 2 - shipment 1 - good 1
stop 1 - action 2 - shipment 1 - good 2
And so on...
I've to solve this issue in the Graphical Mapping...
Do you have a suggestion how to do that?
Kind regards,
Kamran
Hi Kamran,
I believe this can be solved with some effort and careful context handling.
The foremost thing you need to understand well the logical relation between the target node (repeatable) and the source nodes in different hierarchies.
Then the logic goes like this:
1.The target item node repeats for as many times the goods node appears in your source structure. So map the target "item" node with goods node raised to its highest context.
Though not directly - use a FormatByExample with Shipment, then mapWithDefault(blank value) -> FormatByExample with action, then mapWithDefault -> then the same for Stop.
This gives you the correct number of occurance for the item node.
2. Map the target child nodes now with proper context handling, use "UseOneAsMany" here if required. With monitoring the Contexts in Display Queue and proper test data you can surely achieve the required results with Standard Functions only. Though I agree its quite an effort anticipate the contexts for different data conditions.
All the best. Hope it helps.
Regards,
Suddha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suddha,
"1.The target item node repeats for as many times the goods node appears in your source structure. So map the target "item" node with goods node raised to its highest context."
That's part of the case. The target item node has to repeats for as many timesas the action, shipment and goods nodes appear in the source structure. And all of these nodes are optional so it's possible that they don't appear in the source srtucture.
This is an example of how the source structure looks like...So with 1 action, 1 shipment and 2 goods so I have to create 4 Items in the target structure...
<?xml version="1.0" encoding="UTF-8"?>
<stop>
<stopreference>0010000020_0006</stopreference>
<action>
<actionreference>0080004484</actionreference>
<shipment>
<shipmentreference>0080004484</shipmentreference>
<goods>
<goodsexternalreference>0080004484_0001</goodsexternalreference>
</goods>
<goods>
<goodsexternalreference>0080004484_0002</goodsexternalreference>
</goods>
</shipment>
</action>
</stop>
Hi Kamran,
YOu might have to use Use-One-As-Many function for your EXTERNAL_STOP/>
<EXTERNAL_ACTION/>
<EXTERNAL_SHIP/>
fields.
See usage here:
http://help.sap.com/saphelp_nwpi71/helpdata/en/ef/df564b6aa24fc9ab0d685460747de5/content.htm
For your Goods element, you can just use Remove Contexts and use splitByValue (One change of each value)
Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi kamran,
Can you please clarify the question.?
As far i have understood you can go with xslt mapping.
thanks
Jai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nobody has any idea???
Kind regards,
Kamran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<?xml version="1.0" encoding="UTF-8"?>
<STOPDETAILS>
<ITEM>
<MANDT/>
<EXTERNAL_STOP>0010000020_0006</EXTERNAL_STOP>
<ADRNZ>0026858089</ADRNZ>
<TIMESTAMP>20090721121900 </TIMESTAMP>
<TIMESTAMPSTART>20090721121600 </TIMESTAMPSTART>
<TIMESTAMPSTOP>20090721121700 </TIMESTAMPSTOP>
<ID_STOP>40</ID_STOP>
<DESCR_STOP>Done</DESCR_STOP>
<EXTERNAL_ACTION>0080004483</EXTERNAL_ACTION>
<TIMESTAMP_ACTION>20090721121900 </TIMESTAMP_ACTION>
<ID_ACTION>30</ID_ACTION>
<DESCR_ACTION>Partly Done</DESCR_ACTION>
<EXTERNAL_SHIP/>
<ID_SHIPM/>
<DESC_SHIPTYPE/>
<EXTERNAL_GOOD/>
<ID_GOOD/>
<DESCR_GOOD/>
</ITEM>
<ITEM>
<MANDT/>
<EXTERNAL_STOP>0010000020_0006</EXTERNAL_STOP>
<ADRNZ>0026858089</ADRNZ>
<TIMESTAMP>20090721121900 </TIMESTAMP>
<TIMESTAMPSTART>20090721121600 </TIMESTAMPSTART>
<TIMESTAMPSTOP>20090721121700 </TIMESTAMPSTOP>
<ID_STOP>40</ID_STOP>
<DESCR_STOP>Done</DESCR_STOP>
<EXTERNAL_ACTION>0080004484</EXTERNAL_ACTION>
<TIMESTAMP_ACTION>20090721121900 </TIMESTAMP_ACTION>
<ID_ACTION>deelbewerking</ID_ACTION>
<DESCR_ACTION>Done</DESCR_ACTION>
<EXTERNAL_SHIP>0080004484</EXTERNAL_SHIP>
<ID_SHIPM>20</ID_SHIPM>
<DESC_SHIPTYPE>Planned</DESC_SHIPTYPE>
<EXTERNAL_GOOD>0080004484_0001</EXTERNAL_GOOD>
<ID_GOOD>40</ID_GOOD>
<DESCR_GOOD/>
</ITEM>
<ITEM>
<MANDT/>
<EXTERNAL_STOP>0010000020_0006</EXTERNAL_STOP>
<ADRNZ>0026858089</ADRNZ>
<TIMESTAMP>20090721121900 </TIMESTAMP>
<TIMESTAMPSTART>20090721121600 </TIMESTAMPSTART>
<TIMESTAMPSTOP>20090721121700 </TIMESTAMPSTOP>
<ID_STOP>40</ID_STOP>
<DESCR_STOP>Done</DESCR_STOP>
<EXTERNAL_ACTION>0080004484</EXTERNAL_ACTION>
<TIMESTAMP_ACTION>20090721121900 </TIMESTAMP_ACTION>
<ID_ACTION>40</ID_ACTION>
<DESCR_ACTION>Done</DESCR_ACTION>
<EXTERNAL_SHIP>0080004484</EXTERNAL_SHIP>
<ID_SHIPM>20</ID_SHIPM>
<DESC_SHIPTYPE>Planned</DESC_SHIPTYPE>
<EXTERNAL_GOOD>0080004484_0002</EXTERNAL_GOOD>
<ID_GOOD>40</ID_GOOD>
<DESCR_GOOD/>
</ITEM>
</STOPDETAILS>
Hi Kamran, I think Ravi Kanth solution is good, or at least is the way. You must do a lot of test and error to get the final solution...
I think this pdf will help you, read from page 26:
[Advanced Message Mapping|https://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/be05e290-0201-0010-e997-b6e55f9548dd&overridelayout=true]
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sunil,
I'm familiar with standard XI graphical functions and I believe it's not possible to solve it with standard XI graphical functions. Or do you have an idea how to solve it with standard XI graphical functions?
Ive already tried useOneAsMany but it's doesn't do what I want...
Regards,
Kamran
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.