cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro ALV - get Columns of selected Variant

former_member193202
Participant
0 Kudos

hi folks,

we use the personalization manager to set a start-up variant for displaying data in WD Abap ALV.

However, now we need the possiblity to get the columns shown on the screen (of that variant).

Using the functions like

lr_column_settings ?= wd_this->go_table.

lt_columns = lr_column_settings->get_columns( ).

on my config-table i always get ALL columns in the order of the Table i submitted to the ALV component.

What we need is as mentioned above to get the columns in order that are on the screen at the moment (or of that variant).

does anyone has a hint for me how to do that.

kind regards,

oliver

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member193202
Participant
0 Kudos

on my own

Former Member
0 Kudos

Hi Oliver,

I have similar situation which requires to get the columns of the selected variant in ALV in webdynpro. Please provide me hint how you are able to get the columns.

Thanks for your help,

Prasad

former_member193202
Participant
0 Kudos

Hi Prasad,

it's long time ago and i am not sure if we maybe implemented in another way. but i guess and that works, you have to give the alv you show a configuration-id (e.g. a configuration with that you have stored variants ) like that coding:

data io_alv type ref to iwci_salv_wd_table.

io_alv is the alv you are showing

io_alv->get_config_data( ls_par_in ).

where ls_par_in is coded sth like that.

*... set new configuration key
data

ls_par_in   TYPE if_salv_wd_table=>s_type_param_config_in.


  ls_par_in-action                 = if_salv_wd_table=>set.

  ls_par_in-config_key-config_type = '08'.

  ls_par_in-config_key-config_id   = lv_key_hash.

after that with coding like:

- wd_this->go_alv type ref to CL_SALV_WD_CONFIG_TABLE

wd_this->go_alv = lo_salv_wd_table->get_model( ).

then catching the columns you would get the correct columns of the variant you get with get_config_data

you get the mode of the alv

hope that helps you

regards oliver

Former Member
0 Kudos

Thanks Oliver for the quick reply,

I tried the below code I am getting the variant right, but not the columns associated with the variant.

I get all the columns. Please check if I am missing anything,

      DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .

      lo_INTERFACECONTROLLER =   wd_this->wd_cpifc_em_list_alv( ).

      data: lo_api_interfacecontroller type ref to IF_WD_CONTROLLER,

            lo_pers TYPE REF TO if_wd_personalization,

            lt_pers_table_ref TYPE REF TO IF_WD_PERS_TABLE,

            lt_pers_table TYPE STANDARD TABLE OF WDR_PERS_DATA.

      lo_api_interfacecontroller = lo_INTERFACECONTROLLER->wd_get_api( ).

        CALL METHOD lo_api_interfacecontroller->get_personalization_manager

          RECEIVING

            pers_manager = lo_pers.

        DATA: ls_config_key type WDY_CONFIG_KEY,

              ls_PERS_SCOPE TYPE WDR_PERS_SCOPE,

              ls_loaded TYPE WDY_BOOLEAN,

              ls_desc TYPE WDY_MD_DESCRIPTION.

        CALL METHOD lo_pers->GET_STATE

          IMPORTING

            CONFIG_KEY  = ls_config_key

            PERS_SCOPE  = ls_PERS_SCOPE

            IS_LOADED   = ls_loaded

            DESCRIPTION = ls_desc. -> Gives me the Variant info

      data: ls_param_in type if_salv_wd_table=>s_type_param_config_in,

            lv_s_param_out TYPE if_salv_wd_table=>s_type_param_config_out,

        LS_r_model type ref to cl_salv_wd_config_table.

      ls_param_in-action = if_salv_wd_table=>set.

      ls_param_in-config_key = ls_config_key.

      ls_param_in-is_model_requested = 'X'.

      lv_s_param_out = lo_interfacecontroller->get_config_data(

        s_param_in =  ls_param_in                    

      ).

   

    LS_r_model = lv_s_param_out-r_model.

      data: lr_column_settings type ref to if_salv_wd_column_settings,

            lt_columns TYPE STANDARD TABLE OF SALV_WD_S_COLUMN_REF.

      lr_column_settings ?= LS_r_model.

      lt_columns = lr_column_settings->get_columns( ). -> this gives me all columns, not columns associated to variant

Regards,

Prasad

former_member193202
Participant
0 Kudos

I guess we also never solved that problem and did some workaround or never needed this in particular. but have a look at class CL_SALV_WD_PERSISTENCE i think here is the handling of loading /saving layouts so maybe there you can find out how to get this problem solved.

regards oliver

former_member193202
Participant
0 Kudos

have a look at CL_WDR_CFG_PERSISTENCE_UTILS method read_comp_pers_from_db.

you get to a given config id an xml and an internal table with all configuration details, also with columns and the behavior of them

Former Member
0 Kudos

Hi Oliver, Sorry I was kind of tied up and not able to reply early. I found the columns and its position info, I would like to share. It is the continuity of the code what I have replied before. We have to get the reference of the individual columns and call the method get_position( ) that gives the position info based on current state of the personalization ref. object.

Thanks for all your input.

Prasad