Web Dynpro ALV - get Columns of selected Variant

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

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

Similar Messages

  • Web Dynpro ALV grid column colour

    Hi,
    I have tried to set the colour of a column for my web dynpro alv with the below code but it the colour for this column has not changed - it seems to remain the standard colour.  Is there something else i need to do?
      DATA: lt_columns TYPE salv_wd_t_column_ref
          , ls_columns  TYPE salv_wd_s_column_ref
          , lr_column TYPE REF TO cl_salv_wd_column
      lt_columns = lo_value->if_salv_wd_column_settings~get_columns( ).
      LOOP AT lt_columns INTO ls_columns.
        IF ls_columns-id CS 'TOTAL_'.
          lr_column = ls_columns-r_column.
          lr_column->set_cell_design( cl_wd_abstr_master_table_col=>e_cell_design-positive ). "CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-GROUP_LEVEL1
        ENDIF.
      ENDLOOP.

    Hi Samir,
    You will have to create an attribut WDUI_TABLE_CELL_DESIGN and bind this attribute with the cell design property of the column. Check this wiki link [https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP%20Web%20Dynpro%20ALV%20-%20Change%20Cell%20Colour%20based%20on%20Content], it will solve your issue.
    Regards,
    Radhika.

  • Web Dynpro ALV grid column width

    Hi,
    I have a web dynpro alv grid that has columns titles that are long.  What is the best way of displaying the data without taking up too much space with the titles? 
    For example is it possible to wrap the title into 2 or 3 rows
    Thanks,
    Samir

    Hi,
    DATA: lr_column type ref to cl_salv_wd_column,
    lr_colheader type ref to cl_salv_wd_column_header.
              CALL METHOD lrcolumn->get_header
                RECEIVING
                  value = lr_COLHEADER.
    lr_COLHEADER->set_ddic_binding_field( if_salv_wd_c_ddic_binding=>ddic_bind_short ).
    Refer this if_salv_wd_c_ddic_binding in se24 for more.
    Regards,
    Lekha.

  • ABAP Web Dynpro ALV: event for "tabel selection menu" needed

    Hi all,
    we need to react on the "table selection menue" control in our ALV grids. We found, that event "lead_select" is triggerd, if single lines are selected and if "delete selection" from the table selection menu is used.
    But if the "select all" item is used, the event is not triggered.
    Is there another event we can use? Does anybody know a sensible workaround for this problem?
    Thanks  and regards
    Joachim

    Hello Joachim,
    perhaps it's better to post your question in the WebDynpro ABAP forum:
    Web Dynpro ABAP
    Best regards
    Stephan

  • Web Dynpro ALV grid column names

    Hi,
    I wish to specify the text that appears on the column names.  At present the name defaults to the field name within the structure.  Is there a way to specify the name that i wish to appear for each column?  Many thanks in advance
    Samir

    Hi,
    Use the following code
    * Instantiate the used component
      DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
      lo_cmp_usage =   wd_this->wd_cpuse_usg_alv( ).
      IF lo_cmp_usage->has_active_component( ) IS INITIAL.
        lo_cmp_usage->create_component( ).
      ENDIF.
    * Get Model
      DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
      lo_interfacecontroller =   wd_this->wd_cpifc_usg_alv( ).
      DATA lo_value TYPE REF TO cl_salv_wd_config_table.
      lo_value = lo_interfacecontroller->get_model(
    *---------- ALV table settings.
      DATA: l_table_settings TYPE REF TO if_salv_wd_table_settings .
      l_table_settings ?= lo_value.
      wd_this->l_table =  l_table_settings .
    * Set the Editable property to true
      l_table_settings->set_read_only( abap_false ).
    * Set table header
      DATA: l_header TYPE REF TO cl_salv_wd_header.
      l_header = l_table_settings->get_header( ).
      l_header->set_text( 'Sales Orders' ).
    *---------- Column settings
      DATA: l_column_settings TYPE REF TO if_salv_wd_column_settings.
      l_column_settings ?= lo_value.
    * Get columns
      DATA: lt_columns TYPE salv_wd_t_column_ref ,
            ls_columns TYPE salv_wd_s_column_ref .
      DATA: l_column_header  TYPE REF TO cl_salv_wd_column_header .
      lt_columns = l_column_settings->get_columns( )              .
      LOOP AT lt_columns INTO ls_columns .
       CASE ls_columns-id   .                    
          WHEN 'VBELN'     .
            l_column_header = ls_columns-r_column->get_header( )  .
            l_column_header->set_ddic_binding_field(
               if_salv_wd_c_column_settings=>ddic_bind_none )     .
            l_column_header->set_text( 'Sales Order' ). " column header
           WHEN 'POSNR .
            l_column_header = ls_columns-r_column->get_header( )  .
            l_column_header->set_ddic_binding_field(
               if_salv_wd_c_column_settings=>ddic_bind_none )     .
            l_column_header->set_text( 'Item No' ) . "column header
          WHEN 'ZMENG'.
            l_column_header = ls_columns-r_column->get_header( )  .
            l_column_header->set_ddic_binding_field(
               if_salv_wd_c_column_settings=>ddic_bind_none )     .
            l_column_header->set_text( 'Qty' ). "column header
            WHEN OTHERS                                             .
            ls_columns-r_column->set_visible(
                               cl_wd_uielement=>e_visible-none )  .
        ENDCASE  .
      ENDLOOP.
    Regards,
    Radhika.

  • Web Dynpro ALV disable column sort for specific column

    Hi,
    I have the above mentioned problem. The Coding I use is:
    DATA:  lr_field_settings  TYPE REF TO if_salv_wd_field_settings,
                lt_fields          TYPE SALV_WD_T_FIELD_REF.
    FIELD-SYMBOLS:  <fs_field>  LIKE LINE OF lt_fields.
    lr_field_settings ?= lr_config.
    lt_fields = lr_field_settings->get_fields( ).
    READ TABLE lt_fields ASSIGNING <fs_field> WITH KEY fieldname = 'ANSPRECH_DETAILS'.
    IF sy-subrc EQ 0.
      <fs_field>-r_field->if_salv_wd_sort~set_sort_allowed( abap_false ).
      <fs_field>-r_field->if_salv_wd_sort~set_grouping_allowed( abap_false ).
    ENDIF.
    When debugging I can see that the object attributes for sort_allowed and grouping_allowed are changed from 'X' to ' '
    but the running application still allows sorting and grouping for the column 'ANSPRECH_DETAILS'.
    So what did I forget or what is my mistake ????
    Thx for your help.
    Dino Dini

    I got the similar requirement and I tried to do the below way.. it worked for me..
    DATA: lr_field_settings TYPE REF TO if_salv_wd_field_settings.
    DATA: lr_field TYPE REF TO cl_salv_wd_field.
    lr_field_settings ?= lr_table.
    lr_field = lr_field_settings->get_field( 'MATNR' ).
    lr_field->IF_SALV_WD_SORT~SET_SORT_ALLOWED( abap_false
    you can observe in the below image that sort option is not enabled for MATNR in the ALV.

  • Separatate column of Web Dynpro ALV table using a vertical line

    Hi Experts!
    I have Web Dynpro ALV table and  I have a requirement to add a colored vertical line between two columns as a separator.   
    Is this possible? Is it possible to adjust border width of individual cells?
    I would be grateful for any ideas you may able to share.

    Both could be achieved by creating custom theme. But those changes will be applicable to tables and ALVs in your applications.
    Nitesh

  • Web Dynpro ALV grid totals

    Hi,
    I have created an application that uses a web dynpro alv grid.  I want to display totals - is there a setting that can do this automatically - if so, can you please tell me how to do this?    Thanks,

    Hi
    You can take help of following code snippet to create totals for a particular column
    Data: lr_function_settings TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
            lr_column          TYPE REF TO cl_salv_wd_column,
            lt_column type salv_wd_t_column_ref,
            ls_column type salv_wd_s_column_ref.
    Data:  lr_field_amnt type REF TO CL_SALV_WD_FIELD.
    * get reference of ALV component
      lr_salv_wd_table = wd_this->wd_cpifc_OVERVIEW_EARNED_ALV( ).
      wd_this->alv_config_table = lr_salv_wd_table->get_model( ).
    *  get function settings
      lr_function_settings ?= wd_this->alv_config_table.
    * display columns in correct order
      lr_column_settings ?= wd_this->alv_config_table.
      lt_column = lr_column_settings->get_columns( ).
      loop at lt_column into ls_column.
    CASE ls_column-id.
    when 'AMOUNT'
    * aggregate field
            CALL METHOD LR_FUNCTION_SETTINGS->IF_SALV_WD_FIELD_SETTINGS~GET_FIELD
              EXPORTING
                FIELDNAME = 'AMOUNT'
              RECEIVING
                VALUE     = lr_field_amnt.
    * create aggregate rule as total
            CALL METHOD LR_FIELD_AMNT->IF_SALV_WD_AGGR~CREATE_AGGR_RULE
              EXPORTING
                AGGREGATION_TYPE = IF_SALV_WD_C_AGGREGATION=>AGGRTYPE_TOTAL
              RECEIVING
                VALUE            = lv_aggr_rule.
    endcase.
    Regards
    Manas DUa

  • Web Dynpro ALV grid format

    Hi,
    I have a web dynpro alv table that has many columns (about 20) I would like it to be displayed so that the user does not have to scroll right to see all the data.
    at the moment columns:
    col1 col2 col3 ......col19 col20
    i would like the second half of the table under the 1sta half:
    col1 col2 col3...col9 col10
    col11 col12...col19 col20
    Is there any way that i can get the table to be split into two or some other nice way to display without scrolling?

    You won't be able to do this with a single ALV.  I suppose you could have two ALVs and bind them both to the same context.  You wouldn't be able to sync the veritcal scrolling between the the two ALVs however.  I'm also not sure how usage this design is from a UI design pattern.  I would think the acceptible approach would be to use horizontal scrolling within the ALV.  You don't have to make the ALV display all columns at once as this can make your entire page very wide and require using the browser scrolling.  Instead consider using the set_scrollable_col_count method.

  • Input field in Web Dynpro ALV does not have correct focus

    Hello Friends,
    Our client's SAP system is recently upgraded with ECC 6.0 SP 18.
    After that the focus in the editable field of Web Dynpro ALV does not working properly by down arrow navigation.
    The common scenario:
    The ALV has more than one rows and one column is editable...
    when user is selecting field of first row and making some entries...
    after that pressing down arrow it is going to next row and coloring the field like focusing...
    but the 'cursor' is not blinking so user can not make entry without clicking by mouse...
    this was working Ok before upgrade...
    Could you please anyone have a look and propose a suitable solution?
    Thanks
    Krish

    Hello,
    The problem was with Javascript....which play an important role in layout of web dynpro ALV...
    which resides in MIME repository -> SAP ->PUBLIC - >BC ->NW5 ->JS ->SAPURI_Ie6....
    We wrote to SAP for giving us the fix...
    after we got a new file from SAP the problem is solved...
    also we have to clear server cache through SMICM and client cache...
    Thanks.
    K.

  • ABAP Web Dynpro ALV

    How does one enable:
    1) Column selection (single & multi)?
    2) Cell selection (single & multi)?
    This is Web Dynpro ALV 2004S support stack 6.
    Regards,
    Glenn.

    hi
    good
    go through these links, i hope these ll help you to solve your problem,
    http://www.sap-press.de/download/dateien/1079/sappress_web_dynpro_for_abap.pdf
    http://help.sap.com/saphelp_nw04s/helpdata/en/b5/ac884118aa1709e10000000a155106/content.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/b3/4d3642eca5033be10000000a1550b0/frameset.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9
    thanks
    mrutyun^

  • Detail Button in Web Dynpro ALV

    Hi at all,
    when I create an ALV in Standard ABAP there is a small "Detail" button on the left side of the button row without any additional complex programming.
    How can I get this button in Web Dynpro ALV?
    Dirk

    The standard ALV Component in Web Dynpro doesn't have this features.  It wouldn't be too difficult to add manually.  You could simply bind a custom view to the lead selection of the same context you are using in the ALV and use the form wizard to generate the UI elements.  It isn't quite as nice becuase it woudl require a few manual steps for each usage of the ALV where you want this functionality.

  • How to Email POWL Reports / Apply Web Dynpro ALV Table Layout Settings

    Hi all,
    we want to be able to automatically extract POWL reports and email them to users in a batch job.
    We can refresh a POWL report using FM POWL_QUERY_REFRESH, and access the raw report data using method CL_POWL_QUERY_ACCESSOR=>GET_CACHED_RESULTS.
    However this merely gives us a table of raw data.  No view layout (ie. Web Dynpro ALV table layout) settings have been applied, so there is no hiding or arranging of columns, row sorting, calculations or filters.
    Ideally we would like to be able to specify a query and view layout.  The batch job would then refresh and extract the data, and format the data according to the view layout before sending it on as an attachment in an email.
    Does anyone know how to determine and apply Web Dynpro ALV table layout settings to format table data outside of the Web Dynpro environment ?
    Thanks & regards,
    Grogan

    Hi Grogan,
    Did you find out how this works..i also have the same issue.
    Thanks
    Jdsouza

  • Web dynpro Alv ENHANCEMENT

    hI,
    i HAVE a requirement to add extra 2 columns in web dynpro alv of standard web dynpro component
    what are the steps to be taken.

    Hi Madhav,
    Please cehck Thomus answer in this thread..
    is possible to enhance standard ALV?
    Enhancement Implementation - Removing columns in standard ALV table
    Cheers,
    Kris.

  • Web Dynpro ALV grid sub totals

    Hi,
    I have managed to get totals working with web dynpro ALV using code like this :
      DATA: lr_field TYPE REF TO cl_salv_wd_field.
    For total calculations...
      lo_value->if_salv_wd_std_functions~set_aggregation_allowed( abap_true ).
      lr_field = lo_value->if_salv_wd_field_settings~get_field( 'N_OF_DLRS' ).
      lr_field->if_salv_wd_aggr~create_aggr_rule( aggregation_type = if_salv_wd_c_aggregation=>aggrtype_total ).
    Please can someone advise how i can do subtotals also.  Thanks
    Edited by: Samir Vora on Jul 15, 2009 12:40 PM

    Hi,
    For creating subtotals, you can have a look at following article:
    [Tutorial for Creation Subtotals using ALV|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/wd%20abap/tutorial%20for%20creating%20totals%20and%20subtotals%20using%20alv.pdf].
    Hope this helps.
    Regards
    Manas Dua

Maybe you are looking for