cancel
Showing results for 
Search instead for 
Did you mean: 

sort a file by a field of a line

Former Member
0 Kudos

Hi all,

I need to sort a file by a field of a line. An example :

I have the csv file:

field1;field2;field3

1;2;3

7;3;1

4;1;2

and i must sort these lines using the field2. So the result is:

field1;field2;field3

4;1;2

1;2;3

7;3;1

I try to use the sort fonction (in the SP13), but it don't work. I read and apply some examples on SAP .pdf but it don't (again) work.

I try:

with the structure of message:

file

line 1..unbouded

field1 0..1

field2 0..1

field3 0..1

field2 -> sort(Numerical)->splitByValue(EachValue)->collapseContexts->line

field2->sort(Numerical)->splitByValue -> collapseContexts ->splitByValue(EachValue) -> field2

It don't work.

Anybody could help me and give the mapping which work ?

Accepted Solutions (0)

Answers (2)

Answers (2)

stefan_grube
Active Contributor
0 Kudos

What about

field1 -> line

field2 - removeContext - sort - splitByValue - field2

field2 - removeContext \

field1 - removeContext - sortByKey - splitByValue - field1

field2 dito

Regards

Stefan

Former Member
0 Kudos

Hi

The following blog explains generic content sorting using Java mapping,

/people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping

see if it helps.

cheers

Sameer