Skip to Content
0
Oct 23, 2019 at 06:34 PM

SAP PI Mapping multiline text

344 Views

Hello SAP PI experts,

In a context of PO integration I have the below input in SAP PI which I would like to map with the associated output.

The issue is that :

  1. When simply sending the input to the output field in mapping definition, I just have the first line from the first item whichi is retrieved
  2. When removing context on the <POString> and trying to send the result to the output, all lines from both item are retrieved for each line of the output

I am open to any suggestion. Solution can be using User Defined functions or mapping "tricks".

Thanks in advance

INPUT:

<item>
  <SAPOrderInfo>
    <item>
        <index>0</index>
        <NumberOnPOString>00001</NumberOnPOString>
        <POString>item 1 line 0</POString>
    </item>
    <item>
        <index>1</index>
        <NumberOnPOString>00001</NumberOnPOString>
        <POString>item 1 line 1</POString>
    </item>
    <item>
        <index>2</index>
        <NumberOnPOString>00001</NumberOnPOString>
        <POString>item 1 line 2</POString>
    </item>
  </SAPOrderInfo>
</item>
<item>
  <SAPOrderInfo>
    <item>
        <index>0</index>
        <NumberOnPOString>00002</NumberOnPOString>
        <POString>item 2 line 0</POString>
    </item>
    <item>
        <index>1</index>
        <NumberOnPOString>00002</NumberOnPOString>
        <POString>item 2 line 1</POString>
    </item>
    <item>
        <index>2</index>
        <NumberOnPOString>00002</NumberOnPOString>
        <POString>item 2 line 2</POString>
    </item>
  </SAPOrderInfo>
</item> 

OUTPUT:

<item>
    <TEXT_LINE>
        item 1 line 0
        item 1 line 1
        item 1 line 2
    </TEXT_LINE>
    <ITEM_NO>00001</ITEM_NO>
</item>
<item>
    <TEXT_LINE>
        item 2 line 0
        item 2 line 1
        item 2 line 2
    </TEXT_LINE>
    <ITEM_NO>00002</ITEM_NO>
</item>