on 06-27-2012 4:44 PM
Hi All,
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# | Material | Serial# | ToteID | Qty |
---|---|---|---|---|---|---|
123 | 10 | 1 | ABC | 8123 | 2 | |
123 | 20 | 1 | DEF | 8123 | 3 | |
124 | 10 | 89 | ABC | 8123 | 2 | |
124 | 10 | 90 | ABC | 8124 | 4 | |
124 | 20 | 1 | ABC | 8123 | 3 | |
125 | 10 | 1 | XYZ | 78 | 810 | 1 |
125 | 10 | 1 | XYZ | 79 | 810 | 1 |
125 | 10 | 1 | XYZ | 80 | 810 | 1 |
125 | 10 | 1 | XYZ | 81 | 810 | 1 |
125 | 20 | 1 | XYZ | 810 | 1 |
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..
Any Help greatly appreciated..
Collins V
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Greg and Mark ,
First of all 'Thank You' for both of you in providing the inputs on the mapping requirement.
Greg,
I tried your solution , it was almost there except for one condition , it gave one unique context in the end
with only 1 Z1EDL37 segment created but it was creating for the first delivery # 123 , instead it should create for delivery # 125.Please see the display queue output below.
Mark,
It worked exactly as required . Once again I am going to ask you explain the logic you had above if you don't mind . I guess the key to resolve the logic above is how to group the values for each column and try to see how we can group them based on formatByexample plus the other node functions ( removeContext,splitByValue,collapseContext,sort and sortbyKey), please correct me if I am wrong here.
Thanks again to both of you...
CollinsV
Mark,
There is another segment called ZE1EDL44 under ZE1EDL37 , which has to be created as many times the Line Item No and Serial Number , provided the serial number is not Blank.In the above scenario it will be for Delivery # 125 , I need to have 4 segments populated for ZE1EDL44 ( based on 4 serial numbers 78,79,80,81)
I am trying with the mapping logic below , but it is not working.Any thoughts on were I am doing wrong? I think the issue might be because ZE1EDL44 is under ZE1EDL37 which is not getting created for every Delivery Idoc.
E1EDL20
|_______ZE1EDL37 - 0...many - created for each unique toteid which has Serial number populated and not blank
|________ZE1EDL44 - 0....many - Created as many times under ZE1EDL37 based on line item and serial number , provided serial number not blank
Regards,
Collins V
Hello,
Yes, you are correct, it all lies with context manipulation. Del is concatenated with ToteID and then sorted because it is not arranged. The sortByKey is used to sort the serial number in the same way as the concatenation of Del and ToteID. ValueChanged is used to group the same Del and ToteID together and then its grouping(according to context) is used to format the grouping of the Serial.
Serial is sorted before the collapse context so that if ever the context contains a blank and a number, the number will be first. CollapseContext is used to remove duplicates The final splitByValue is used to group the original Del input and then its grouping will be used to format the result of the collapsed serial number.
The ifWithoutElse is used to pass only the values of the serial in which is not a blank either the output is suppressed or with a value.
Regards,
Mark
Hi Mark,
Thanks for your inputs again.
This is ZE1EDL44 segment not the E1EDL44 segment. This ZE1EDL44 segment is created as many times as the occurrence of Serial Number and Line Number for a delivery where the Serial Number field is not Blank.
In the above example it is Del # 125 and ZE1EDL44 will be created 4 times based on 78,79,80,81.
Let me try the mapping again replacing the toteid with Line number which you provided above.
Any thoughts...
Regards,
Collins
Mark,
The reason it is not working for me is ZE1EDL37 is created for each toteid for a delivery and ZE1EDL44 under it is created for each Line & Serial Number for a delivery combination.
And in the above example ZE1EDL37 parent of Z1EDL44 is not created for Del 123 and 124 and it is only created for Del# 125 first time under which we get Z1EDL44 for the first time and it is having the suppress context .
But if I add serial number to delivery 123 , I am getting ZE1EDL44 , since it is also having ZE1EDL37 parent.
How can I make sure when Z1EDL44 creates, it is executed for the right context? .
Please correct me If I am wrong here.
Any thoughts..
Collins
Hello Collins,
Since this is a
Root - 0..unbounded
Child - 0..unbounded
Subchild - 0..unbounded scenario,
Context of Root = number of Context Changes of Child
Context of Child = number of Context Changes of Subchild
In the original example, there are only three unique del item. So its Child should contain at most 3 context changes. It is only on the last context change that (81) E1EDL37 will be created. Now, for its subchild, you may notice that there are 4 contexts in the logic for E1EDL37, three are suppressed and only one has a value. The output logic for E1EDL44 should be at most 4 context changes because each Suppressed from E1EDL37 corresponds to ONE context change in E1EDL44.
So even if I add a serial number to del 123
The output would be 1 E1EDL44 on the first E1EDL37, no output for the next two context change and 4 outputs on the last context change (for 81).
Hope this helps,
Mark
Mark,
I agree to your point above . But I am confused why it is not working for me. Can you try creating E1EDL37 only from the 3rd delivery and see what happens for E1EDL44 then.
I forgot to mention , I am creating one Idoc for each delivery . So when I get multiple records with multiple delivery and their line item,batch details multiple Idocs are created for each delivery.
How segments should be created
IDOC ( 1...9999) 1 delivery per Idoc
|
E1EDL20 ( 1...9999) ONLY 1 segment per Idoc
|_______E1EDL18
|_______E1EDT13
|_______E1EDL24 (0...9999) multiple segments per line item for a delivery
| |_______E1EDL11 (for serialize items only)
| |_______E1EDL19
|_______E1EDL37 (0...9999) multiple segments created for each tote
| |_______E1EDL44 (0...9999) multiple segments created for each line item under each tote
|_______ZE1EDL37 (for serialized items only) (0...9999) multiple segments created for each tote
|_______ZE1EDL44 (for serialized items only) (0...9999) multiple segments created for each line item under each tote
Everything works above except for ZE1EDL44 segment below...
Regards,
Collins
Mark,
I was trying the above 'formatByExample' based on the below logic below till now
Serial --->
formatByExample
Del
+ ----->
LineItem
+
Serial
I changed mine as yours and it is working now.
How do you decide to try the formatByExample based on Serial# and Del+ToteId combination instead of mine above.
The reason I did above is since the requirement was " create as many segments for each line item and serial# combination based on serial# not blank
Thanks Again,
Collins
Mark,
I need your help again . The above mapping for E1EDL44 segment is created based on a condition .
What if I need to create the segment without a condition ? E1EDL44 segment needs to be created under each E1EDL37 based on number of line items for each tote.
The output based on above source would be
IDOC
|E1EDL20
|E1EDL37 = 8123
|E1EDL44=10
|E1EDL44=20
IDOC
|E1EDL20
|E1EDL37 = 8123
|E1EDL44=10
|E1EDL44=20
|E1EDL37 = 8124
|E1EDL44=10
IDOC
|E1EDL20
|E1EDL37 = 810
|E1EDL44=10
|E1EDL44=20
Thanks,
Collins V
Mark,
Thank you again . How did you decide that you need to change the logic for E1EDL37 to get the mapping output for E1EDL44 ?
I have another field HIPO which is not working properly ...
IDOC ( 1...9999) 1 delivery per Idoc
|
E1EDL20 ( 1...9999) ONLY 1 segment per Idoc
|_______E1EDL24 (0...9999) multiple segments per line item and batch# combination for a delivery
|
The output should be as follows for a delivery Idoc
IDOC (Del#124)
|
E1EDL20
|_______E1ED24
|____HIPO = 10
|_______E1ED24
|____HIPO = 10
|_______E1ED24
|____HIPO = <Blank>
can you help me over here..
I have the same question in another thread http://scn.sap.com/thread/3202668
Thanks,
C
Hi,
So if I got it right, you want ZE1EDL37 to be created for each unique combination of Del# and ToteID, that has non-empty Serial#, is that correct? If so, here is how I would do that:
Serial -> mapWithDefault("") -> equalsS(constant("")) ->
ifWithoutElse -> splitByValue(Value Change) -> collapseContexts -> ZE1EDL37
concat(Del, ToteID, separator ":") ->
Regards,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I just had a quick review of the mapping and here is what it was missing:
- in the condition check for "ifWithoutElse", the negation was missine
- also, I forgot to mention that the context of the source fields should be switched to the header (delivery) level.
See the complete mapping now, I have already tested it on your example data and it works fine:
Regards,
Greg
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.