cancel
Showing results for 
Search instead for 
Did you mean: 

ALV in Abap WD

Former Member
0 Kudos

Hi Guys,

I have a request from a customer about an ALV on Abap WD. The request is that only some pre-saved layouts should be seen in the dropdown box of list view selection.

I have found many methods regarding the activation or about settings of a first layout, but nothing allows me to change the content of the list.

Please could you help me?

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You could save "global layouts" for your ALV. So basically start your application in config mode (put sap-config-mode=X parameter to the URL). Then go to the layout settings, create the layout that you want to have, and save it. Now this layout is a "global" one and thus visible for everyone. Repeat this process for the different layouts.

Cheers,

Karri

Former Member
0 Kudos

Thank you Karri,

but probably I was not very clear in the post above. I have the list made as you suggested, but each user is in an authorization group managed with custom table. Then according to this authorization group I have to add /delete from listbox view some layouts because some data are very sensibles and cannot be seen by all.

Then just to do an example: I have created Layout A, B, and C.

For authorization group 1 all layouts are allowed, for group 2 only A and C, for group 3 only B and C.

Something like this.... but using the function  lo_interfacecontroller->get_config_data( ls_param_in ) I'm not able to change the list: I mean that I can show the full list or an empty list....

Thanks.

Cheers.

Salvatore

Former Member
0 Kudos

Hi,

Personally I would not base my authorization concept on the ALV view layouts. It seems just too easy to hack or someone accidentally changes the layouts, or whatever, and the sensitive data will be available to people who are not supposed to see it.

I would most probably do the authorization checks already in the data selection phase and would not populate the context with the sensitive data at all if the checks are not successful for the user. And then of course you can also hide the unnecessary columns from the ALV based on the authorization check.

In other words, I would move the authorization concept away from view layout. Just my thoughts. You might disagree or there might be some other aspects which requires this view layout approach.

Cheers,

Karri

Former Member
0 Kudos

Your thoughts are fine, but unfortunately the main problem is that this web dynpro will be accessed even by external people. Then according to this specific project, then all these people have to see only their data with fixed layouts according, probably, to a fixed selection. No chance to change by final user. Probably is extreme behaviour by my customer, but it's this. Finally, I have to change that listbox....

Former Member
0 Kudos

Let's say that user Smith opens the web dynpro. He has a limited role, so he cannot in any circumstance see column "SENSITIVE".

In your ALV coding you add code that checks the user's authorisations, and if they are not OK, you delete the column SENSITIVE from your ALV.

Now as far as I understand, the user don't see this column, and can even create/save his own layout settings without the option to add this SENSITIVE column since it has been deleted.

Now I don't know what will happen if you create global view layouts and they include SENSITIVE column. Maybe nothing. The column just does not exist for the user with limited role...

Former Member
0 Kudos

The first part is ok, but the user cannot create any kind of layouts. Then if the column SENSITIVE is not shown at the beginning, it won't be shown at all.

Former Member
0 Kudos

>The first part is ok, but the user cannot create any kind of layouts

What do you mean by "cannot"? They are not allowed? You have restricted them for creating/changing layouts?

>Then if the column SENSITIVE is not shown at the beginning, it won't be shown at all.

??? What do you mean by this? You delete the column depending on who uses the application? Don't delete it for users who are allowed to see it.

What comes to the original question. At least I cannot see any suitable methods to populate the view layout list in CL_SALV_CONFIG_TABLE class. Well, that doesn't mean that there wouldn't be a way to do this. Anyhow, I would suggest that you don't build your auth concept on the standard ALV view layout selection. Perhaps disable the whole standard view layout selection, and build your own simple "view selection" in the ALV toolbar?

Karri

Former Member
0 Kudos

First question: yes. The settings link is disabled. Only the filter button is active.

Second question: was related to the first meaning then if a layout is pre-loaded there are no chance to change the layout settings.

Your suggestion is great idea, but I don't find a method or table where I can read the layout structure,.

Salvatore.

Former Member
0 Kudos

Ok I did a custom listbox but I'm not able to refresh the ALV in WDDOMODIFYVIEW. The code is this. Where is the mistake?

IF first_time = abap_false.

     DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
     DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
     DATA lo_api_interfacecontroller TYPE REF TO if_wd_controller.
     DATA lo_nd_drop_down TYPE REF TO if_wd_context_node.
     DATA lo_el_drop_down TYPE REF TO if_wd_context_element.
     DATA: lt_columns TYPE  SALV_WD_T_COLUMN_REF.
     DATA: ls_drop_down TYPE wd_this->element_drop_down,
           lo_pers TYPE REF TO if_wd_personalization,
           ls_config_key TYPE wdy_config_key,
           ls_config_key_pers TYPE wdy_config_key,
           lt_var TYPE wdr_pers_variants,
           wa_var TYPE wdr_pers_variant,
           lv_value TYPE REF TO cl_salv_wd_config_table.

     lo_interfacecontroller =   wd_this->wd_cpifc_alv_projects( ).
     lo_cmp_usage =   wd_this->wd_cpuse_alv_projects( ).
     lo_nd_drop_down = wd_context->get_child_node( name = wd_this->wdctx_drop_down ).

     lo_el_drop_down = lo_nd_drop_down->get_element( ).

     IF lo_cmp_usage->has_active_component( ) IS INITIAL.
       lo_cmp_usage->create_component( ).
     ENDIF.

     lo_api_interfacecontroller = lo_interfacecontroller->wd_get_api( ).
     lv_value = lo_interfacecontroller->get_model( ).

     IF lo_api_interfacecontroller IS NOT INITIAL.
       CALL METHOD lo_api_interfacecontroller->get_personalization_manager
         RECEIVING
           pers_manager = lo_pers.
     ENDIF.

     IF lo_pers IS NOT INITIAL.
       CALL METHOD lo_pers->get_variants
         RECEIVING
           variants = lt_var.
     ENDIF.

     lo_el_drop_down->get_static_attributes(
       IMPORTING
         static_attributes = ls_drop_down ).

     READ TABLE lt_var INTO wa_var WITH KEY config_var = ls_drop_down-config_var.
     IF sy-subrc = 0.
       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.
     ENDIF.

         CALL METHOD lo_pers->set_default_variant
           EXPORTING
             config_key = ls_config_key
             set        = abap_true.

     CALL METHOD lo_pers->load_config_by_key
       EXPORTING
         config_key            = ls_config_key
         fetch_default_variant = abap_true.

DATA: ls_in TYPE if_salv_wd_table=>s_type_param_refresh_in.
  ls_in-dummy = if_salv_wd_table=>load.

       lo_interfacecontroller->refresh(
        in =   ls_in                             " if_salv_wd_table=>s_type_param_refresh_in
       ).


   ENDIF.

Former Member
0 Kudos

I've tried to implement a listbox custom for the layouts but I'm not able to force it after list visualization. Any tips?