Dropdown list in ALV

Hi all,
Im using container to display the ALV.
I am passing handler and values in the dropdown.
and in my ALV, by checking the hadler im displaying the data. Everthing seeems fine.
I want to pass the key instead of text in the dropdown .
what to do?
Rgds,
Kanal

Hoe to do it ?
My iternal table conatins,
Key    value
10        aaaa
20        bbb
and the value in dropdwn is
lv_filed_cat-drdn_handle = 1
lv_filed_cat-value = itab-value
and the result is coming fine.
While saving , i get an error "maximum 2 char allowed"
Rgds,
SAP

Similar Messages

  • Making field as Dropdown list in ALV

    Hi
    This is the code for making field as dropdown list in ALV.
    But wat do you mean by HANDLE here.
    What is the value one indicates.
    FORM prepare_drilldown_values.
    DATA lt_ddval TYPE lvc_t_drop .
    DATA ls_ddval TYPE lvc_s_drop .
    ls_ddval-handle = '1' .ls_ddval-value = 'JFK-12' .
    APPEND ls_ddval TO lt_ddval .
    ls_ddval-handle = '1' .
    ls_ddval-value = 'JSF-44' .
    APPEND ls_ddval TO lt_ddval .
    ls_ddval-handle = '1' .
    ls_ddval-value = 'KMDA-53' .
    APPEND ls_ddval TO lt_ddval .
    ls_ddval-handle = '1' .
    ls_ddval-value = 'SS3O/N' .
    APPEND ls_ddval TO lt_ddval .
    CALL METHOD gr_alvgrid->set_drop_down_table
    EXPORTING
    it_drop_down = lt_ddval .
    ENDFORM. " prepare_drilldown_values
    Regards
    Sandeep Reddy

    Hi,
    REPORT  YMS_DROPDOWNLISTBOX.
          TYPE-POOLS : VRM.
    TABLES : AFKO,AFPO,SSCRFIELDS.
    DATA : BEGIN OF IAFKO OCCURS 0,
           AUFNR LIKE AFKO-AUFNR,
           END OF IAFKO.
    DATA : BEGIN OF IAFPO OCCURS 0,
           MATNR LIKE AFPO-MATNR,
           END OF IAFPO.
    DATA : ITAB TYPE VRM_VALUE.
    DATA : VID TYPE VRM_ID.
    DATA : ITAB1 TYPE VRM_VALUES  ,
           ITAB2 TYPE VRM_VALUES  .
    DATA : FLAG.
    PARAMETERS : P_AUFNR LIKE AFKO-AUFNR AS LISTBOX VISIBLE LENGTH 15.
    INITIALIZATION.
      SELECT AUFNR FROM AFKO UP TO 10 ROWS INTO TABLE IAFKO WHERE AUFNR LIKE
      '%704%'.
      LOOP AT IAFKO.
        ITAB-KEY = IAFKO-AUFNR.
        ITAB-TEXT = IAFKO-AUFNR.
        APPEND ITAB TO ITAB1.
      ENDLOOP.
    AT SELECTION-SCREEN OUTPUT.
      VID = 'P_AUFNR'.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          ID              = VID
          VALUES          = ITAB1
        EXCEPTIONS
          ID_ILLEGAL_NAME = 1
          OTHERS          = 2.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Thanks,
    Sankar M

  • DropDown List in ALV Grid

    Hii,
    I am showing one of my Column Cells of ALV grid as DropDown List.
    I have developed this Code for that.
    DATA : ls_drpdwn TYPE lvc_s_drop,
             lwa_holders LIKE LINE OF gt_holders,
            gt_drpdwn1 TYPE lvc_t_drop.
    FIELD-SYMBOLS : <lwa_fcat> TYPE lvc_s_fcat.
    LOOP AT lt_fcat ASSIGNING <lwa_fcat>.
      IF <lwa_fcat>-fieldname EQ 'SHNAME'.
        <lwa_fcat>-edit = 'X'.
        <lwa_fcat>-drdn_hndl = 1.
      ENDIF.
    ENDLOOP.
    LOOP AT gt_holders INTO lwa_holders.
        ls_drpdwn-handle = 1.
        ls_drpdwn-value = lwa_holders-shname.
        APPEND ls_drpdwn TO gt_drpdwn1.
         CALL METHOD ref_grid->set_drop_down_table
        EXPORTING
          it_drop_down = gt_drpdwn1.
    My Issue is How can I make my column's SHNAME cells to show Different Share Name List for different Holder's Id i.e Cell's should display dynamic List for Different Primary Keys.
    Thanks and Regards,
    Dhiraj B.

    Hi Dhiraj,
    Check this report which does exactly to your requirement : BCALV_EDIT_07.
    Thanks & Regards,
    Faheem.

  • Dropdown list in alv toolbar

    Hello,
    I am trying to get a dropdown column in an ALV table. While searching in the forum I now have the dropdown in thr ALV column 'VALUE' but I am not able to to get values in the column.
    I have one node called 'RES' type WDR_CONTEXT_ATTR_VALUE with the attributs VALUE and TEXT and the following coding:
    ***********************ALV INIT
      data: lr_if_controller type ref to iwci_salv_wd_table,
            lr_cmdl          type ref to cl_salv_wd_config_table,
            lr_cmp_usage     type ref to if_wd_component_usage.
    Instantiate ALV1 component
      lr_cmp_usage =   wd_this->wd_cpuse_alv( ).
      if lr_cmp_usage->has_active_component( ) is initial.
        lr_cmp_usage->create_component( ).
      endif.
    Get reference to model
      lr_if_controller = wd_this->wd_cpifc_alv( ).
      lr_cmdl          = lr_if_controller->get_model( ).
      data: lr_col type ref to cl_salv_wd_column,
            lr_dropdown type ref to cl_salv_wd_uie_dropdown_by_key.
      create object lr_dropdown
        exporting
          selected_key_fieldname = 'VALUE'.
      lr_cmdl->if_salv_wd_table_settings~set_read_only( abap_false ).
      lr_col = lr_cmdl->if_salv_wd_column_settings~get_column( id = 'VALUE' ).
      lr_col->set_cell_editor( lr_dropdown ).
    data: lt_valueset type table of wdr_context_attr_value,
    ls_valueset type wdr_context_attr_value,
    lr_node type ref to if_wd_context_node,
    lr_nodeinfo type ref to if_wd_context_node_info.
    lr_node = wd_context->get_child_node( name = wd_this->wdctx_res ).
    lr_nodeinfo = lr_node->get_node_info( ).
    ls_valueset-value = '1'.
    ls_valueset-text = 'eins'.
    append ls_valueset to lt_valueset.
    ls_valueset-value = '2'.
    ls_valueset-text = 'zwei'.
    append ls_valueset to lt_valueset.
    lr_nodeinfo->set_attribute_value_set(
    exporting
    name = 'VALUE'
    value_set = lt_valueset
    data: itab_res type table of wd_this->element_res,
          stru_res type wd_this->element_res.
    append stru_res to itab_res.
    lr_node->bind_table( itab_res ).
    Anyone knows what I am doing wrong?
    regards
    Stefan

    Hi ,
    I think its not get updated because the external context mapping of the node is done at design time... so remove the design time mapping and do the dyanamic mapping .. once the attributes valueset is updated.. see the below code...
    Instantiate ALV component
    DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
    l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
    IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
    l_ref_cmp_usage->create_component( ).
    ENDIF.
    Pass context node to ALV
    DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
    l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
    l_ref_interfacecontroller->set_data( dyn_node ).
    hope this will help ..............
    Regards
    Yash

  • Is it possible to create the ALV output with dropdown list for the columns

    Hi forum experts,
                              Could the ALV output contain the dropdown list for the column names? if yes, then how we can acheive this to happen.
    Thanks in advance,
    Regards,
    Samad.
    Edited by: Samad arif on Aug 21, 2009 4:40 PM

    Hi Arif,
    Yes we can .FOr the codding check the article,
    [dropdowns in ALV|https://wiki.sdn.sap.com/wiki/display/Snippets/DropdownsinALV]
    regards,
    Archana
    Edited by: Archana Kumari on Aug 21, 2009 1:22 PM

  • ALV: Dropdown list individual for each line of the table

    Hi
    Question.. I would like to make a dropdown list for a field in the ALV list. The dropdown list is not the difficult point. But this dropdown list should be based on the line item.
    Example:
    Material 100.100     has plants (10, 20, 30)
    Material 100.800     has plants (60, 70)
    so the ALV list should show in the dropdown menu only the plants that this material has.
    As I'm not sure, that my explanations are any good, here a example:
    <u>
    ALV-List</u>
    Material       Description             Plants
    100.100        Screwdriver             (Dropdown list shows only 10,20,30)
    100.800        Hammer                  (Dropdown list shows only 60,70).
    Can anyone tell me if this is feasable? And if so how? Is it do-able with this method?
      call method grid->set_drop_down_table
        exporting
          it_drop_down = lt_dropdown.
    The program BCALV_EDIT_07 has sort of two different dropdown lists.. but I have more then two materials, there would be many lists to create.. (many drop_down_handle's)
    Any other idea?
    I know, this is a tricky one...
    Thanks
    Petra
    Message was edited by:
            Petra

    hi
    i have a code for drop down list use this
    this code is for selection-screen deop-down list yu can add this same code in ALV
    REPORT  ZCHETANA_PRAC10                         .
    Type-pools: VRM.
    data: name type vrm_id,
          list_month type vrm_values,
          list_year type vrm_values,
          value type vrm_value.
    selection-screen: begin of block b with frame.
    parameter: p_year(10) type c as listbox visible length 10,
               p_month(10) type c as listbox visible length 10.
    selection-screen: end of block b.
    at selection-screen output.
    value-key = 'JAN'.
    value-text = 'JAN'.
    append value to list_month.
    value-key = 'FEB'.
    value-text = 'FEB'.
    append value to list_month.
    value-key = 'MAR'.
    value-text = 'MAR'.
    append value to list_month.
    value-key = 'APR'.
    value-text = 'APR'.
    append value to list_month.
    value-key = '1998'.
    value-text = '1998'.
    append value to list_year.
    value-key = '1999'.
    value-text = '1999'.
    append value to list_year.
    value-key = '2000'.
    value-text = '2000'.
    append value to list_year.
    CALL FUNCTION 'VRM_SET_VALUES'
      EXPORTING
        ID                    = 'P_MONTH'
        VALUES                = list_month
    EXCEPTIONS
      ID_ILLEGAL_NAME       = 1
      OTHERS                = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'VRM_SET_VALUES'
      EXPORTING
        ID                    = 'P_YEAR'
        VALUES                = list_year
    EXCEPTIONS
      ID_ILLEGAL_NAME       = 1
      OTHERS                = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    start-of-selection.
    write:/ p_year,
           p_month.

  • How to trigger dropdown list click in editable alv?

    I have an editable alv - and wehn a certain field is changed - I want to force the user to update a 2nd field, which is filled via a dropdown list.
    Ive trapped the change of the first field, in the handle_data_changed method, but need to from there - call an event to simulate a click onthe 2nd dropdown field, and can not figure out how to do that. the method modify_cell wont work as it expects a value to be passed in and I need to use my dropwdown.
    How is this done?
    Do I have to change it from a dropdown to an f4 event? I woudl really rather not.

    Dear srivallika,
    first you have do build up an steploop on your dynpro for the it_ccode-bukrs
    AT PBO
    loop at it_ccode cursor g_ccode_cur into wa_cccode.
    my set loopc
    module ccode_loopc.
    endloop.
    Include PBO
    module ccode_loopc.
      g_ccode_loopc = sy-loopc.
    endmodule.
    You only see via DIAG Dialog the displayed rows on the Dynpro.
    So if you only have a steploop of 4 rows -- you only get 4 rows to the wgate.
    Better use the field-set makro.
    AT PBO
    module rfc_fieldset_ccode.
    INCLUDE PBO
    module rfc_fieldset_ccode.
    data: ls_ccode like line of it_ccode.
    data: i type i.
    I'll use deeper structure
      perform rfc_fieldset_ccode.
    but you also can define the code here
    loop at it_ccode into ls_ccode.
         add 1 to i.
         field-set 'INDX'       i i .
         field-set 'BUKRS'   i   ls_ccode-bukrs .
    endloop.
    endmodule.
    Why to do this? The field-set makro (don't forget to include AVWRTCXM at your topinclude) will send the data from internal table via AGATE to the WGATE.
    Here now you can define the dropdown list:
    srivallika, i'll hope i could help you a little. If you have any questions, you won't bother me. ASK!
    With best regards
    Thorsten

  • Dropdown field in alv

    Hi,everyone.
    I have a problem with dropdown field in alv .
    When i set some fields dropdown in alv created by oo.
    i can't input words in this field . can anyone give me some advice?
    ths!

    Hi,
    steps..
    1. X_FIELDCAT-DRDN_HNDL = '1'. "pass this to the field you want to show as drop down
    2.
    DATA: X_OCRC LIKE LINE OF IT_OCRC.
      DATA:LT_DRAL TYPE LVC_T_DRAL,
            LS_DRAL TYPE LVC_S_DRAL.
      LOOP AT IT_OCRC INTO X_OCRC.
    * First listbox (handle '1').
        IF SY-INDEX = 1.
          LS_DRAL-HANDLE = '1'.
          LS_DRAL-VALUE =  ' '.
          LS_DRAL-INT_VALUE =  ' '.
        ELSE.
          LS_DRAL-HANDLE = '1'.
          LS_DRAL-VALUE =  X_OCRC-COMBI.
          LS_DRAL-INT_VALUE =  X_OCRC-COMBI.
        ENDIF.
        APPEND LS_DRAL TO LT_DRAL.
      ENDLOOP.
    **Setting the Drop down table for field1
      CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
        EXPORTING
          IT_DROP_DOWN_ALIAS = LT_DRAL.
    for sample code check here i gave one.
    Event for the List Box in ALV Grid Control
    Regards
    vijay

  • F4 help for a dropdown field in ALV

    I am trying to enable F4 help for a field in ALV (OO style) that also has a dropdown assigned to it.
    If I enable the dropdown in the field catalog, the field does not respond to F4 event at all.
    When I remove the dropdown attribute from the field catalog, the F4 help works, but obviously now there is no dropdown.
    The reason I am trying to implement it this way is that my dropdown list (which is the same for all rows) is quite large while F4 help depends on the current line in the ALV (so the available values are limited).
    I would like to try to avoid creating a dropdown handle for every row in ALV.
    Does anybody know if it's even possible to have a dropdown and F4 help at the same time in ALV?

    Hi
    Linking F4 Help to Fields
    For the last section, we will deal with linking F4 help to fields. It is easy. As usual, define, implement and register the event “onf4” at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the “onf4” event. For this you must prepare a table of type “LVC_T_F4” and register this table using the method “register_f4_for_fields”. While preparing table you must include a line for each field which will trigger F4 event. For each field in the structure;
    1) Pass the fieldname to ‘FIELDNAME’
    2)Set ‘REGISTER’ to make the field registered,
    3)Set ‘GETBEFORE’ to provide field content transport before F4 in editable mode
    4)Set ‘CHNGEAFTER’ to make the data changed after F4 in editable mode.
    Preparing table for the fields to be registered to trigger F4 event
    DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE .
    lt_f4-fieldname = 'PRICE'.
    lt_f4-register = 'X' .
    lt_f4-getbefore = 'X' .
    APPEND lt_f4 .
    CALL METHOD gr_alvgrid->register_f4_for_fields
    EXPORTING
    it_f4 = lt_f4[] .
    A sample “onf4” method implementation
    METHOD handle_on_f1 .
    PERFORM f4_help USING e_fieldname es_row_no .
    er_event_data->m_event_handled = 'X' .
    ENDMETHOD .
    Again, we set the attribute “er_event_data->m_event_handled” to prevent further processing of standard F4 help.
    Check this link
    http://help.sap.com/saphelp_nw04/helpdata/en/ed/ec623c4f69b712e10000000a114084/content.htm
    Check these standard programs
    BCALV_GRID_F4_HELP_APPLICATION
    BCALV_GRID_F4_HELPM01
    BCALV_TEST_GRID_F4_HELP
    Regards
    Pavan

  • How can I use a Dropdown list in a table col and only get the choosen key?

    hi!
    I have chosen Cell editor = Dropdown for two of the columns in my WD table  (ordinary Table not ALV) .
    When the table is displayed the first time this looks OK, but if a user selects a value from the dropdown list, both the key and the explanation text is copied into the cell, and the cell column is automatically widened. I want to copy the key value only, and not the connected text. How is this possible?
    I started setting the table as fixed and setting the width on the column, but this was a puzzle I gave up since there are quite a lot of columns.
    regards, Tine

    Well , the problem is that in the dropdown list I want to see both the key value and the text, like you do in SAP GUI. Fex. if I would like to create a dropdown for langauges, factory calendar or countries, I want to see both the country code (the key) and the name of the country in the dropdown list, and then when user choose a line I would only like to see the keyvalue in the input field.  Right now I concatenate the key and the text into the 'value' in the valueset table.
    In some cases the user knows the key value better than the explanational text, and then it is good to show both values. But sInce I would like to save space in the table displayed in the view I only want to show the key values selected in the table (ex. NO if user choose Norway) .
    But maybe it is better to create this kind of input help as an OVS with no input fields .?

  • Drop down list in ALV grid

    Dear Expert,
    I am new to OOPS ,
    I want to display drop down list for a particular field in my output, so I am using OOPS but in my below code
    I am facing problem in displaying the output as I am getting the error message
    Field catalog not found...
    Also advice me how to display drop down list in a particular field.
    Please advice
    MODULE pbo OUTPUT.
      SET PF-STATUS 'ZTEST'.
      IF g_custom_container IS INITIAL.
        DATA: lt_exclude TYPE ui_functions,
              lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.
        CREATE OBJECT g_custom_container
          EXPORTING
            container_name = g_container.
        CREATE OBJECT g_grid
          EXPORTING
            i_parent = g_custom_container.
        PERFORM field_catalog TABLES it_lvc_t_fcat
           USING: 'S_FINAL' 'MATNR' ' ' 'Part Number' ' ' ' ',
                       'S_FINAL' 'MAKTX' ' ' 'Part Description' ' ' ' ',
                       'S_FINAL' 'MBLNR' ' ' 'Document No' ' ' ' ',
                       'S_FINAL' 'BLDAT' ' ' 'Document date' ' ' ' ',
                       'S_FINAL' 'LIFNR' ' ' 'Vendor Number' ' ' ' ',
                       'S_FINAL' 'STATUS' ' ' 'Acknowledgement' ' ' 'X',
                       'S_FINAL' 'REMARKS' ' ' 'Remarks' ' ' 'X'.
        CALL METHOD g_grid->set_table_for_first_display
           EXPORTING
    *    I_STRUCTURE_NAME              =
         is_layout                                =   it_lvc_s_layo
           CHANGING
             it_outtab                        =   i_final
         it_fieldcatalog                =   it_lvc_t_fcat
      ENDIF.
    ENDMODULE.                 " PBO  OUTPUT
    FORM field_catalog  TABLES t_field_catalog STRUCTURE wt_lvc_s_fcat
    USING fp_tabname TYPE any
    fp_fieldname TYPE any
    fp_key TYPE any
    fp_text TYPE any
    fp_do_sum TYPE any
    fp_edit TYPE any.
      t_field_catalog-tabname = fp_tabname.
      t_field_catalog-fieldname = fp_fieldname.
      t_field_catalog-key = fp_key.
      t_field_catalog-seltext = fp_text.
      t_field_catalog-do_sum = fp_do_sum .
      t_field_catalog-edit = fp_edit .
    ENDFORM.                    "field_catalog
    Edited by: Karthik R on Mar 15, 2010 6:11 PM

    Hi Karthik,
    Below mentioned  is a Simple code for creating dropdown lists for columns in ALV grid output
    REPORT z_alv_dropdown.
    *Type pools declarations for ALV
    TYPE-POOLS : slis.
    *data declarations for ALV container, ALV grid,  Field catalogues & layout
    DATA: g_grid  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container,
          gt_fieldcat TYPE lvc_t_fcat,
          gs_layout TYPE lvc_s_layo.
    *INTERNAL TABLE AND WA DECLARATIONS FOR t517 A table
    DATA: gt_outtab TYPE STANDARD TABLE OF t517a INITIAL SIZE 0,
          wa_outtab TYPE t517a.
    *initialisation event
    INITIALIZATION.
    *Start of selection event
    START-OF-SELECTION.
    *Call to ALV
      CALL SCREEN 600.
    *On this statement double click  it takes you to the screen painter SE51.
    *Create a Custom container and name it CCONT and OK code as OK_CODE.
    *Save check and Activate the screen painter.
    *Now a normal screen with number 600 is created which holds the ALV grid.
    PBO of the actual screen , Here we can give a title and customized menus
    Here we also call the subroutine for ALV output.
          MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
    set pf-status 'xxx'.
    set titlebar 'MAIN100'.
    Subroutine to display the output in alv
      PERFORM alv_output.
    ENDMODULE.                    "pbo OUTPUT
    PAI module of the screen created. In case we use an interactive ALV or
    *for additional functionalities we can create OK codes and
    based on the user command we can do the coding.
          MODULE PAI INPUT                                              *
    MODULE pai INPUT.
    ENDMODULE.                    "pai INPUT
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat.
      DATA ls_fcat TYPE lvc_s_fcat.
    *Build the field catalogue
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'T517A'
        CHANGING
          ct_fieldcat      = gt_fieldcat.
    To assign dropdown in the fieldcataogue
      LOOP AT gt_fieldcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'SLART'.
    *drdn-hndl = '1' is the first list box
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.
    *drdn-hndl = '2' is the second list box
          WHEN 'ABART'.
            ls_fcat-drdn_hndl = '2'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    "build_fieldcat
    *&      Form  ALV_OUTPUT
    FORM alv_output .
    *Create object for container
      CREATE OBJECT g_custom_container
             EXPORTING container_name = 'CCONT'.
    *create object for grid
      CREATE OBJECT g_grid
             EXPORTING i_parent = g_custom_container.
    Build fieldcat and set column
    *Assign a handle for the dropdown listbox.
      PERFORM build_fieldcat.
    *Build layout
      PERFORM build_layout.
    Define a drop down table.
      PERFORM dropdown_table.
    *fetch values from the T517A table
      SELECT * FROM t517a INTO TABLE gt_outtab.
    *Display ALV output
      CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout
        CHANGING
          it_fieldcatalog = gt_fieldcat
          it_outtab       = gt_outtab.
    ENDFORM.                               "ALV_OUTPUT
    *&      Form  dropdown_table
          text
    -->  p1        text
    <--  p2        text
    FORM dropdown_table.
    *Declarations for drop down lists in ALV.
      DATA: lt_dropdown TYPE lvc_t_drop,
            ls_dropdown TYPE lvc_s_drop.
    First SLART listbox (handle '1').
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '01 Pink'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '02 Yellow'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '03 Green'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '04 Black'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '05 White'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '06 Blue'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '09 Other Colors'.
      APPEND ls_dropdown TO lt_dropdown.
    *method to display the dropdown in ALV
      CALL METHOD g_grid->set_drop_down_table
        EXPORTING
          it_drop_down = lt_dropdown.
    ENDFORM.                               " dropdown_table
    *&      Form  build_layout
          text
    *layout for ALV output
    FORM build_layout .
      gs_layout-cwidth_opt = 'X'.
      gs_layout-grid_title = 'ALV DROPDOWN LISTS'.
      gs_layout-no_toolbar = 'X'.
    ENDFORM.                    " build_layout
    Hope it is helpful,
    Regards,
    Soundarya.

  • Function code for dropdown on OO ALV Grid to trigger user_command

    Hi Experts,
    I know we can add a dropdown to a column of an OO ALV Grid, set values to the dropdown list and allow the user to select some these values.
    However , what I'm not sure is that if we can *assign a function code to the dropdown * which would then trigger the event user_command ( PAI ) of the ALV class so I can handle the changes to when a particular value is selected from a dropdown list, just like we do in normal dialogs.
    Now I know that I can register the 'Enter' event and handle the data changes in data_changed event, but that is something I want to avoid the user from doing as far as possible to make the report more user friendly.
    Awaiting your valuable inputs and would really appreciate your help.
    Thanks & regards,
    Advait

    Hi Advait,
    No problem. Yes, this functionality requires changing the focus to other cell.
    I think there is other solution. As the dropdown is kind of F4 activity try this way:
    data: it_f4 type lvc_t_f4,
            wa_f4 type lvc_s_f4.
            wa_f4-FIELDNAME = 'CONNID'.
            wa_f4-REGISTER = 'X'.
            wa_f4-GETBEFORE = 'X'.
            wa_f4-CHNGEAFTER = 'X'.
            append wa_f4 to it_f4.
    "register F4 event
      CALL METHOD g_alv_grid_ref->register_f4_for_fields
        EXPORTING
          it_f4  = it_f4.
    "Once you try to pick the value HANDLE_DATA_CHANGED event will be triggered
    "Definition
         methods:
         handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
                                  IMPORTING er_data_changed e_onf4 e_onf4_before e_onf4_after,
    "Implementation
    METHOD handle_data_changed .
        DATA: ls_mod_cells TYPE lvc_s_modi.
        IF e_onf4_before = 'X'.
          MESSAGE 'Data changed before F4' TYPE 'I'.
        ENDIF.
        IF e_onf4 = 'X'.   "if event triggered by F4
          MESSAGE 'Data changed on F4' TYPE 'I'.
        ENDIF.
        IF e_onf4_after = 'X'.
          MESSAGE 'Data changed after F4' TYPE 'I'.
        ENDIF.
       "here you know which cell was modified
        LOOP AT er_data_changed->mt_mod_cells INTO ls_mod_cells.
         "just example test case, here you can implement your code for modified cells
          IF ls_mod_cells-value >=5.
            CALL METHOD er_data_changed->add_protocol_entry
              EXPORTING
                i_msgid     = 'SABAPDOCU'
                i_msgty     = 'E'
                i_msgno     = '888'
                i_msgv1     = 'Only numbers below 5 are possibe'
                i_msgv2     = 'Please correct'
                i_fieldname = ls_mod_cells-fieldname
                i_row_id    = ls_mod_cells-row_id.
            CALL METHOD er_data_changed->modify_cell
              EXPORTING
                i_fieldname = ls_mod_cells-fieldname
                i_row_id    = ls_mod_cells-row_id
                i_value     = space.
          ENDIF.
        ENDLOOP.
      ENDMETHOD.                    "handle_data_changed
    This approach works fine for picking value from input help. Never tried it for dropdown list. You have to try it out.
    Regards
    Marcin

  • How to avoid roundtrip to server on value select in dropdown box in ALV cel

    Dear Experts,
    I have WD ALV table where user edits values in the cels using dropdown by key element.
    Then after edit he saves whole table. When value is changed in dropdown box the roundtrip to server occurs and it takes noticable time for every cell. My dropdown lists are fixed and are the same for all rows. It is not pleasant user experience and is annoying for user.
    Is there a way to disable this roundtrip for each value selection for each cell and transfer all the data for whole ALV table only when I save whole table (separate button "Save")?
    Help very much appreciated.
    Dmitry

    A lot of enterprises, however, actively avoid systems which are locked down to a particular server for very legitimate reasons. If my data center dies in the middle of the night, I sure don't want to have to call your mobile phone so that you can get to a computer, log in to the office network, and get me a new key so that I can finish my emergency failover. If I've got dozens of applications, I absolutely don't want to do that with dozens of different vendors.
    It sounds like your problem, though, isn't that users are installing your software on multiple computers it's that they are accessing functionality they haven't licensed. That is generally a much easier problem to solve and doesn't require you to lock anything down to a particular machine. You can create a table LICENSED_CONTENT, for example,
    CREATE TABLE licensed_content (
      client_id    NUMBER,
      content_type VARCHAR2(30),
      key          RAW(128)
    )In this case, KEY is, say, a hash (using the DBMS_CRYPTO or DBMS_OBFUSCATION_TOOLKIT packages if you'd like) of the client_id, content_type, and a bit of salt (i.e. a fixed string that only you know). When you sell a license to manage diamond content, you provide a script that inserts the appropriate row in the LICENSED_CONTENT table. When your application starts up, it reads the LICENSED_CONTENT table and verifies the hash before allowing users to access that type of content. This allows legitimate customers to move the software from one system to another but prevents them from accessing new functionality without a new license.
    Justin

  • SSRS report - A single selection dropdown list converted to text box

    Hello everyone,
    We created a single selection dropdown parameter (City parameter) on a report. The data in this parameter is populated using MDX query. Also, it is filtered based on selection of another single selection dropdown list (Country parameter) of a report.
    The problem is when there is no cities for the selected country the dropdown list is gets converted to free type text box and user can insert city data in it. Why SSRS is not keeping it as empty dropdown list with no data?
    Any help would be much appreciated.
    Thanks, Ankit Shah
    Inkey Solutions, India.
    Microsoft Certified Business Management Solutions Professionals
    http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html

    Hello Charlie,
    We developed a fresh report only with two parameters but still the dropdown control gets converted to text box in our case. We have two single selection parameters, Location and Customers. Based on selected Location the customer
    dropdown gets populated.
    Location Parameter Query
    WITH MEMBER [Measures].[ParameterCaption] AS [Location].[Location Name].CURRENTMEMBER.MEMBER_CAPTION MEMBER [Measures].[ParameterValue] AS [Location].[Location Name].CURRENTMEMBER.UNIQUENAME MEMBER
    [Measures].[ParameterLevel] AS [Location].[Location Name].CURRENTMEMBER.LEVEL.ORDINAL
    SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS , [Location].[Location Name].ALLMEMBERS ON ROWS FROM [Model]
    Customer Query
    WITH MEMBER [Measures].[ParameterCaption] AS
    [Customer].[Customer Name].CURRENTMEMBER.MEMBER_CAPTION
    MEMBER [Measures].[ParameterValue] AS
    [Customer].[Customer Name].CURRENTMEMBER.UNIQUENAME
    MEMBER [Measures].[ParameterLevel] AS [Customer].[Customer Name].CURRENTMEMBER.LEVEL.ORDINAL
    SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel],[Measures].[Amt]} ON COLUMNS,
    nonempty([Customer].[Customer Name].ALLMEMBERS,[Measures].[Amt]) ON ROWS FROM ( SELECT ( STRTOSET(@LocationName, CONSTRAINED) ) ON COLUMNS FROM [Model])
    Regarding parameter settings on General tab for both the above parameters we did not select any of the following values, all these checkboxes are empty:
    Allow Blank Value ("") , Allow null value, Allow multiple values.
    I think it has something related to [Measures].[Amt] that we used in customer parameter. We are now trying to take other two parameters where we would be not using the [Measures].[Amt] to filter the data. Will update you soon.
    Thanks, Ankit Shah
    Inkey Solutions, India.
    Microsoft Certified Business Management Solutions Professionals
    http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html

  • How to create a dropdown list to list the values from two different tables?

    Hi,
    I have the following requirement:
    1. I have to create a dropdown list to display all the values from the second column of  a table.
    2. Another dropdown list to display all the values from the second column of another table.
    3. A text box should help me to add the selected values.
    How to get this done in a PDF? Please help.
    Regards,
    Latha

    Is this a LC form? Because Acrobat forms have no concept of tables, just
    individual fields...

Maybe you are looking for