cancel
Showing results for 
Search instead for 
Did you mean: 

context mapping solution

Former Member
0 Kudos

Hi All,

I am looking for a solution for the mapping requirement below:

Source Structure : Multiple Delivery Records with their line items and batch number .... Row ( 1...unbounded)

Del#Item#Batch#MaterialSerial#
123101ABCBlank
123201DEFBlank
1241089ABCBlank
1241090ABCBlank
1242091DEFBlank
125101XYZ78
125101XYZ79
125101DEF80
125201ABC81

xml data:

<MT_Delivery>

<Row>

<Del>123</Del>

<Item>10</Item>

<Batch>1</Batch>

<Material>ABC</Material>

<Serial></Serial>

</Row>

<Row>

...

..</Row>

</MT_Delivery>

I need to map the above source structure to  Target Idoc Segment E1EDL24  ( 0.... unbounded) in Delivery Idoc

The requirement is :

1. Multiple E1EDL24 segments should be created for the same delivery Idoc one per line item number

2.If the same line item contains more than one Batch number , then create one E1EDL24 segment for each batch number. for Ex:If a line item has 2 batch numbers then create 2 segments

How do I put both the requirements above when mapping to E1EDL24 segment

Any help greatly appreciated..

CollinsV

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Since your input is dependent on three fields namely: Del, Item and Batch, you can do the mapping below:

The logic above will create 7 E1EDL24 segments based on the example you provided.

As for the fields under E1EDL24, you can use the logic below, e.g for POSNR (Item Number)

You can reuse the logic for all of the fields by just replacing the Item (connected to the removeContext) and the POSNR (target) with the respective fields.

Hope this helps,

Mark

Former Member
0 Kudos

Hi Mark,

Thanks for your inputs, I am almost there , I did the same mapping for E1EDL24 segment ,but all the 7 segments are created for same Idoc instead I would like them to be grouped for their respective Idocs . Each Idoc has 1 delivery number.

I need the line items to be in different idocs based on their delivery number.

Desired output:

Idoc 1 : Del # 123 has 2 E1EDL24 segments

Idoc 2: Del # 124 has 3 E1EDL24 segments

Idoc 3: Del # 125 has 2 E1EDL24 segments

Where as now I am getting the following

Idoc 1 : Del # 123 has 7 E1EDL24 segments

Idoc 2: Del # 124 has 0 E1EDL24 segments

Idoc 3: Del # 125 has 0 E1EDL24 segments

Former Member
0 Kudos

Mark,

I achieved the result for E1EDL24 segment with the following mapping..

I will keep you posted on how the mapping goes for fields under E1EDL24 segment.

Thanks Again...

Former Member
0 Kudos

All,

I have one more mapping requirement for the same idoc..

For each idoc If one line item number has more than one batch number ( in the above example it is Del# 124 ), then populate the target field with constant value "QUAL" else blank.

Any help on this

Collins

Former Member
0 Kudos

Any help on this mapping requirement

For each idoc If one line item number has more than one batch number ( in the above example it is Del# 124 ), then populate the target field with constant value "QUAL" else blank.

Thanks

Collins

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Apologies for the late response. You can try the logic below:

Regards,

Mark

Former Member
0 Kudos

Mark,

You made my day complete , Awesome mapping !!!.You are an expert in context mapping.

I was trying to do the opposite for FormatByExample using Batch number and concat of  Delivery Nbr & Line Nbr and then do a count function.

Can you explain the flow logic above.

Also can you explain briefly about node functions (formatByExample,removeContext,collapseContext,splitByValue,UseOneAsmany) based on your understanding.

Thanks Again,

Collins

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Up to the second SplitByValue:ValueChanged, that was the logic you used to create three different idocs right? So, the count counts the number of context per context change. If I remember it correctly, the result is 1 CC 1 CC 2 CC 1 CC 1 CC 1 where CC = ContextChange. Since the number of inputs to the ifThenElse function should be equal to the number of output (otherwise the mapping behavior would be inconsistent), the useOneAsMany is used so that the number of contexts is 7 (1 CC 1 CC 2 2 CC 1 CC 1 CC 1) and that the output would be two QUALF in the DEL#124.

In my own words, here they are:

formatByExample - the output follows the context format of the second input using values from the first input

removeContext - removes the context change

collapseContext - retains the first value only of a context, it also removes the context change

splitByValue - inserts a context change depending on the property e.g eachValue = one per value,

valueChanged = only when there is a change in value

useOneAsMany - multiplies the number of the context of the first input with those of the second input and follows the structure of the third input (rarely used).

Apologies for not being able to excel in explaining

Hope this helps,

Mark

Former Member
0 Kudos

Thanks Mark ,  your explanation was really helpful...

Thanks,

Collins

Former Member
0 Kudos

Mark,

I have one more mapping request,

I need to create a segment as many times as the number of line items for a delivery in the idoc which as got Serial # .In the above example it is only for delivery #125 which as got serial# I need to create 2 target segment based on the number of line item.

How to proceed with this ..

Thanks,

Collins

Former Member
0 Kudos

I have the following mapping requirement :

Source Structure : Multiple delivery document with line numbers,batch numbers ,toteid's & Serial numbers.Each row in the table below is a record (0.. many).

One Target Idoc is created for one delivery.

Del#Item#
Batch#
MaterialSerial#ToteIDQty
123101ABC
81232
123201DEF
81233
1241089ABC
81232
1241090ABC
81244
124201ABC
81233
125101XYZ788101
125101XYZ798101
125101XYZ808101
125101XYZ818101
125201XYZ
8101

Requirement:

I need to create a target segment ZE1DL37 ( 0...many) based on unique ToteId's received and only when the delivery has serial # . In the above scenario

it is deliver # 125 which as  the serial # populated and I need to create 1 ZE1EDL37 based on unique toteid (810) for that delivery.

How to proceed with this..

Former Member
0 Kudos

Hi All,

Any ideas for the mapping requirement above ?

Regards,

Collins

Answers (1)

Answers (1)

Former Member
0 Kudos

Victor,

Have you considered using XSLT mappings in your PI Operation Mapping objects. i.e Message Source -> XSLT Conversion -> Output message. You will need to save your XSLT mappings into an Imported Archive file then import into PI.

Try this link as a starting point  - http://scn.sap.com/docs/DOC-3824.

Former Member
0 Kudos

Thanks Michael  for your inputs , I wanted to use context mapping as my first choice and if not consider the XSLT mapping.

Thanks Again

Collins