cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically determine personalisation view in SALV

wouter_peeters
Participant
0 Kudos

Hello experts,

I'm trying to dynamically determine a personalisation view ( set in Administrator mode, so everyone can use it )

It is working, but it is not updating the selected View. In the text box of selected view the Default view is still showing, not the one I selected by programming.

I used this SAP Help:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/93/47854a8366474f8bedabdcc43b2387/content.htm?frameset=/en/43/5f9c292a2b5f85e10000000a1553f6/frameset.htm

This is my code:

DATA: lt_alv_views          TYPE wdr_pers_variants,

         ls_alv_view           TYPE wdr_pers_variant,

         ls_param_out          TYPE if_salv_wd_table=>s_type_param_config_out,

         ls_param_in           TYPE if_salv_wd_table=>s_type_param_config_in,

         ls_customer           TYPE zmm_s_kunnr_name,

         lv_customer_country   TYPE vkorg.

     " List views

     ls_param_in-action = if_salv_wd_table=>list.

     ls_param_out = io_if_salv_table->get_config_data( ls_param_in ).

     lt_alv_views[] = ls_param_out-t_view_list[].

     " Load view

     ls_param_in-action = if_salv_wd_table=>load.

     READ TABLE lt_alv_views[] INTO ls_param_in-view WITH KEY config_var = 'P1ILNX'.

     IF sy-subrc EQ 0.

       ls_param_out = io_if_salv_table->get_config_data( ls_param_in ).

     ENDIF.

Can anyone help me out how to 'refresh' the selected personalisation view in the SALV?

Thanks in advance!

Kind regards,

Wouter

Accepted Solutions (1)

Accepted Solutions (1)

guillaume-hrc
Active Contributor
0 Kudos

Hi,

Following works for me:

  DATA: lt_alv_views            TYPE wdr_pers_variants,

        ls_param_out            TYPE if_salv_wd_table=>s_type_param_config_out,

        ls_param_in             TYPE if_salv_wd_table=>s_type_param_config_in.

  FIELD-SYMBOLS: <ls_alv_view>  TYPE wdr_pers_variant.

  ls_param_in-action = if_salv_wd_table=>list.

  ls_param_out       = lo_comp_if_alv->get_config_data( ls_param_in ).

  lt_alv_views[]     = ls_param_out-t_view_list[].

  READ TABLE lt_alv_views ASSIGNING <ls_alv_view> WITH KEY description = 'FULL'.

  IF sy-subrc = 0.

    ls_param_in-action = if_salv_wd_table=>set.

    ls_param_in-view   = <ls_alv_view>.

    MOVE-CORRESPONDING <ls_alv_view> TO ls_param_in-config_key.

    ls_param_out       = lo_comp_if_alv->get_config_data( ls_param_in ).

  ENDIF.

Best regards,

Guillaume

wouter_peeters
Participant
0 Kudos

Indeed Guillaume that works, Thanks!

On a side note: I use the key config_var as it seems the only unique key. Description is language dependant.

guillaume-hrc
Active Contributor
0 Kudos

You're absolutely right, it is much safer to use config_var.

Best regards,

Guillaume

Answers (1)

Answers (1)

guillaume-hrc
Active Contributor
0 Kudos

Hi,

Shouldn't the action if_salv_wd_table=>set be used instead of if_salv_wd_table=>load?

Best regards,

Guillaume