cancel
Showing results for 
Search instead for 
Did you mean: 

File to IDOC - SORT first

Former Member
0 Kudos

Hi experts,

I have a file to idoc scenario.

Before mapping the file to the idoc fields, I would like to sort the data received in the file first.

The file is formatted like this (i created my MT according to the target idoc):

root 1..1

> E1KOMG 1..unbounded

>> FIELD1 0..1

>> FILED2 0..1

>>> E1KONH 1..unbounded

>>>> FIELD3 0..1

>>>> CONDITION 0..1

>>>>> E1KONP 1..unbounded

>>>>>> FIELD4 0..1

So I created a first mapping from this MT above to the same MT. My requirement is that I want all the segments E1KOMG that contains the field CONDITION (filled with 'X') first.

As example :

i receive in the file :

root 1..1

> E1KOMG

>> FIELD1 = AAA

>> FILED2 = AAA

>>> E1KONH

>>>> FIELD3 = AAA

>>>> CONDITION = ' ' (empty)

>>>>> E1KONP

>>>>>> FIELD4 = AAA

> E1KOMG

>> FIELD1 = BBB

>> FILED2 = BBB

>>> E1KONH

>>>> FIELD3 = BBB

>>>> CONDITION = X

>>>>> E1KONP

>>>>>> FIELD4 = BBB

> E1KOMG

>> FIELD1 = CCC

>> FILED2 = CCC

>>> E1KONH

>>>> FIELD3 = CCC

>>>> CONDITION = ' ' (empty)

>>>>> E1KONP

>>>>>> FIELD4 = CCC

> E1KOMG

>> FIELD1 = DDD

>> FIELD2 = DDD

>>> E1KONH

>>>> FIELD3 = DDD

>>>> CONDITION = X

>>>>> E1KONP

>>>>>> FIELD4 = DDD

as result, im looking for :

root 1..1

> E1KOMG

>> FIELD1 = BBB

>> FILED2 = BBB

>>> E1KONH

>>>> FIELD3 = BBB

>>>> CONDITION = X

>>>>> E1KONP

>>>>>> FIELD4 = BBB

> E1KOMG

>> FIELD1 = DDD

>> FILED2 = DDD

>>> E1KONH

>>>> FIELD3 = DDD

>>>> CONDITION = X

>>>>> E1KONP

>>>>>> FIELD4 = DDD

> E1KOMG

>> FIELD1 = AAA

>> FILED2 = AAA

>>> E1KONH

>>>> FIELD3 = AAA

>>>> CONDITION = ' ' (empty)

>>>>> E1KONP

>>>>>> FIELD4 = AAA

> E1KOMG

>> FIELD1 = CCC

>> FIELD2 = CCC

>>> E1KONH

>>>> FIELD3 = CCC

>>>> CONDITION = ' ' (empty)

>>>>> E1KONP

>>>>>> FIELD4 = CCC

I tried with a 'sort by key' based on the field CONDITION, but does not seem to do anything...

Any help would be greatly appreciated,

Kind regards,

Jamal

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

You can use this mapping:



CONDITION --> removeContext --> sortByKey: lexicographical case insensitive descending --> target
                                           /
source field ----> removeContext -------->/

Hope this helps,

Regards,

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You have to go in two steps.

Step 1. File to XSLT mapping in which you will do sorting.

Step 2. XSLT to IDOC mapping.

Regards,

Sarvesh