Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Sort Segments data before Mapping?

Hey all,

I'm working on an 856 EDI with this structure:

- E1EDL37 [Pack Level]

- - E1EDL44 [Item Level (many details for every pack)

In this structure i have a code that determinates a message split for every unique code, everything looks ok, but, when i get an order like this:

E1EDL37-EXIDV2: "1132"

E1EDL37-EXIDV2: "2138"

E1EDL37-EXIDV2: "3319"

E1EDL37-EXIDV2: "1132" <-- repeated and not in order

- I can't sort the item levels correctly [EDL44]

- I only sort correctly the EDL37 order (since i'm mapping within "VHILM_KU" which is a customer material code, i sort the structure like this:

EXIDV2 ===>

VHILM_KU ===> SortByKey ===>SplitByV [Each] => "HP"

But when i need to map the item level i don't know how to sort it (I need to map E1EDL44-MATNR, POSNR, CHARG, etc), since i can't use the E1EDL37-EXIDV2 as key since this belong to other other queue

Example:

E1EDL37 [EXIDV2 => 1132]

E1EDL44-POSNR = 1

E1EDL37 [EXIDV2 => 2138]

E1EDL44-POSNR = 2

E1EDL44-POSNR = 3

E1EDL37 [EXIDV2 => 1132]

E1EDL44-POSNR = 4

I would need to sort it and then map like this:

E1EDL37 [EXIDV2 => 1132]

E1EDL44-POSNR = 1

E1EDL37 [EXIDV2 => 1132]

E1EDL44-POSNR = 4

E1EDL37 [EXIDV2 => 2138]

E1EDL44-POSNR = 2

E1EDL44-POSNR = 3

My map is like this:

E1EDL37 ---> . "G_HI" [0.unbounded]

. "HP" [0.unbounded

[ with the sort i mentioned, and pack data]

E1EDL44 -


> . "HI" [0.unbounded] [Item level data within]

Any ideas?

Thanks!

Former Member
Former Member replied

Refer following link to have some idea on Advance UDF.

difference between Simple and Advance UDF

Advanced UDF

When you create new UDF with type "Queue", all the input would be available as array inside UDF.

Than you can loop around that element.

f.e.

for (int i = 0 ; i < Input.length;i++)

{

// Write your sort logic here , search on google and you would find many sorting algo in Java.

// Add sorted element in result.

result.addValue (SortedElement);

}

Thanks & Regards,

Dijesh Tanna.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question