cancel
Showing results for 
Search instead for 
Did you mean: 

Sort all nodes based on key

Former Member
0 Kudos

Hi,

I am working on ASN scenario (IDOC to EDI) to develop the HL loops. But i am facing a problem to sort all the HL loops depending on one unique key. I tried with different way, but could not achieve the same:(

Used a java code, but it fails if there is multiple IDOCs (basically all the HLs of second IDOC will come in the first HL...)

Can someone help me in sorting the entire node using an unique key....

Regards,

Vasantha

Accepted Solutions (0)

Answers (2)

Answers (2)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

set the source field to parent context and something similar to as below

source field and unique key --> removecontext --> sortbykey --> collapsecontext --> target field

Former Member
0 Kudos

Hi Baskar,

Thanks for the quick reply.

This functionality will sort only the individual fields. But I need to sort the entire HL segments.

There will be many segments inside HL segment. There are some elments which are not mandatory. In this case SortBy key will fail to sort based on the key.

I want to sort all the nodes.

Regards,

Vasantha

former_member854360
Active Contributor
0 Kudos

Hi Vasantha ,

This can be easily achive with Contexts.

Please set the context of HL field to IDOC level.

and then use standard SORT function.

Input to SORT function should be.

It basically means all the HL values of a IDOC should be in same context .No context change between them

Contextchnage

1

3 (1st IDOC 3 HL field in Same Coontext)

2

Contextchnage

6

1 (2nd IDOC 3 HL field in Same Coontext)

3

Contextchnage

OUTPUT

Contextchnage

1

2 (1st IDOC 3 HL field after sort)

3

Contextchnage

1

3 (2nd IDOC 3 HL fieldafter sort)

6

Contextchnage

Former Member
0 Kudos

Hi,

Thanks for the quick reply. But it may not work for me, since I have many Pack and item level. It will be SO PI PI PII ... level.

I tried with the same (with context change), but it didnt work for me. For item level HL loop, i need to have the context E1EDL44 segments.

Regards,

Vasantha

former_member854360
Active Contributor
0 Kudos

Hi,

Please provide your input data and which field you want to sort exactly.

also can you ellaborate your requirement.

I will try to give you a solution

Former Member
0 Kudos

Hi,

Here is the requirement...

It is an EDI ASN development with SOPI structure.. For each E1EDL37 segment there will be "P" segment and for Each E1EDL44 there will be an "I" segment. E1EDL44 can be multiple with in E1EDL37. so it can be SOPII, PI ...

I have one map that will ceate the HL segment as SOPPP.. IIII... with the unique key. basically the corresponding P and I will have the same key. In my second map, i would like to sort the HL segments, so that it will be SOPIPI.. (corresponding P and I will come together).

Hope you got the requirement now. Let me know if you need more information.

Regards,

Vasantha

Former Member
0 Kudos

Thanks All. I have achieved this using Java mapping.

Closing this form...

Regards,

Vasantha