cancel
Showing results for 
Search instead for 
Did you mean: 

PI Mapping

former_member75463
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member187339
Active Contributor
0 Kudos

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

former_member75463
Participant
0 Kudos

Hi Suraj,

I am bit confused on how to use this function.

It requires three input & gives one output.

I have only one input field which needs to be copied multiple times in target data.

Regards,,,

Sunil

Former Member
0 Kudos

Have you tried CopyValue function? it is under Constant functions..

Regads,

Sarvesh

former_member187339
Active Contributor
0 Kudos

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

former_member75463
Participant
0 Kudos

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

former_member75463
Participant
0 Kudos

Suraj,

problem is resolved.

I passed one of the field of Item data as 3rd parameter & it works fine.

Thanks for your input.

Answers (1)

Answers (1)

Former Member
0 Kudos

You can also use CopyValue function which is easy in use.