cancel
Showing results for 
Search instead for 
Did you mean: 

how to map two different segment fields into one receiver segment field

08-20-2020 1:28 PM
2077 views 7 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Hi Guys,

I am getting IDoc with two different segments like Delivery change and Delivery Delete from ECC and send those details to 3rd party(Rest adapter). My challenge here, I need to populate both Delivery change and Delete details like shown below Json format. Is there any possibility to get mentioned Json?/ how to map both segments to items node same time?

Two segments:

<E1BPOBDLVITEMCHG>

<DELIV_NUMB>123456

<DELIV_ITEM>01

<DLV_QTY>48.00

<E1BPOBDLVITEMCTRLCHG>

<DELIV_NUMB>789456

<DELIV_ITEM>11

<DEL_ITEM>X

Receiver structure:

<Record>

<DELIVERY>

<Items>

<DELIV_NUMB>

<DELIV_ITEM>

<DLV_QTY>

<DEL_ITEM>

</Items>

</Record>

Expected JSon: In mentioned Json format Record node ignored.

[
{
"DELIVERY": "0082598790",
"Items": [ {

"DELIV_NUMB":"789456"

"DELIV_ITEM": "11",
"DEL_ITEM": "X"
}
{

"DELIV_NUMB":123456

"DELIV_ITEM": "01",
"DLV_QTY": "48.000"
}
]
}
]

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

Shashi_Bhushan_Kumar
Active Participant
0 Likes

for(int i = 0; i<var1.length;i++){
result.addValue(var1[i]);
}

for(int j = 0; j<var2.length;j++){
result.addValue(var2[j]);
}


Hi Shashi Bhushan,

I did exactly what you mentioned and my requirement fulfilled. I am grateful for you.

Thankyou

Answers (3)

Answers (3)

Shashi_Bhushan_Kumar
Active Participant
0 Likes

Let me do it for you and then I will send the mapping screenshot.

Shashi_Bhushan_Kumar
Active Participant
0 Likes

Yes, that's how you will get item node. you need to arrange DLV_QTY and DEL_ITEM accordingly.

0 Likes

Hi Shashi Bhushan,

Please check below screenshot. Here DELIV_ITEM populate in two segments, But i am not able to populate both fields in receiver structure.

Shashi_Bhushan_Kumar
Active Participant
0 Likes

Hi,

Yes, Create both field in target as you did already for target structure.

Now put if without else condition and suppress the target field name when ever you do not need them.

0 Likes

Hi Shashi Bhushan,

Thank you for your response. But in my scenario, both Delete and change segments will populate multiple times and need to send those two segments to target. So i am not able to map both segments to target structure. Can we map E1BPOBDLVITEMCHG, E1BPOBDLVITEMCTRLCHG segments to receiver Items segment and populate all fields( Change and Delete)???