cancel
Showing results for 
Search instead for 
Did you mean: 

Context Handling - Message Mapping

10-17-2018 6:59 PM
jayaraj2018 Product and Topic Expert
738 views 1 comments
0 Likes
SAP Managed Tags
Subscribe

Hi,

I am working on a Flat -> IDoc conversion mapping. I have scenario where i need to aggregate on a field called 'Type' in 'InvoiceLines' segment. That is, for each unique value in the 'Type' field, i would need to generate a E1BPACTX09 segment in the target idoc.


Please see the screen below.

Here there are 2 'Record' segments in my input file, hence 2 iDoc segments on the output. In the first record there are 3 'InvoiceLines' segment with values in 'Type' field as 'C1', C2' and 'C2' respectively. Now as there are only 2 unique Type field values (C1 & C2), i need to generate only 2 E1BPACTX09 segment. This works fine for the first record set as shown in the screenshot above.


But the 'InvoiceLines' segment in the 2nd 'Record' is not generating any E1BPACTX09 segment when it is supposed to.


Below is the mapping on this segment for your reference.


When i did a Display queue on this 'Type' field, it only shows the C1, C2, C2 values in the 'InvoiceLines' from the 1st 'Record' but also the 'C2' value from the InvocieLines in the 2nd record.

'Sales_Invoice_Request' is mapped to 'ACC_DOCUMENT04'

'Record' is mapped to 'IDOC'

If there is someway where i can map the InvoiceLines segment with E1BPACTX09 segment and then again apply the above shown mapping logic, then i believe i can achive the solution. Some kind of Segment Encapsulation.

Please let me know if there is a better approach than this.

0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

jayaraj2018
Product and Topic Expert
Product and Topic Expert

Hi,

We managed to fix the issue as shown below. An UDF to remove the duplicate values in field 'Type' is used as a context formatter.

Please see the screen below.