cancel
Showing results for 
Search instead for 
Did you mean: 

Loop or group in Graphical mapping

06-17-2022 4:58 PM
novatojorge Discoverer
2303 views 3 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Hello.

I would like to ask you how can I manage this requeriment with the PI/PO graphical mapping.

I receive something like this:

<record>

<po_number>22</po_number>

<line_number> 1 </line_number>

<text> helllo </text>

</record>

<record>

<po_number>22</po_number>

<line_number> 2 </line_number>

<text> helllo </text>

</record>

<record>

<po_number>33</po_number>

<line_number> 3 </line_number>

<text> helllo </text>

</record>

<record>

<po_number>33</po_number>

<line_number> 4 </line_number>

<text> helllo </text>

</record>

So several equal lines, where we have a value repeated more than once that indicates the po number ( for example ) and the items of that po,every time the po_number changes I have to create a new entity of the target message

<JournalEntryCreateRequest>

<JournalEntry>

<OriginalReferenceDocumentType>22</<OriginalReferenceDocumentType>

<Item>

<ItemGroup>1/<ItemGroup>

<text>helllo</text>

</Item>

<Item>

<ItemGroup>2/<ItemGroup>

<text>helllo</text>

</Item>

</JournalEntry>

</JournalEntryCreateRequest>

<JournalEntryCreateRequest>

<JournalEntry>

<OriginalReferenceDocumentType>33</<OriginalReferenceDocumentType>

<Item>

<ItemGroup>3</ItemGroup>

<text>helllo</text>

</Item>

<Item>

<ItemGroup>4</ItemGroup>

<text>helllo</text>

</Item>

</JournalEntry>

</JournalEntryCreateRequest>

Could you help me?

Thanks,

Jorge.

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

Harish
Active Contributor
0 Likes

Hi Jorge,

You can achieve this using graphical mapping and node functions.

First - Create JournalEntryCreateRequest for a unique PO number

mapping

PO Number --> Remove context --> Split by value (value change) --> Collapse context --> JournalEntryCreateRequest

Second - JournalEntry and OriginalReferenceDocumentType

same mapping with additional split by value (each value)

Third - item

Item Group - Line number

text

mapping result (text is modified with number at the end)

hope this will help!!

regards,

Harish

Answers (2)

Answers (2)

novatojorge
Discoverer
0 Likes

Hi guys again.

I would like to ask you again because my requeriment has changed

Now I receive something like this:

<record>

<po_number>0000055664</po_number>

<ref1> N1 </ref1>

<line_number> 1 </line_number>

<text> helllo </text>

</record>

<record>

<po_number>0000055664</po_number>

<line_number> 2 </line_number>

<text> helllo </text>

</record>

<record>

<po_number>33</po_number>

<ref1> N1 </ref1>

<line_number> 1</line_number>

<text> helllo </text>

</record>

<record>

<po_number>33</po_number>

<ref1> N </ref1>

<line_number> 2 </line_number>

<text> helllo </text>

</record>

And I want to convert it to a header and line strcture like this:

<header>

<Doc_number>0000055664</Doc_number>

<Doc_type>N1</Doc_type>

<items>

<line_number> 1</line_number>

<text> helllo </text>

</Items>

<items>

<line_number> 2</line_number>

<text> helllo </text>

</Items>

<header>

<Doc_number>0000055665</Doc_number>

<Doc_type>N1</Doc_type>

<items>

<line_number> 1</line_number>

<text> helllo </text>

</Items>

<items>

<line_number> 2</line_number>

<text> helllo </text>

</Items>

</header>

So a tipicall structure of header and items message. I have achieved close to everything, doc_number is splitting the header correctly and items are correctly generated, my problem is for example the Doc_type field because it can be repeated in different documents so i cannot do a Spit by value.

For the header I have done this:

and works fine because I generate a <header> for each doc_number

For the doc_numer inside the header i have done this:

And works fine because the last SplitByValue runs perfect because again the value of each document is different

But for doc_type field I have done something similar but it doesnt work because the Doc_type could be the same in different document numbers so it is only generating 1 occurrence of doc_type:

Here all the doc_type are N1 in both doc_numbers so:

After the collapse context we have only 1 value

and after the SplitbyValue only one too:

And I need 2 occurrences, one for each document, If the doc_type of each document would be different it run ok.

Could somebody help me with this?

Thanks

novatojorge
Discoverer
0 Likes

Hi harish.mistri

Thanks for your help. Just one question, why so different mapping for ItemGroup and text fields if they came for fields in the same level of the source file?

Regards,

Jorge