on 12-16-2009 3:21 PM
Hi,
I have a problem in PI mapping. We have a source structure which has header data. The target has line item data.
I need to copy one of the field of header data to field of item data.
Header will have only one record but item can have multiple values & header field should be copied to all line items of target field.
How do I do this?
Regards,,,,
Sunil Joyous
Hi Sunil,
You need to use the standard node function useoneasmany..
UPDATE
Check Section 30 of wiki link
http://wiki.sdn.sap.com/wiki/display/NWTech/QAforPI-Onestopforall%28Part-1%29
Question 30:
How to use OneAsMany function in Message Mapping?
Answer 30:
Let us take an example where the use of contexts can be emphasized.
In the source message shown above OrderNumber appears only once while OrderItem can occur multiple times within the OrderHeader node. Suppose we want to map OrderNumber multiple times in the target message, such that it is available under the target node corresponding to every sales order item. To do this, we can use the node function called useOneAsMany as described below:
a. The first input parameter expects the list of values that we want to propagate to the target message.
b. The second input parameter expects the number of iterations or how many times we want to replicate the value given in the first parameter.
c. The third input parameter is the list of context changes. Depending on this parameter the source values will be propagated to the target after every context change.
Note: For this function to work as expected, the first two parameters must contain the same number of contexts while the last two parameters must contain the same number of values.
Regards
Suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sunil,
Have you checked the point30 it was descriptive enough..
Anyway, your single input will be first value, second and third will be line item field from source (field which repeat and create multiple target segments). The only difference between 2 and 3rd input value is the context change.. For 2nd value you need to make the context as parent or source root node and for 3rd leave as it is
Regards
Suraj
Hi Suraj,
I have gone thr' the point 30 I did mapping but I got following result,
,5000920199,5000920199,,, 2.000,,,2045011421,,KG,0000449948,000000000001011264,,,,
,,, 2.000,,,,KG,0000449949,000000000001011266,,,,
where as it should be like below
,5000920199,,,, 2.000,,,2045011421,,KG,0000449948,000000000001011264,,,,
,5000920199,, 2.000,,,,KG,0000449949,000000000001011266,,,,
following is the input source messgae
header
--> xblnr
-->Item data
-->Matnr
so I passed follwing mapping parameter in useOneAsMany
1) xblnr
2) item data
3) item data
and output is mapped to target line item data.
Do you have any idea why it is giving wrong result?
Regards,,,
Sunil
You can also use CopyValue function which is easy in use.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.