Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

sort the datacontainer based on 4 th column

Former Member
0 Kudos
240

Hi,

the datacontainer has 5 fields such as

subty begda endda pernr telnr

separated by #.

I need to sort this data container based on pernr(4th column).

Is it possible to do this..? if it so guide me..

Thanks in advance.

7 REPLIES 7

former_member156446
Active Contributor
0 Kudos
222

sort by 4thfield.

Former Member
0 Kudos
222

Hi,

Populate an internal table from this data container using split...

then sort that internal table based on that fields..

Reward if helpful..

GAURAV J.

0 Kudos
222

since am moving the data container to application server i dint populate that to internal table and also number of fields available in data container will be unknown till the user uploads... so how is it possible to do it..?

0 Kudos
222

Hi try this,

in your start routine, you can sort a data_package with

sort data_package by <component name1>.... <component name n>.

Additionally you can append new records to it with

append <specified workarea> to data_package.

Please check out the F1-help for the statements additionally. You get a lot more information about the use of the statements.

kind reward,

Gaurav J.

0 Kudos
222

actually the program loads the data container using GUI_UPLOAD from the text file in presentation server.

So, we need to sort it after uploading..? then , how do we do it..?

0 Kudos
222

hi,

i find this addition to the sort statment in 6.0 ECC.

try this way.


DATA: BEGIN OF datacontainer OCCURS 0,
        string(100),
      END OF datacontainer.

  datacontainer-string = '0001#19990101#99991231#99999999#122222'.
  APPEND datacontainer.
  datacontainer-string = '0001#19990101#99991231#98888889#122222'.
  APPEND datacontainer.
  datacontainer-string = '0001#19990101#99991231#88888999#122222'.
  APPEND datacontainer.
  datacontainer-string = '0001#19990101#99991231#99988888#122222'.
  APPEND datacontainer.

SORT datacontainer ASCENDING BY string+23(8).

regards

Marco

0 Kudos
222

Hi Tarani

As per my previous post sort by <4th_field> will help ur requirement.

upload using gui_upload.

sort using ur 4th field..

then loop the table

open dataset

transfer

close dataset

endloop.

your file in app server will be sorted with 4th field.