cancel
Showing results for 
Search instead for 
Did you mean: 

ALV: Find out order of columns

daniel_humberg
Contributor
0 Kudos

I have an ALV embedded into my WDA components.

Now, i want to find out all the visible columns of the ALV in the right order.

The user could have personalized the order of the column (even by drag&drop), so I want to read the list of columns of the current user, even when he/she personailzed it.

Is this possible?

I tried the following code, but I did not sort the columns as expected.


  lt_alv_columns = ir_alv_config_table->if_salv_wd_column_settings~get_columns( ).
  SORT lt_alv_columns BY r_column->position.

Accepted Solutions (1)

Accepted Solutions (1)

martin_voros
Active Contributor
0 Kudos

Hi,

maybe I am missing something but the class cl_salv_wd_column has methods GET_POSITION and SET_POSITION which you can use to get and set column position in ALV. The method if_salv_wd_column_settings~get_columns returns a table of references to object with type class cl_salv_wd_column.

Cheers

Answers (2)

Answers (2)

daniel_humberg
Contributor
0 Kudos

Hi Martin,

GET_POSITION and SET_POSITION in deed returns the right field position, even it is personalized. I was jsut confused by the fact that hidden fields get the position "0" and are listed on top when you sort by position.

Former Member
0 Kudos

Might not be straight forward. Portal Maintains the personalization data for each user,you might need a Java Portal components to first read it? and know what are the columns available for this user...so if your application is accessed via portal this might be way to start.

Else May be you can try to post question asking where is the WebDynpro ABAP user Personlization data stored ?

Greetings

Prashant