Hi experts,
I'm a newcomer here and would like to seek your advice regarding the mapping issue I'm facing.
Basically, I have an IDOC as source and need to send multiple IDOCs based on values of a certain field. I'm quite familiar with multi mapping (0..unbounded in Signature) but struggling with the current requirement. The structure of the IDOC is as follows:
ZDOC
IDOC BEGIN
HEADER SEGMENT 0..1
MANDT 0..1
ITEM 0..1
ITEMS 0..unbounded
ID 0..1
NAME 0..1
GROUP 0..1
Here's an example of source with values:
ZDOC
IDOC BEGIN = "1"
HEADER SEGMENT = "1"
MANDT XYZ
ITEM
ITEMS
ID 1
NAME Paul
GROUP 123
ITEMS
ID 2
NAME John
GROUP 456
ITEMS
ID 3
NAME Matthew
GROUP 123
The requirement is to create target IDOCs based on the Group. So after mapping since there are 2 unique Group IDs, 2 target IDOCs must be created. The target IDOCs must have the same header but different item.
IDOC 1:
ZDOC
IDOC BEGIN = "1"
HEADER SEGMENT = "1"
MANDT XYZ
ITEM
ITEMS
ID 1
NAME Paul
GROUP 123
ITEMS
ID 3
NAME Matthew
GROUP 123
IDOC 2:
ZDOC
IDOC BEGIN = "1"
HEADER SEGMENT = "1"
MANDT XYZ
ITEM
ITEMS
ID 2
NAME John
GROUP 456
I think my mappings for ZIDOC and IDOC are ok.
ZIDOC:
GROUP -> RemoveContext -> Sort -> SplitByValue (Value Change) -> collapseContext -> ZIDOC
IDOC:
GROUP -> RemoveContext -> Sort -> SplitByValue (Value Change) -> collapseContext -> SplitByValue (Each Value) -> IDOC
Problem I'm facing now is for the mapping of BEGIN and HEADER field. I always end up with value missing in queue context. Tried to look for resources here but couldn't find any. I hope you can help me or direct me to any existing related discussions.
Thank you very much.
Regards Mike