Application Development and Automation 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: 
Read only

Sorting two columns simultaneously in alv repot

Former Member
0 Likes
1,132

o/p should look like this:

gl account materialno

40000 4

40000 4

40000 4

40000 a

40000 a

40001 4

40001 4

40001 4

40001 b

40001 b

i need the answer as soon as possible with coding.

bye for now ,

sivagopal.

5 REPLIES 5
Read only

Former Member
0 Likes
657

SORT itab by GLACCOUNT MATERIALNO.

This should fix your issue.

If the issue is the columns the same data getting merged, the in the layout of the ALV, there should be MERGE attribute, make sure that is empty.

regards,

Ravi

Note - Please mark the helpful answers

Message was edited by:

Ravikumar Allampallam

Read only

Former Member
0 Likes
657

Hi,

Check this,

Step1 : Add data declaration for sort catalogue

data: it_sortcat type slis_sortinfo_alv occurs 1,

wa_sort like line of it_sortcat.

Step 2. Add code to build sort catalogue table

wa_sort-spos = 1.

wa_sort-fieldname = 'EBELN'.

  • gd_sortcat-tabname

APPEND wa_sort TO it_sortcat.

wa_sort-spos = 2.

wa_sort-fieldname = 'EBELP'.

  • gd_sortcat-tabname

APPEND wa_sort TO it_sortcat.

Keep u r field names instead of EBELN and EBELP

Step 3. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include parameter 'it_sort',

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

  • is_layout = gd_layout

it_fieldcat = fieldcatalog[]

it_sort = it_sortcat

i_save = 'X'

tables

t_outtab = it_ekko

exceptions

program_error = 1

others = 2.

Keep u r internal table instead of it_ekko

Read only

Former Member
0 Likes
657

Hi,

use sort command before passing final table to alv Fm

sort itab by acct matnr.

default sort will be ascending you also also use

sort itab by acct matnr descending

REgards

amole

Read only

Former Member
0 Likes
657

before passing your intenal table to alv,

sort the internal table by glaccount materialno

sort itab glacc matno.

it will solve your problem

Read only

0 Likes
657

Hi,

In ALV display, hold down the conrol key, mark the columns to be sorted by clicking on the top of each columns, click the SORT icon.

Then save the actual order as an ALVstandard layout (name starts with /).

Goto menu, layout administration, mark the layout as default, save.From this menu, you can also transport the layout to target system. Depending on your release, after transport it may be not marked as default layout. In this case you have to do it in target system.

This way you stay flexible.

Regards,

Clemens