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: 

How are columns names sorted in "Change ALV layout" screen?

Former Member
0 Kudos

I'm noticing that when I go to "change layout" of an ALV that the columns seem to be randomly sorted and now sorted based on the order of fields in the structure being displayed.

They also don't seem to be sorted by data type.

Does anyone have any insight on how these fields are sorted in the "change layout" screen? I'd much rather have them appear in the order they are in the structure.

Otherwise the user has to individually place each column.

9 REPLIES 9

Former Member
0 Kudos

They are in the same order as defined in the field catelog. Field catelog structure has a field to specify the column number.

However, an ALV display variant overrides everything. Check if there is a default ALV variant setup with different column positions.

0 Kudos

Sorry, I forgot to mention that I'm talking about the "hidden columns" on the right side of the "change layout" screen.

I'd like to have these presented in the correct order so that when a mass group of them is brought to the "shown" side they are already in the right order.

However, their order seems random.

0 Kudos

You can group the fields in the ALV Field Catalog by setting a value for SP_GROUP in Grid Control.

This should solve your problem of the hidden columns when moved to display as they will be grouped together.

The Right side fields which are hidden will always be in the same order as the structure which you have used to create the Field catalog.

0 Kudos

Nazim, can you tell me where to find and set this SP_GROUP flag?

0 Kudos

Are you using ALV Grid Control - OOP? or normal ALV?

Loop at your fieldcatalog and for the fields which you need to group, set the value for SP_GROUP = 'GRP1' for these fields and modify it.

example:

loop at l_fcat.

case l_fcat-fieldname.

when 'FIELD1'.

l_fcat-sp_group = 'GRP1'.

modify l_fcat.

.

.

.

ENDCASE.

ENDLOOP.

Message was edited by:

Nazim

0 Kudos

OOP.

0 Kudos

Please see my previous message which I have modified.

0 Kudos

That did not work. I have a feeling that I also have to populate it_special_groups when calling set_table_for_first_display.

0 Kudos

I found this note. SP_GROUP can only apply up to 5 columns. Thanks for the attempt, but this is obviously not the solution.

"If in the field catalog the columns were grouped together with field SP_GROUP, you must pass a table with texts for these groups. On the current layout window, it is then possible to use a list box to restrict column selection to one of these groups."