Drop down list in alv tree

Hi,
I am developing an ALV TREE. I need help Its really urgent. In the output screen there will be 2 level nodes. in the item line 1 field should be input enabled using which the database table is to be modified.when user left clicks on this field a drop down list will appear from which he selects his choice.
I looked into BCALV_TREE_SIMPLE_DEMO reports available in SAP.
I would also like to know what is register_events, what is an handler.
help me.
Edited by: Sudipa Das on Oct 4, 2008 11:53 AM
Edited by: Sudipa Das on Oct 4, 2008 11:53 AM
Edited by: Sudipa Das on Oct 4, 2008 11:54 AM

Hello Sudipa
I do not think you can have editable fields other than checkboxes in ALV trees. In sample report ZUS_SDN_ALV_TREE_DEMO_1 I have set the fieldcatalog property LS_FCAT-EDIT = 'X' for all fields yet only LOEVM is editable because it is defined as checkbox, too.
However, you may use the LINK_CLICK of the ALV tree (set LS_FCAT-HOTSPOT = 'X' in fieldcatalog) to trigger e.g. a seach help for input.
*& Report  ZUS_SDN_ALV_TREE_DEMO
*& Thread: drop down list in alv tree
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1074082"></a>
*& Thread: alv tree checbox problem when attempt to get the selected checjboxes
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1050473"></a>
*& Thread: alv tree checkbox problem
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1046535"></a>
*& Thread: double click in ALV tree output????
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="742412"></a>
*& Flow logic of screen '0100' (contains no screen elements):
**  PROCESS BEFORE OUTPUT.
**    MODULE STATUS_0100.
**  PROCESS AFTER INPUT.
**    MODULE USER_COMMAND_0100.
*& user-command (for command window): DISPLAY, SELECTED_NODES
REPORT  zus_sdn_alv_tree_demo_1.
CLASS cl_gui_column_tree DEFINITION LOAD.
CLASS cl_gui_cfw DEFINITION LOAD.
TYPE-POOLS: abap, shlp.
TYPES: BEGIN OF ty_s_key.
TYPES: nkey       TYPE lvc_nkey.
TYPES: parent_key TYPE lvc_nkey.
TYPES: END OF ty_s_key.
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE knvv AS data.
INCLUDE TYPE ty_s_key AS key.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                      WITH DEFAULT KEY.
DATA: gt_outtab    TYPE ty_t_outtab.
DATA:
  gd_okcode        TYPE ui_func,
  gd_repid         TYPE syst-repid,
  gt_fcat          TYPE lvc_t_fcat,
  gs_layout        TYPE lvc_s_layo,
  gs_variant       TYPE disvariant,
  go_docking       TYPE REF TO cl_gui_docking_container,
  go_tree          TYPE REF TO cl_gui_alv_tree.
*       CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
    handle_node_double_click
      FOR EVENT node_double_click OF cl_gui_alv_tree
      IMPORTING node_key,
    handle_item_double_click
      FOR EVENT item_double_click OF cl_gui_alv_tree
      IMPORTING node_key
                fieldname,
    handle_checkbox_change
      FOR EVENT checkbox_change OF cl_gui_alv_tree
      IMPORTING checked
                fieldname
                node_key,
    handle_link_click
      FOR EVENT link_click OF cl_gui_alv_tree
      IMPORTING fieldname
                node_key.
ENDCLASS.                    "lcl_eventhandler DEFINITION
*       CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
  METHOD handle_node_double_click.
    MESSAGE 'Event=Double-Click on Node' TYPE 'I'.
    CALL TRANSACTION 'XD03'.
  ENDMETHOD.                    "handle_node_double_click
  METHOD handle_item_double_click.
    MESSAGE 'Event=Double-Click on Item' TYPE 'I'.
    CALL TRANSACTION 'VA03'.
  ENDMETHOD.                    "handle_item_double_click
  METHOD handle_checkbox_change.
    DATA: ls_outtab     TYPE ty_s_outtab.
    BREAK-POINT.
    IF ( fieldname = 'LOEVM' ).
      CALL METHOD go_tree->get_outtab_line
        EXPORTING
          i_node_key     = node_key
        IMPORTING
          e_outtab_line  = ls_outtab
*          e_node_text    =
*          et_item_layout =
*          es_node_layout =
        EXCEPTIONS
          node_not_found = 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.
      ls_outtab-loevm = checked.
      MODIFY gt_outtab FROM ls_outtab
        TRANSPORTING loevm
        WHERE ( nkey = node_key ).
    ENDIF.
    " Trigger PAI
    CALL METHOD cl_gui_cfw=>set_new_ok_code
      EXPORTING
        new_code = 'REFRESH'
*        IMPORTING
*          rc       =
  ENDMETHOD.                    "handle_checkbox_change
  METHOD handle_link_click.
    data: ls_shlp         type SHLP_DESCR,
          lt_retvalues    type STANDARD TABLE OF DDSHRETVAL.
    BREAK-POINT.
    CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
      EXPORTING
        shlpname       = 'USER_COMP'
*       SHLPTYPE       = 'SH'
      IMPORTING
        SHLP           = ls_shlp.
    CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
      EXPORTING
        shlp                = ls_shlp
*       DISPONLY            = ' '
*       MAXRECORDS          = 500
*       MULTISEL            = ' '
*       CUCOL               = SY-CUCOL
*       CUROW               = SY-CUROW
*     IMPORTING
*       RC                  =
      tables
        return_values       = lt_retvalues.
  ENDMETHOD.                    "handle_link_click
ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
  PERFORM init_controls.
  gd_repid = syst-repid.
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = gd_repid
      dynnr                       = '0100'
*      container                   =
    EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      lifetime_dynpro_dynpro_link = 3
      OTHERS                      = 4.
  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 SCREEN '0100'.
** NOTE: no elements on screen
**  PROCESS BEFORE OUTPUT.
**    MODULE STATUS_0100.
**  PROCESS AFTER INPUT.
**    MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*&      Module  STATUS_0100  OUTPUT
*       text
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.
*  SET TITLEBAR 'xxx'.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&      Module  USER_COMMAND_0100  INPUT
*       text
MODULE user_command_0100 INPUT.
  TRANSLATE gd_okcode TO UPPER CASE.
  CASE gd_okcode.
    WHEN 'BACK'  OR
         'EXIT'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.
    WHEN 'REFRESH'.
      CALL METHOD go_tree->update_calculations
*        EXPORTING
*          no_frontend_update =
    WHEN 'SELECTED_NODES'.
      PERFORM get_selected_nodes.
    WHEN 'DISPLAY'.
      PERFORM display.
    WHEN OTHERS.
  ENDCASE.
  CLEAR: gd_okcode.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&      Form  init_controls
*       text
*  -->  p1        text
*  <--  p2        text
FORM init_controls .
* Create docking container
  CREATE OBJECT go_docking
    EXPORTING
      parent = cl_gui_container=>screen0
      ratio  = 90
    EXCEPTIONS
      OTHERS = 6.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
* create tree control
  CREATE OBJECT go_tree
    EXPORTING
      parent                      = go_docking
      node_selection_mode         = cl_gui_column_tree=>node_sel_mode_multiple
      item_selection              = 'X'  " required for double-click event on item
      no_html_header              = ''
      no_toolbar                  = ''
    EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      create_error                = 3
      lifetime_error              = 4
      illegal_node_selection_mode = 5
      failed                      = 6
      illegal_column_name         = 7.
  IF sy-subrc <> 0.
    MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
  ENDIF.
* create Hierarchy-header
  DATA ls_hierarchy_header TYPE treev_hhdr.
  PERFORM build_hierarchy_header CHANGING ls_hierarchy_header.
  PERFORM build_fieldcatalog.
  PERFORM set_layout_and_variant.
* create emty tree-control
  CALL METHOD go_tree->set_table_for_first_display
    EXPORTING
**      i_structure_name     = 'KNVV'
      is_variant           = gs_variant
      i_save               = 'A'
*      i_default            = 'X'
      is_hierarchy_header  = ls_hierarchy_header
*      is_exception_field   =
*      it_special_groups    =
*      it_list_commentary   =
*      i_logo               =
*      i_background_id      =
*      it_toolbar_excluding =
*      it_except_qinfo      =
    CHANGING
      it_outtab            = gt_outtab
*      it_filter            =
      it_fieldcatalog      = gt_fcat.
* create hierarchy
  PERFORM create_hierarchy.
* register events
  PERFORM register_events.
* adjust column_width
  CALL METHOD go_tree->column_optimize.
ENDFORM.                    " init_controls
*&      Form  build_hierarchy_header
*       build hierarchy-header-information
*      -->P_L_HIERARCHY_HEADER  strucxture for hierarchy-header
FORM build_hierarchy_header CHANGING
                               p_hierarchy_header TYPE treev_hhdr.
  p_hierarchy_header-heading = 'Hierarchy Header'.          "#EC NOTEXT
  p_hierarchy_header-tooltip =
                         'This is the Hierarchy Header !'.  "#EC NOTEXT
  p_hierarchy_header-width = 30.
  p_hierarchy_header-width_pix = ''.
ENDFORM.                               " build_hierarchy_header
*&      Form  BUILD_FIELDCATALOG
*       text
*  -->  p1        text
*  <--  p2        text
FORM build_fieldcatalog .
  DATA: ls_fcat   TYPE lvc_s_fcat.
  REFRESH: gt_fcat.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
*     I_BUFFER_ACTIVE              =
      i_structure_name             = 'KNVV'
*     I_CLIENT_NEVER_DISPLAY       = 'X'
      i_bypassing_buffer           = 'X'
*     I_INTERNAL_TABNAME           =
    CHANGING
      ct_fieldcat                  = gt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  DELETE gt_fcat FROM 10.
  ls_fcat-tech = 'X'.
  MODIFY gt_fcat FROM ls_fcat
    TRANSPORTING tech
    WHERE ( key = 'X' ).
  ls_fcat-edit = 'X'.
  MODIFY gt_fcat FROM ls_fcat
    TRANSPORTING edit
    WHERE ( key NE 'X' ).
  READ TABLE gt_fcat INTO ls_fcat
       WITH KEY fieldname = 'LOEVM'.
  IF ( syst-subrc = 0 ).
    ls_fcat-checkbox = 'X'.
    ls_fcat-edit     = 'X'.
**    ls_fcat-hotspot  = 'X'.
    MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
  ENDIF.
  READ TABLE gt_fcat INTO ls_fcat
       WITH KEY fieldname = 'ERNAM'.
  IF ( syst-subrc = 0 ).
    ls_fcat-hotspot  = 'X'.
    MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
  ENDIF.
ENDFORM.                    " BUILD_FIELDCATALOG
*&      Form  SET_LAYOUT_AND_VARIANT
*       text
*  -->  p1        text
*  <--  p2        text
FORM set_layout_and_variant .
  CLEAR: gs_layout,
         gs_variant.
  gs_variant-report = syst-repid.
  gs_variant-handle = 'TREE'.
ENDFORM.                    " SET_LAYOUT_AND_VARIANT
*&      Form  create_hierarchy
*       text
*  -->  p1        text
*  <--  p2        text
FORM create_hierarchy .
  DATA: ls_knvv     TYPE sflight,
        ld_idx      TYPE i,
        ls_outtab   TYPE ty_s_outtab,
        lt_outtab   TYPE ty_t_outtab.
* get data
  SELECT * FROM knvv INTO CORRESPONDING FIELDS OF TABLE lt_outtab
                        UP TO 20 ROWS .                 "#EC CI_NOWHERE
  SORT lt_outtab BY kunnr vkorg.
* add data to tree
  DATA: ld_root_key  TYPE lvc_nkey,
        ld_kunnr_key TYPE lvc_nkey,
        ld_vkorg_key TYPE lvc_nkey,
        ld_last_key  TYPE lvc_nkey.
  ld_idx = 0.
  LOOP AT lt_outtab INTO ls_outtab.
    AT FIRST.
      PERFORM add_root_line USING    ls_outtab-data
                              CHANGING ld_root_key.
      ADD 1 TO ld_idx.
      ls_outtab-nkey       = ld_root_key.
      ls_outtab-parent_key = space.
      MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
        TRANSPORTING key.
    ENDAT.
    ON CHANGE OF ls_outtab-kunnr.
      PERFORM add_customer_line USING    ls_outtab-data
                                         ld_root_key
                              CHANGING ld_kunnr_key.
      ADD 1 TO ld_idx.
      ls_outtab-nkey       = ld_kunnr_key.
      ls_outtab-parent_key = ld_root_key.
      MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
        TRANSPORTING key.
    ENDON.
    ON CHANGE OF ls_outtab-vkorg.
      PERFORM add_salesorg_line USING    ls_outtab-data
                                         ld_kunnr_key
                              CHANGING ld_vkorg_key.
      ADD 1 TO ld_idx.
      ls_outtab-nkey       = ld_vkorg_key.
      ls_outtab-parent_key = ld_kunnr_key.
      MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
        TRANSPORTING key.
    ENDON.
    PERFORM add_complete_line USING  ls_outtab-data
                                     ld_vkorg_key
                            CHANGING ld_last_key.
    ADD 1 TO ld_idx.
    ls_outtab-nkey       = ld_last_key.
    ls_outtab-parent_key = ld_vkorg_key.
    MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
      TRANSPORTING key.
  ENDLOOP.
* calculate totals
  CALL METHOD go_tree->update_calculations.
* this method must be called to send the data to the frontend
  CALL METHOD go_tree->frontend_update.
ENDFORM.                    " create_hierarchy
*&      Form  add_customer_line
*       add hierarchy-level 1 to tree
*      -->P_LS_SFLIGHT  sflight
*      -->P_RELEATKEY   relatkey
*     <-->p_node_key    new node-key
FORM add_root_line USING     us_data TYPE ty_s_outtab-data
                             ud_relat_key TYPE lvc_nkey
                     CHANGING  cd_node_key TYPE lvc_nkey.
  DATA: l_node_text TYPE lvc_value,
        ls_data TYPE ty_s_outtab-data.
* set item-layout
  DATA: lt_item_layout TYPE lvc_t_layi,
        ls_item_layout TYPE lvc_s_layi.
  ls_item_layout-t_image = '@3Q@'.  " icon_overview
  ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
  ls_item_layout-style   =
                        cl_gui_column_tree=>style_intensifd_critical.
  APPEND ls_item_layout TO lt_item_layout.
* add node
  l_node_text =  'Overview: Sales Areas'.
  DATA: ls_node TYPE lvc_s_layn.
  ls_node-n_image   = space.
  ls_node-exp_image = space.
  CALL METHOD go_tree->add_node
    EXPORTING
      i_relat_node_key = ud_relat_key
      i_relationship   = cl_gui_column_tree=>relat_last_child
      i_node_text      = l_node_text
      is_outtab_line   = ls_data
      is_node_layout   = ls_node
      it_item_layout   = lt_item_layout
    IMPORTING
      e_new_node_key   = cd_node_key.
ENDFORM.                               " add_root_line
*&      Form  add_customer_line
*       add hierarchy-level 1 to tree
*      -->P_LS_SFLIGHT  sflight
*      -->P_RELEATKEY   relatkey
*     <-->p_node_key    new node-key
FORM add_customer_line USING     us_data TYPE ty_s_outtab-data
                                 ud_relat_key TYPE lvc_nkey
                     CHANGING  cd_node_key TYPE lvc_nkey.
  DATA: l_node_text TYPE lvc_value,
        ls_data TYPE ty_s_outtab-data.
* set item-layout
  DATA: lt_item_layout TYPE lvc_t_layi,
        ls_item_layout TYPE lvc_s_layi.
  ls_item_layout-t_image = '@A0@'.  " icon_customer.
  ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
  ls_item_layout-style   =
                        cl_gui_column_tree=>style_intensifd_critical.
  APPEND ls_item_layout TO lt_item_layout.
* add node
  l_node_text =  us_data-kunnr.
  DATA: ls_node TYPE lvc_s_layn.
  ls_node-n_image   = space.
  ls_node-exp_image = space.
  CALL METHOD go_tree->add_node
    EXPORTING
      i_relat_node_key = ud_relat_key
      i_relationship   = cl_gui_column_tree=>relat_last_child
      i_node_text      = l_node_text
      is_outtab_line   = ls_data
      is_node_layout   = ls_node
      it_item_layout   = lt_item_layout
    IMPORTING
      e_new_node_key   = cd_node_key.
ENDFORM.                               " add_customer_line
*&      Form  add_salesorg_line
*       add hierarchy-level 1 to tree
*      -->P_LS_SFLIGHT  sflight
*      -->P_RELEATKEY   relatkey
*     <-->p_node_key    new node-key
FORM add_salesorg_line USING     us_data TYPE ty_s_outtab-data
                                 ud_relat_key TYPE lvc_nkey
                     CHANGING  cd_node_key TYPE lvc_nkey.
  DATA: l_node_text TYPE lvc_value,
        ls_data TYPE ty_s_outtab-data.
* set item-layout
  DATA: lt_item_layout TYPE lvc_t_layi,
        ls_item_layout TYPE lvc_s_layi.
  ls_item_layout-t_image = '@DS@'.  " ICON_PARTNER_SALES_ACTIVITY
  ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
  ls_item_layout-style   =
                        cl_gui_column_tree=>style_intensifd_critical.
  APPEND ls_item_layout TO lt_item_layout.
* add node
  l_node_text =  us_data-vkorg.
  DATA: ls_node TYPE lvc_s_layn.
  ls_node-n_image   = space.
  ls_node-exp_image = space.
  CALL METHOD go_tree->add_node
    EXPORTING
      i_relat_node_key = ud_relat_key
      i_relationship   = cl_gui_column_tree=>relat_last_child
      i_node_text      = l_node_text
      is_outtab_line   = ls_data
      is_node_layout   = ls_node
      it_item_layout   = lt_item_layout
    IMPORTING
      e_new_node_key   = cd_node_key.
ENDFORM.                               " add_salesorg_line
*&      Form  add_cmplete_line
*       add hierarchy-level 3 to tree
*      -->P_LS_SFLIGHT  sflight
*      -->P_RELEATKEY   relatkey
*     <-->p_node_key    new node-key
FORM add_complete_line USING     us_data TYPE ty_s_outtab-data
                                 ud_relat_key TYPE lvc_nkey
                     CHANGING  cd_node_key TYPE lvc_nkey.
  DATA: l_node_text TYPE lvc_value.
* set item-layout
  DATA: lt_item_layout TYPE lvc_t_layi,
        ls_item_layout TYPE lvc_s_layi.
  ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
  ls_item_layout-class   = cl_gui_column_tree=>item_class_checkbox.
  ls_item_layout-editable = 'X'.
  APPEND ls_item_layout TO lt_item_layout.
**  clear: ls_item_layout.
**  ls_item_layout-fieldname = 'BEGRU'.
**  ls_item_layout-class   = cl_gui_column_tree=>ITEM_CLASS_CHECKBOX.
**  ls_item_layout-editable = 'X'.
**  APPEND ls_item_layout TO lt_item_layout.
**  CLEAR ls_item_layout.
**  ls_item_layout-fieldname = 'PLANETYPE'.
**  ls_item_layout-alignment = cl_gui_column_tree=>align_right.
**  APPEND ls_item_layout TO lt_item_layout.
  l_node_text =  us_data-vtweg.
  DATA: ls_node TYPE lvc_s_layn.
  ls_node-n_image   = space.
  ls_node-exp_image = space.
  CALL METHOD go_tree->add_node
    EXPORTING
      i_relat_node_key = ud_relat_key
      i_relationship   = cl_gui_column_tree=>relat_last_child
      is_outtab_line   = us_data
      i_node_text      = l_node_text
      is_node_layout   = ls_node
      it_item_layout   = lt_item_layout
    IMPORTING
      e_new_node_key   = cd_node_key.
ENDFORM.                               " add_complete_line
*&      Form  register_events
*       text
*  -->  p1        text
*  <--  p2        text
FORM register_events.
* define the events which will be passed to the backend
  DATA: lt_events TYPE cntl_simple_events,
        l_event TYPE cntl_simple_event.
* define the events which will be passed to the backend
  l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
  APPEND l_event TO lt_events.
  l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
  APPEND l_event TO lt_events.
**  l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
**  APPEND l_event TO lt_events.
**  l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
**  APPEND l_event TO lt_events.
**  l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
**  APPEND l_event TO lt_events.
**  l_event-eventid = cl_gui_column_tree=>eventid_header_click.
**  APPEND l_event TO lt_events.
**  l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
**  APPEND l_event TO lt_events.
  l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
  APPEND l_event TO lt_events.
  l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
  APPEND l_event TO lt_events.
  l_event-eventid = cl_gui_column_tree=>eventid_link_click.
  APPEND l_event TO lt_events.
  CALL METHOD go_tree->set_registered_events
    EXPORTING
      events                    = lt_events
    EXCEPTIONS
      cntl_error                = 1
      cntl_system_error         = 2
      illegal_event_combination = 3.
  IF sy-subrc <> 0.
    MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
  ENDIF.
* set Handler
  SET HANDLER:
    lcl_eventhandler=>handle_node_double_click FOR go_tree,
    lcl_eventhandler=>handle_item_double_click FOR go_tree,
    lcl_eventhandler=>handle_checkbox_change   FOR go_tree,
    lcl_eventhandler=>handle_link_click        FOR go_tree.
**  DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
**  CREATE OBJECT l_event_receiver.
**  SET HANDLER l_event_receiver->handle_node_ctmenu_request
**                                                        FOR tree1.
**  SET HANDLER l_event_receiver->handle_node_ctmenu_selected
**                                                        FOR tree1.
**  SET HANDLER l_event_receiver->handle_item_ctmenu_request
**                                                        FOR tree1.
**  SET HANDLER l_event_receiver->handle_item_ctmenu_selected
**                                                        FOR tree1.
**  SET HANDLER l_event_receiver->handle_checkbox_change FOR tree1.
ENDFORM.                               " register_events
*&      Form  DISPLAY
*       text
*  -->  p1        text
*  <--  p2        text
FORM display .
  DATA: ls_outtab   TYPE ty_s_outtab,
        ls_line     TYPE ty_s_outtab,
        ld_msg      TYPE bapi_msg.
  BREAK-POINT.
  LOOP AT gt_outtab INTO ls_outtab
          WHERE ( loevm = 'X' ).
    CONCATENATE 'Checkbox:'
                ls_outtab-kunnr
                ls_outtab-vkorg
                ls_outtab-vtweg
                ls_outtab-spart
                ls_outtab-loevm
      INTO ld_msg SEPARATED BY space.
    MESSAGE ld_msg TYPE 'I'.
  ENDLOOP.
  IF ( syst-subrc NE 0 ).
    MESSAGE 'No marked checkboxes found' TYPE 'I'.
  ENDIF.
  PERFORM get_selected_nodes.
ENDFORM.                    " DISPLAY
*&      Form  GET_SELECTED_NODES
*       text
*  -->  p1        text
*  <--  p2        text
FORM get_selected_nodes.
* define local data
  DATA: ld_msg        TYPE bapi_msg,
        lt_nodes      TYPE lvc_t_nkey,
        ls_outtab     TYPE ty_s_outtab,
        ld_nkey       TYPE lvc_nkey,
        lt_items      TYPE lvc_t_layi,
        ls_item       TYPE lvc_s_layi.
  CALL METHOD go_tree->get_selected_nodes
    CHANGING
      ct_selected_nodes = lt_nodes
    EXCEPTIONS
      cntl_system_error = 1
      dp_error          = 2
      failed            = 3
      OTHERS            = 4.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  CHECK ( lt_nodes IS NOT INITIAL ).
  BREAK-POINT.
  LOOP AT lt_nodes INTO ld_nkey.
    CALL METHOD go_tree->get_outtab_line
      EXPORTING
        i_node_key     = ld_nkey
      IMPORTING
        e_outtab_line  = ls_outtab-data
*        e_node_text    =
        et_item_layout = lt_items
*        es_node_layout =
      EXCEPTIONS
        node_not_found = 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.
    LOOP AT lt_items INTO ls_item
                     WHERE ( chosen = 'X' ).
      CONCATENATE 'Item:'
                  ls_outtab-kunnr
                  ls_outtab-vkorg
                  ls_outtab-vtweg
                  ls_outtab-spart
                  ls_outtab-loevm
        INTO ld_msg SEPARATED BY space.
      MESSAGE ld_msg TYPE 'I'.
    ENDLOOP.
  ENDLOOP.
ENDFORM.                    " GET_SELECTED_NODES
Regards
  Uwe

Similar Messages

  • 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.

  • Drop Down List in ALV with Event handler

    Hi All ,
    I have created an ALV grid with a dropdown as one of the columns. This all works fine, except that I want to be able to react to a change in the value of each line's dropdown the next column values should change according to the user selection in the 1st column .
    Is this possible?
    As an example, I have a table of records with one column as a dropdown called " Replace Function Module "   and in 2nd column i have call function of that Replace Function Module , If a  change in " Replace Function Module " should change the call function of in the 2nd column .
    I am using these objects lvc_t_drop , lvc_s_drop and  the method  " set_drop_down_table ",
    Please Can any 1 tel me how to do this with any event handler ar any other way !

    Hi,
    You need to use event handler for this. Check if the below link gives some direction.
    [http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01]
    I guess you should create a method inside which you call the FM using the FM name from the selected cell in ALV.
    I have not tried it out, but its worth a try.
    Hope this helps!
    Regards,
    Saumya

  • Drop-down list in editable ALV

    Hello all,
    Does anyone know how to display the values instead of the internal values when using the alias table to specify a drop-down list in an editable ALV grid ?
    Apparently the BC_ALV* examples have the same problem.
    thx
    Pieter

    Hi,
    These links will help you to implement a drop down list...
    http://help.sap.com/saphelp_46c/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm
    Also refer the pgm:
    RSDEMO_DROPDOWN_LISTBOX
    BCALV_TEST_GRID_F4_HELP
    Also take a look the SAP example program BCALV_TEST_GRID_EDITABLE.  It has a working Drop Down List Box.
    You have to fill a table of type lvc_t_drop. In this you set a handle and value for every item you want to have in a all possible drop down lists. You will later connect a sub set of this data to your grid display data by joining on this handle. You can then send this table to your ALV grid using the method SET_DROP_DOWN_TABLE. You will also want to set the DRDN_FIELD in your field catalog to the field name in your data table that will contain the handle for the values in your drop down table you want to expose. You will need to add this field to your data table.
    Best Regards,
    Anjali

  • ALV Grid display Drop down lists

    I have a alv grid display with a few records say 5 records which display 5 columns 5 rows. I want to know is it possible to have drop down lists for each column row cell but with different drop down values for each record.
    So 5 columns 5 rows 25 cells but each cell have different drop down values.
    Any info would be appreciated

    Hi,
    Thanks for the replies.
    Currently i do understand how to get the drop down handle per column and add values but this will only show the drop down values for each cell the same for each column.
    What i am trying is that each cell of each colum of each row must have different drop down values.
    Example below: Where the ; is devider for new value as a drop down value for that cell
    Record-- column1---column2   column3  column4  column5
      1 -
    a;b;c -
    d;e;f -
    g;h;i -
    k;l;m -
    o;i
      2 -
    l;k;j -
    i;j;g----
    q;e;r -
    o;u;g -
    g;d;e

  • Show the drop down list of variant on the selection screen in ALV reports

    Hi,
    i have a alv report when i execute this display will come and then i click display layout it save as a variant on the selection screen and when i go back to selection screen and press f4 on the display variant its show the drop down list of varient.
    can u send me some code for this functionality...its very urgent.
    thanks!
    Vipin

    Hi,
    try inserting this code apropietly in you program. (1 parameter + Initialization + At-selection-screen + 2 forms)
    START HERE
    PARAMETERS: pa_vari TYPE disvariant-variant.
    INITIALIZATION.
      g_repid = sy-repid.
      CLEAR e_variant.
      e_variant-report   = sy-cprog.
      e_variant-username = sy-uname.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save     = 'A'
        CHANGING
          cs_variant = e_variant
        EXCEPTIONS
          not_found  = 2.
      IF sy-subrc = 0.
        pa_vari = e_variant-variant.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_vari.
      PERFORM alv_variant_f4 CHANGING pa_vari.
    *&      Form  ALV_VARIANT_F4
    FORM alv_variant_f4 CHANGING pa_vari.
      DATA: l_exit(1) TYPE c.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant       = e_variant
          i_tabname_header = 'ANYTHING'
          i_save           = 'A'
        IMPORTING
          e_exit           = l_exit
          es_variant       = e_variant
        EXCEPTIONS
          not_found        = 2.
      IF sy-subrc = 2.
        MESSAGE ID sy-msgid TYPE 'S'  NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        IF l_exit = space.
          pa_vari = e_variant-variant.
        ENDIF.
      ENDIF.
    ENDFORM.                               " ALV_VARIANT_F4
    END
    Hope iy helps!
    Alfonso

  • Event handling to the drop down list in the WEB DYNPRO ALV.

    Hi Experts,
    I posted same thing in the UI programing in the morning
    For better Visiblity(as i didnt get any replies) of my issue i am posting the same thing in the ABAP General as well.
    In my dynpro ALV i have 5 fields. in that 2ed field has the drop down list.
    if i select any of from the list, based on the particular selected value, some value should be reflect in the 3rd field of the ALV.
    Ex:
    dropdown list of  2ed fields inclued like below
    AUXILIARY CONTROLLER
    AXLE ASSEMBLY, NON-OSCILLATING
    ACTUATOR, LINEAR
    AIR CONDITIONER
    BLADE, EARTHMOVING
    if i select ACTUATOR, LINEAR the value ( ACT - first three letters ) should automaticaly reflects in the 3rd field of the ALV like below
    Filed 2                Field 3
    ACTUATOR, LINEAR       ACT
    I thnk we have to do the some Event handling for that dropdown.
    I checkd in the SCN but i didnt find any solution to my issue.
    Any solutions/sample code is appriciated.
    Regards!

    Make sure that the Location Bar is not set to "Nothing": Tools > Options > Privacy > Location Bar: When using the location bar, suggest: History, Bookmarks, History and Bookmarks
    See [[Smart Location Bar]]

  • Event handling to the drop down list in the web dypro ALV.

    Hi Experts,
    In my dynpro ALV i have 5 fields. in that 2ed field has the drop down list.
    if i select any of from the list, based on the particular selected value, some value should be reflect in the 3rd field of the ALV.
    Ex:
    dropdown list of  2ed fields inclued like below
    AUXILIARY CONTROLLER
    AXLE ASSEMBLY, NON-OSCILLATING
    ACTUATOR, LINEAR
    AIR CONDITIONER
    BLADE, EARTHMOVING
    if i select ACTUATOR, LINEAR the value ( ACT - first three letters ) should automaticaly reflects in the 3rd field of the ALV like below
    Filed 2                Field 3
    ACTUATOR, LINEAR       ACT
    I thnk we have to do the some Event handling for that dropdown.
    I checkd in the SCN but i didnt find any solution to my issue.
    Any solutions/sample code is appriciated.
    For better visiblity( as i didn't get any replies ) I posted same thing in the ABAP Programing
    Regards!
    Edited by: Prasanth M on Feb 20, 2009 2:54 PM

    Make sure that the Location Bar is not set to "Nothing": Tools > Options > Privacy > Location Bar: When using the location bar, suggest: History, Bookmarks, History and Bookmarks
    See [[Smart Location Bar]]

  • Variable drop-down lists according to radio-button input

    I need to restrict the display of drop-down lists according to a particular radio-button selection earlier on the form. Can I use a javascript call on the client side without linking to an external database along these lines:
    If radiobutton1 == 1
    then dropdownlist1 uses list1
    elseif radiobutton1 == 2
    then dropdownlist1 uses list2
    and so forth.
    Obviously the syntax is incorrect, but I need to know if it can be done before digging in further.

    Let's assume we have tree grouped radio buttons in a group of buttons, and a combo box object which displays a different list of elements depending of the chosen option.
    A very simple way to do it would be, for example, the following one:
    b [*] Radio Button Group - OnClick Event
    i // List of elements that will be loaded in the combo box object
    > var colorList = new Array("White","Blue","Red","Green");
    > var dayList = new Array("Monday","Tuesday","Wednesday","Thursday");
    > var tmarkList = new Array("Nike","Adidas","Reebook","Levis");
    i // ComboBox Object
    > var combo = xfa.resolveNode("Formulario1.ComboBox");
    i // Cleaning the combo...
    > combo.clearItems();
    > combo.addItem("Select one option to the list","");
    i // Filling the Combo
    i // "this" returns a button group where there are three radio buttons
    i // and the "rawValue" returns the selected index chosen in radio
    i // buttons.
    > switch(this.rawValue)
    > {
    > case "1":
    > for(nJ = 0; nJ < colorList.length; nJ++)
    > combo.addItem(colorList[nJ]);
    > break;
    > case "2":
    > for(nJ = 0; nJ < dayList.length; nJ++)
    > combo.addItem(dayList[nJ]);
    > break;
    > case "3":
    > for(nJ = 0; nJ < tmarkList.length; nJ++)
    > combo.addItem(tmarkList[nJ]);
    > break;
    >}

  • How can I put JTree into drop-down List of JCombobox

    I want to create a drop-down list which shows a list of nodes. When the user clicks on a node, it should open to show the leafs. Clicking on a leaf should close the ComboboxPopup and show its value. Creating a renderer only represent my tree, but I can't trap the events.
    Here is my simplified code.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.border.*;
    import java.util.*;
    public class ComboBoxTreeDemo  extends JPanel
         static JFrame frame;
         ComboBoxRenderer renderer;
         JTree tree;
         public ComboBoxTreeDemo()
              setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
              DefaultMutableTreeNode root =  new DefaultMutableTreeNode("top");
              DefaultMutableTreeNode sub1 =  new DefaultMutableTreeNode("sub1");
              DefaultMutableTreeNode sub2 =  new DefaultMutableTreeNode("sub2");
              root.add(sub1);
              root.add(sub2);
              tree = new JTree(root);
              String[] string = {"1" };
              JComboBox jcb = new JComboBox(string);
              renderer = new ComboBoxRenderer(this);
              jcb.setPreferredSize(new Dimension(100,22));
              jcb.setEditable(true);
              jcb.setRenderer(renderer);
              JPanel jpa = new JPanel();
              jpa.setLayout(new BoxLayout(jpa, BoxLayout.PAGE_AXIS));
              jpa.setAlignmentX(Component.LEFT_ALIGNMENT);
              jpa.add(jcb);
              add(jpa);
              setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
         private static void createAndShowGUI()
              JFrame.setDefaultLookAndFeelDecorated(true);
              JFrame frame = new JFrame("ComboBoxTreeDemo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JComponent newContentPane = new ComboBoxTreeDemo();
              newContentPane.setOpaque(true);
              frame.setContentPane(newContentPane);
              frame.pack();
              frame.setVisible(true);
          class ComboBoxRenderer extends JPanel implements ListCellRenderer
              ComboBoxTreeDemo cbt;
              public ComboBoxRenderer(ComboBoxTreeDemo cbt)
                   this.cbt = cbt;
                   setLayout(new BorderLayout());
                   add(cbt.tree);
              public Component getListCellRendererComponent(JList list,Object value,int index, boolean isSelected,boolean cellHasFocus)
                   return this;
         public static void main(String[] args)
              javax.swing.SwingUtilities.invokeLater(new Runnable()
                   public void run()
                        createAndShowGUI();
    }

    Thank you for the excellent reference Peddi. I had played with the OAMessageChoiceBean component yesterday, but I was able to tell from your instructions that "Picklist Display Attribute" and "Picklist Value Attribute" really are not for binding to the database EO. That was the key piece of information that had me confused.
    In addition to adding the messageChoice component to the page, I needed to write some code to synchronize the picklist value with the corresponding code value, which I placed in am OAFormValueBean (hidden form field) which I could then bind to my application's database EO in the controller, running in the processFormRequest procedure:
    /** Synchronize the catalog code with the selected catalog name */
    protected void syncCatalogValues(OAPageContext pageContext,
    OAWebBean webBean, MyApplicationAMImpl am) {   
    OAMessageChoiceBean mcb =
    (OAMessageChoiceBean) webBean.findChildRecursive("CatalogName");
    OAFormValueBean cc =
    (OAFormValueBean) webBean.findChildRecursive("CatalogCode");
    String catalogDescription = mcb.getText(pageContext);
    if (catalogDescription != null) {
    String catalogCode = am.getCatalogCode(catalogDescription);
    cc.setValue(pageContext, catalogCode);
    Along with a little code to get the catalogCode value from the LOVVO, that's all it took.
    Thanks again. This was a great help.
    Pete

  • Alias in drop down fields of alv grid

    I'm using an ALV-Grid an have 3 Dropdown-Lists per Line. I can fill those without a problem. What i want to know is whether the method   CL_GUI_ALV_GRID->SET_DROP_DOWN_TABLE offers the alias list. Those values have a value and an alias. How do I get the 'INT_VALUE' from the drop-down-list item?
    if yes then how to implement it .
    helpful answers will be rewarded.

    Hi,
    U have to mark the field drdn_alias of the fieldcat. Like...
    <b>wa_fieldcat-drdn_hndl = '1'.
    wa_fieldcat-drdn_alias = 'X'.</b>
    And get the int_value [internal value] from the drop down like this....
    LOOP AT i_effest.
            READ TABLE i_drop_alias WITH KEY handle = '1'
                                             value  = i_effest-bolt_on
                                             INTO w_drop_alias.
            IF sy-subrc EQ 0.
              bolt_on =  w_drop_alias-int_value.
            ENDIF.
    ENDLOOP.
    -SatyaPriya

  • How do I use one drop down list to refresh the list in another drop down?

    I am using a drop down list full of years (i.e. 2008, 2009..etc). When I make my selection from this drop down list (say for instance I select 2009) I want it to update the available data in the second drop down list. I have the query statement set up within the JSP page but it needs to be a dynamic SQL statement based off the value I selected in the first drop down.
    String sql = "SELECT GameId, GameDescription FROM Games WHERE Year = " + year;
    The variable "year" is the value I need to figure out how to assign. Now this variable is a Java variable (attribute) and Im unsure how to get the value from the previous drop down and assign it to that. Basically I need the JavaScript value from the first drop down assigned to the Java attribute "year".
    Anyone able to help me with this???
    Thanks,
    Jed

    Here are my two drop down lists. As you can see I build the second list dynamically based off the value of the year. I want to be able to assign my year to the value I select in this first drop down. How do I do that?? I only want to show games for the year I select. I currently have the year hardcoded to "2009" as you see below. How can i change that to be assigned to the JavaScript value i extract from the first select box?
    <select name="season">
    <option value='2009' selected>2009</option>
    <option value='2008'>2008</option>
    </select>
    <select name="gameselect">
    <%
    try
    String year = "2009";
    String connectionURL = "jdbc:mysql://localhost:3306/ElmwoodExpos";
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection(connectionURL, "root", "thejedster");
    String sql = "SELECT GameId, GameDescription FROM Games WHERE Year = " + year;
    Statement s = con.createStatement();
    s.executeQuery(sql);
    ResultSet rs = s.getResultSet();
    while(rs.next())
    %>
    <option value="1"><% out.print(rs.getString("GameDescription"));%></option>
    <%
    catch(Exception e)
    %>
    </select>
    Thanks,
    Jed

  • Using a variable/drop down list in header of planning layout

    Dear all,
    I have created a simple BPS application for purely GL planning (No CO related objects like cost centre involved). I have the following characteristics in the header of the manuel planning layout.
    Business area
    Chart of accounts
    Company code
    Currency
    Currency Type
    Fiscal year
    Fiscal Year Variant
    Fiscal year/period
    Value type
    Version
    I have created variables for Business area, Fiscal Year, Fiscal Year Period, Posting Period and Version. The client wants either a variable or a drop down list for these characteristics in the header in the web application. When I assign a variable and put the characteristic in header, I get the error message in the web application saying header characteristic can only have a fixed value. Can someone tell me if it is possible and if so than how? I'll be very grateful for any inputs. Thanks a lot.
    Regards,
    Sumit

    Hi,
    When you create a variable, assign some values to the variable. These then become available in the drop down box. Ths first time a Web interface is called, these variable values are initial.As a result, u get the error messages. Select the variable values and then the error message should go away.
    Thanks,
    -NS

  • Unable to capture data from drop down list in custom added field in migo tcode at item level

    Hi guys,
    need bit help in resolving query related to custom added field in Tcode migo.
    i have added a field in migo at item level ,in this i have used drop down list
    to get data but unable to capture data from drop down list.gown through
    many blogs in scn but unable to resolve.
    Please help me out in this.
    Thanks,
    Umakant.

    Hi,
    U can use following code to fill the list box
    write this code in PBO
    In layout editor please select listbox in dropdown attribute of input field and put some fctcode attribute
    TYPE-POOLS vrm.
      DATA values TYPE vrm_values WITH HEADER LINE.
      TABLES: <ur custom Database table>.
      clear values, values[].
      SELECT * FROM <ur custom Database table>.
        values-text = <TABLE FIELD TO DISPLAY IN DROPDOWN> .
        values-key = <TABLE KEY FIELD TO DISPLAY IN DROPDOWN>.
        APPEND values.
      ENDSELECT.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = '<SCREEN INPUT FIELD NAME>'
          values          = values[]
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
    Also please define the following before accessing the listbox value
    data: <listbox input field name> type <table field name>,
            <inputfield name where text to display> type string  in top include
    In PAI, select the text from the table into <inputfield name where text to display>  depending on value selected which will be called when enter key is pressed or any vale is selected

  • How do I restore an old Iphone 3gs backup if it does not appear in the "restore backup" drop-down list?

    Hi
    Last night I tried to install ios 6.1.2. The install failed. I tried again and this time it recommended restoring the phone - I agreed and it worked, but after the restore was completed, I could not get out of the set-up assistant screens on the phone. It kept saying either connect to Itunes, or connected to Itunes - there was no conclusion of the set-up process.
    So again I chose to restore the phone - this time I got through the process and asked it to restore my last back up. It did so, but it turns out the back-up is empty. Looking at the time of the back-up, I think what happened is the phone  synced while it was stuck in the set-up assistant, and the old backup with all my data was overwritten with a new empty back up.
    If I use windows explorer I can see a back-up set from earlier in the evening that should contain all my data (6pm)  but when I look in iTunes that backup set is not available for selection in the "restore back-up" drop down list. Perhaps its only a partially completed backup, but at 1.55gb it sure contains a lot of valuable data. How can I make iTunes see or use the 6pm backup set?

    yes - sadly I think that's what happened. As the phone was connected, it was syncing and backing up automatically while I tried to complete the set-up process. So an empty back-up overwrote the full one. But the full back up is still there in the application data files - it must have done a back-up automatically before it restored the phone. So why can't I see it and use it in iTunes? Very frustrating!

Maybe you are looking for