cancel
Showing results for 
Search instead for 
Did you mean: 

WD ALV Settings for personalization

Former Member
0 Kudos

Hi experts,

within an ALV I want the user to personalize the columns of the ALV. Subsequently I needed to programmatically find out, which columns were selected in order for me to adjust the linked graphic to the selected columns.

Where would I find the info regarding the selected columns? All hints are higly appreciated.

Cheers, Rene

Accepted Solutions (1)

Accepted Solutions (1)

Ulli_Hoffmann
Contributor
0 Kudos

Hi Rene,

IF_SALV_WD_COLUMN_SETTINGS=>GET_COLUMNS should do the trick.

regards Ulli

Former Member
0 Kudos

Hi Ulli,

unfortunately not that easy, even though I'd like it very much. GET_COLUMNS would return all columns of my ALV. What I really want though is only the columns, which have been selected by the user via the 'Setting' link - during personilization.

Any ideas??

Regards,

Rene

Faaiez
Advisor
Advisor
0 Kudos

Rene

You can use the following code to find out which columns have been selected:

  
  DATA:
    lt_SALV_WD_T_COLUMN_REF TYPE SALV_WD_T_COLUMN_REF,
    wa_SALV_WD_COLUMN_REF   TYPE SALV_WD_S_COLUMN_REF,
    l_fieldname             TYPE string,
    l_tabix                 TYPE sytabix.

  field-symbols <column> type any.

CALL METHOD wd_this->SALV_CONFIG->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMNS
    RECEIVING
      VALUE = lt_SALV_WD_T_COLUMN_REF.

* itSelectedData contains the data in the ALV
  loop at itSelectedData into isSelectedData.
    l_tabix = sy-tabix.
    loop at lt_salv_wd_t_column_ref into wa_salv_wd_column_ref.
      concatenate 'ISSELECTEDDATA-' wa_salv_wd_column_ref-id into l_fieldname.
      assign (l_fieldname) to <column>.
*     Is the column invisible
      if wa_salv_wd_column_ref-r_column->visible = '01'.
        clear <column>.
        modify itSelecteddata from isSelecteddata index l_tabix.
      endif.
    endloop.
  endloop.

Regards

Answers (0)