Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8533

Re: personalization: if_wd_personalization->load_config_by_key doesn't work

$
0
0

Thank you for the hint, but I cannot see how it can help me, because I do not use "on_std_function_afte". My event is a simple change of a DropDownListBox. And I succeed already - as described - to set default view of the personalization, and also the function

 

 

lo_pers->load_config_by_key is called without an error, but unfortunately the personalization table view of the ALV is not loaded. Perhaps I need start somewhere a refresh of the view or the ALV???

 

Here is the coding:

 

DATA:

     lo_cmp_usage               TYPE REF TO if_wd_component_usage,

     lo_interfacecontroller     TYPE REF TO iwci_salv_wd_table ,

     lo_api_interfacecontroller TYPE REF TO if_wd_controller,

     lo_pers                    TYPE REF TO if_wd_personalization,

     lv_value                   TYPE REF TO cl_salv_wd_config_table,

     lt_var                     TYPE        wdr_pers_variants,

     wa_var                     TYPE        wdr_pers_variant,

     ls_config_key              TYPE        wdy_config_key.

 

   CHECK iv_variant_name IS NOT INITIAL.

 

* Instantiate ALV

   lo_cmp_usage =   wd_this->wd_cpuse_qresult( ).

   IF lo_cmp_usage->has_active_component( ) IS INITIAL.

     lo_cmp_usage->create_component( ).

   ENDIF.

 

* Get the interface controller of the component usage

   lo_interfacecontroller =   wd_this->wd_cpifc_qresult( ).

 

* Get the model object of ALV

   IF lo_interfacecontroller IS NOT INITIAL.

     lv_value = lo_interfacecontroller->get_model( ).

*   Get the API reference

     lo_api_interfacecontroller = lo_interfacecontroller->wd_get_api( ).

   ENDIF.

 

* Get personalization obect

   IF lo_api_interfacecontroller IS NOT INITIAL.

     lo_pers = lo_api_interfacecontroller->get_personalization_manager( ).

   ENDIF.

* Get variants

   IF lo_pers IS NOT INITIAL.

     lt_var = lo_pers->get_variants( ).

   ENDIF.

* Set the default variant

* Required variant is read

* READ statement can be modified as per the requirement.

* As this application holds only one user variant, first record is read.

*  read the respective records based on your condition

   IF lt_var IS NOT INITIAL.

     LOOP AT lt_var INTO wa_var WHERE DESCRIPTION = iv_variant_name.

       ls_config_key-config_id    = wa_var-config_id .

       ls_config_key-config_type  = wa_var-config_type.

       ls_config_key-config_var   = wa_var-config_var.

     ENDLOOP.

 

     TRY.

         CALL METHOD lo_pers->set_default_variant

           EXPORTING

             config_key = ls_config_key

             set        = abap_true.

       CATCH cx_wd_personalization .

     ENDTRY.

 

* Get the variant information based on variant id

* Load the variant/ Set the default variant

     CALL METHOD lo_pers->load_config_by_key

       EXPORTING

         config_key            = ls_config_key

*        fetch_default_variant = abap_false

.

 

 

   ENDIF.


Viewing all articles
Browse latest Browse all 8533

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>