ALV Grid Dropdown Click Event

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.
Currently I am reacting to the DATA_CHANGED event of the ALV grid, but that is too late. This event is only triggered if you change the value of the dropdown and then hit enter, or click on another cell or row.
I want to be able to react to a change in the value immediately without having to lose focus of the dropdown.
Is this possible?
As an example, I have a table of records with one column as a dropdown called "Reason". A change in "reason" should change which fields in the row are editable. I'm sure I could just make sure to call the check_changed_data method before saving but I am hoping for a more user-friendly approach where as the new value is selected, the columns in the row can change to their required editable status.
Of course points will be awarded.

Hi David,
Instead of using delayed call back event here i hav used data_changed event and this exacty suits ur requirement.....
even here we have to register the edit events............
PROGRAM bcalv_edit_06.
* Purpose:
* ~~~~~~~~
* This example shows how to define a dropdown listbox for all cells
* of one column in an editable ALV Grid Control.
* To check program behavior
* ~~~~~~~~~~~~~~~~~~~~~~~~~
* Klick on the dropdown button of column 'WUNIT'. It shows
* 'KG' and 'G' as suitable units for luggage weight.
* (The standard F4-Help shows many other units that does not
* make sense in this context).
* Essential steps (search for '§')
* ~~~~~~~~~~~~~~~
* 1.Define a dropdown table and pass it to ALV.
* 2.Set status of column WUNIT to editable and set a dropdown handle.
CLASS lcl_event_responder DEFINITION.
  PUBLIC SECTION.
    METHODS refresh_changed_data  FOR EVENT data_changed
                                  OF cl_gui_alv_grid
                                  IMPORTING er_data_changed
                                            e_ucomm.
ENDCLASS.                    "event_responder DEFINITION
DATA: ok_code LIKE sy-ucomm,
      save_ok LIKE sy-ucomm,
      g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
      handler   TYPE REF TO lcl_event_responder,
      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,
      g_max TYPE i VALUE 100.
DATA: gt_outtab TYPE TABLE OF sbook.
*       MAIN                                                          *
END-OF-SELECTION.
  CALL SCREEN 100.
*       MODULE PBO OUTPUT                                             *
MODULE pbo OUTPUT.
  SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'MAIN100'.
  IF g_custom_container IS INITIAL.
    PERFORM create_and_init_alv CHANGING gt_outtab
                                         gt_fieldcat.
  ENDIF.
ENDMODULE.                    "pbo OUTPUT
*       MODULE PAI INPUT                                              *
MODULE pai INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'EXIT'.
      PERFORM exit_program.
    WHEN OTHERS.
*     do nothing
  ENDCASE.
ENDMODULE.                    "pai INPUT
*       FORM EXIT_PROGRAM                                             *
FORM exit_program.
  LEAVE PROGRAM.
ENDFORM.                    "exit_program
*&      Form  BUILD_FIELDCAT
*       text
*      <--P_GT_FIELDCAT  text
FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
  DATA ls_fcat TYPE lvc_s_fcat.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name = 'SBOOK'
    CHANGING
      ct_fieldcat      = pt_fieldcat.
  LOOP AT pt_fieldcat INTO ls_fcat.
    IF    ls_fcat-fieldname EQ 'WUNIT'.
*§2.Set status of column WUNIT to editable and set a dropdown handle.
      ls_fcat-edit = 'X'.
      ls_fcat-drdn_hndl = '1'.
      ls_fcat-outputlen = 7.
* Field 'checktable' is set to avoid shortdumps that are caused
* by inconsistend data in check tables. You may comment this out
* when the test data of the flight model is consistent in your system.
      ls_fcat-checktable = '!'.        "do not check foreign keys
      MODIFY pt_fieldcat FROM ls_fcat.
    ENDIF.
  ENDLOOP.
ENDFORM.                    "build_fieldcat
*&      Form  CREATE_AND_INIT_ALV
*       text
*      <--P_GT_OUTTAB  text
*      <--P_GT_FIELDCAT  text
*      <--P_GS_LAYOUT  text
FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
                                  pt_fieldcat TYPE lvc_t_fcat.
  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.
* Build fieldcat and set column WUNIT
* edit enabled. Assign a handle for the dropdown listbox.
  PERFORM build_fieldcat CHANGING pt_fieldcat.
* Optionally restrict generic functions to 'change only'.
*   (The user shall not be able to add new lines).
  PERFORM exclude_tb_functions CHANGING lt_exclude.
* Define a drop down table.
  PERFORM set_drdn_table.
  SELECT * FROM sbook INTO TABLE pt_outtab UP TO g_max ROWS.
  IF sy-subrc NE 0.
* generate own entries if database table is empty
    PERFORM generate_entries CHANGING pt_outtab.
  ENDIF.
  CALL METHOD g_grid->set_table_for_first_display
    EXPORTING
      it_toolbar_excluding = lt_exclude
    CHANGING
      it_fieldcatalog      = pt_fieldcat
      it_outtab            = pt_outtab.
* Set editable cells to ready for input initially
  CALL METHOD g_grid->set_ready_for_input
    EXPORTING
      i_ready_for_input = 1.
  g_grid->register_edit_event(
     EXPORTING
       i_event_id = cl_gui_alv_grid=>mc_evt_modified ). "Registering edit events
  CREATE OBJECT handler.
  SET HANDLER handler->refresh_changed_data FOR g_grid.
  CLEAR lt_f4.
  lt_f4-fieldname = 'WUNIT'.
  lt_f4-register = 'X'.
  APPEND lt_f4.
ENDFORM.                               "CREATE_AND_INIT_ALV
*&      Form  EXCLUDE_TB_FUNCTIONS
*       text
*      <--P_LT_EXCLUDE  text
FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions.
* Only allow to change data not to create new entries (exclude
* generic functions).
  DATA ls_exclude TYPE ui_func.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
  APPEND ls_exclude TO pt_exclude.
ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
*&      Form  set_drdn_table
*       text
*  -->  p1        text
*  <--  p2        text
FORM set_drdn_table.
*§1.Define a dropdown table and pass it to ALV.
*   One listbox is referenced by a handle, e.g., '1'.
*   For each entry that shall appear in this listbox
*   you have to append a line to the dropdown table
*   with handle '1'.
*   This handle can be assigned to several columns
*   of the output table using the field catalog.
  DATA: lt_dropdown TYPE lvc_t_drop,
        ls_dropdown TYPE lvc_s_drop.
* First listbox (handle '1').
  ls_dropdown-handle = '1'.
  ls_dropdown-value = 'KG'.
  APPEND ls_dropdown TO lt_dropdown.
  ls_dropdown-handle = '1'.
  ls_dropdown-value = 'G'.
  APPEND ls_dropdown TO lt_dropdown.
  CALL METHOD g_grid->set_drop_down_table
    EXPORTING
      it_drop_down = lt_dropdown.
ENDFORM.                               " set_drdn_table
*&      Form  generate_entries
*       text
*      <--P_LT_SLFIGHT  text
FORM generate_entries CHANGING pt_sbook TYPE STANDARD TABLE.
* This form is only needed if database table sbook is empty.
* It generates some entries so that you may
* still try out this example program.
  DATA: ls_sbook TYPE sbook,
        l_month(2) TYPE c,
        l_day(2) TYPE c,
        l_date(8) TYPE c,
     l_prebookid TYPE i.
  ls_sbook-carrid = 'LH'.
  ls_sbook-connid = '0400'.
  ls_sbook-forcurkey = 'DEM'.
  ls_sbook-loccurkey = 'USD'.
  ls_sbook-custtype = 'B'.
  DO 110 TIMES.
    l_prebookid = sy-index.
    ls_sbook-forcuram = sy-index * 10.
    ls_sbook-loccuram = ls_sbook-loccuram * 2.
    ls_sbook-customid = sy-index.
    ls_sbook-counter = 18.
    ls_sbook-agencynum = 11.
    l_month = sy-index / 10 + 1.
    DO 2 TIMES.
      l_day = 3 + l_month + sy-index * 2.
      l_date+0(4) = '2000'.
      l_date+4(2) = l_month.
      l_date+6(2) = l_day.
      ls_sbook-fldate = l_date.
      SUBTRACT 3 FROM l_day.
      ls_sbook-order_date+0(6) = l_date+0(6).
      ls_sbook-order_date+6(2) = l_day.
      ls_sbook-bookid = l_prebookid * 2 + sy-index.
      IF sy-index EQ 1.
        ls_sbook-smoker = 'X'.
      ELSE.
        ls_sbook-smoker = space.
      ENDIF.
      ls_sbook-luggweight = l_prebookid * 10.
      IF ls_sbook-luggweight GE 1000.
        ls_sbook-wunit = 'G'.
        ls_sbook-class = 'C'.
      ELSE.
        ls_sbook-wunit = 'KG'.
        ls_sbook-class = 'Y'.
      ENDIF.
      IF ls_sbook-bookid > 40 AND ls_sbook-wunit EQ 'KG'.
        ls_sbook-invoice = 'X'.
      ENDIF.
      IF ls_sbook-bookid EQ 2.
        ls_sbook-cancelled = 'X'.
        ls_sbook-class = 'F'.
      ENDIF.
      APPEND ls_sbook TO pt_sbook.
    ENDDO.
  ENDDO.
ENDFORM.                               " generate_entries
*       CLASS event_responder IMPLEMENTATION
CLASS lcl_event_responder IMPLEMENTATION.
  METHOD refresh_changed_data.
    BREAK-POINT.  
  ENDMETHOD.                    "click
ENDCLASS.                    "event_responder IMPLEMENTATION

Similar Messages

  • ALV GRID  - double click event - hot spot event

    Dear developers
    I am building a custom application using ALV GRID (OO method).
    I have three ALV's on the screen.
    User selects a cell on the first ALV from the list. say a specific product group.
    The second ALV displays the product records depnding on selection of first ALV. (this works fine).
    when the user selects a cell of a specific column on ALV grid 2 using double click event or hotspot I am always getting row ID as 1 , irrespective of the user clickin on row 2 or 3 on the specific cell.
    To carry out further processing , I need to get the exact row the user is selecting which I expected to be available in LVC_S_ROID. My further process works always with ROW ID as 1.
    I am using event hot spot in alv grid 1. In grid 2 I tried both hot spot and double click . But both returns the index value of row as 1 , irrespective of the cell being clicked is beyond row 1. in second grid.
    Looking forward for help or suggestion on this,
    Regards
    Kumar

    Hi
    The handler is implemented as follows for all ALV GRIDs.
    I give below only the relevant one grid 2 from my code.
    Class definition
    **03/17/2005 skulist hotspot
    handle_skulist FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING e_row_id e_column_id es_row_no,
    Class implementation
    **03/17/2005 sku list by currency hotspot on listprice
      METHOD handle_skulist .
        PERFORM handle_skulist USING e_row_id e_column_id es_row_no.
      ENDMETHOD.                    "HANDLE_HOTSPOT_CLICK
    DATA gr_event_handler TYPE REF TO lcl_event_handler.
    DATA gr_event_handler_4 TYPE REF TO lcl_event_handler.
    The above are done in an include and are public in nature.
    Also note that I have similar implementation for similar events for grid 1 bu the event handlers are registered in different names.
    The code below is in the maib program , under a custom container for grid 2
    CREATE OBJECT gr_event_handler_4.
        SET HANDLER gr_event_handler_4->handle_skulist FOR gr_alvgrid1.
    *Based on the user action on grid 2 this form is getting executed. But as I said earlier the parameter I am getting for index is 1 always.
    FORM handle_skulist USING i_row_id1 TYPE lvc_s_row
                                    i_column_id1 TYPE lvc_s_col
                                    is_row_no1 TYPE lvc_s_roid.

  • ALV OOPS Double-click event

    Hi,
    I want to handle the double-click event in ALV grid (OOPs).
    The output should be shown in the same fashion as it is shown in SE16 when we double-click on any record in the result set.
    i.e. if you have selected the ALV grid display for the Data browser in SE16 and when you double click on any record, the complete record is shown in a window.
    I want this in my ALV as well..
    Can anyone please suggest how to achieve this?
    Regards
    s.a.k

    Hi siemens.a.k ,
    The solution for the issue would be to create a  custom screen and add a custom table controller in a container.
    In this table controller you map the respective fields required for your output
    Now once you are done with data population in the custom controller for ALV grid display using cl_gui_alv_grid_display class...
    create events in your custom class to handle the on click event.
    If you observe the standard functionality it could be clearly seen that sap has created another screen for the display of records in different view.
    You could also replicate the similar thing by creating another screen and populating the required fields into the second screen.
    As of now i am providing this information ...I would even try to simulate the scenario at my system.
    So once i am done i would update you the same...
    Thanks
    M.Naveen Kumar....

  • ALV Class Double click event

    Hi All,
    I have created an alv report using alv class. I have handled the double click event in that i am calling transaction using row currenlty selected. But after doing subtotalling the list and then i double click a line it is passing wrong data.
    Points are awarded,
    Regards,
    Bharat Mistry
    Message was edited by: Bharat Mistry

    Hi Bharat,
    Read the internal table contents in double click event with e_row-index , then you will get the data of that particular row.
    check below code :
    local class to handle semantic checks
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    DATA: g_event_receiver TYPE REF TO lcl_event_receiver.
    LOCAL CLASS Definition
    *§4.Define and implement event handler to handle event DATA_CHANGED.
    CLASS lcl_event_receiver DEFINITION.
      public section.
        METHODS:
          handle_double_click
                 FOR EVENT double_click OF cl_gui_alv_grid
                 IMPORTING e_row e_column.
    ENDCLASS.
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_double_click.
      read table gt_outtab index e_row-index into
    Regards
    Appana
    *Reward Points for helpful answers
    Message was edited by: L Appana

  • ALV Grid Handle Edit Event (Lost Focus)

    Hi all,
    I have some problems with the ALV Grid.
    Target:
    I have an ALV Grid with editable Column. If the user insert, update or delete the content of the column and leave the column (column lost focus) i'd like to do somthing - this means I need a event for this action. Can anybody help me to solve this problem?
    Thanks Stefan

    Use Event data_changed and data_changed_finished of the cl_gui_alv_grid.Then all you have to do is registering your event to the ALV and fill the methods with what you want to do.In ALV Grid, There is no event to capture the lost focus of a column if you don't modify it.
    CLASS lcl_event_receiver DEFINITION.
        METHODS:
    *$ Check the change
           handle_data_changed FOR EVENT data_changed
                                   OF cl_gui_alv_grid
                               IMPORTING er_data_changed
                                         e_ucomm
                                         e_onf4
                                         e_onf4_before
                                         e_onf4_after,
           handle_data_changed_finished
                               FOR EVENT data_changed_finished
                                   OF cl_gui_alv_grid
                                IMPORTING e_modified
                                         et_good_cells
                                         sender,
    ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION

  • ALV grid row selection event

    Hi,
    I have alv grid using cl_gui_alv_grid. I want to capture the row selection event and display the detail below the table.
    how do I capture the row selection.? I want to display the details below as and when the row selection changed.
    Regards
    Panneer

    More detail example, also works with multiple selections:
    data go_alv type ref to cl_gui_alv_grid.
    data go_handler type ref to lcl_event_receiver.
    *       CLASS lcl_event_receiver DEFINITION
    class lcl_event_receiver definition.
      public section.
        methods delayed_change_select
                for event delayed_changed_sel_callback of cl_gui_alv_grid.
    endclass.                    "lcl_event_receiver DEFINITION
    *       CLASS lcl_event_receiver IMPLEMENTATION
    class lcl_event_receiver implementation.
      method delayed_change_select.
        message 'Selection changed' type 'S'.
      endmethod.                    "delayed_change_selection
    endclass.                    "lcl_event_receiver IMPLEMENTATION
    *&      Module  STATUS_0100  OUTPUT
    module status_0100 output.
      data lt_fcat_lvc type lvc_t_fcat.
      data lt_fcat_alv type slis_t_fieldcat_alv.
      data ls_layo type lvc_s_layo.
      set pf-status 'MAIN'.
      if go_alv is initial.
        ls_layo-sel_mode = 'A'.
    *   ls_layo-sel_mode = 'B'.    "Also works
    *   ls_layo-sel_mode = 'C'.    "Also works
    *   ls_layo-sel_mode = 'D'.    "Also works
        call method go_alv->set_table_for_first_display
          exporting
            is_layout       = ls_layo
          changing
            it_fieldcatalog = lt_fcat_lvc
            it_outtab       = gt_data[].
        create object go_handler.
        set handler go_handler->delayed_change_select for go_alv.
        call method go_alv->register_delayed_event
          exporting
            i_event_id = cl_gui_alv_grid=>mc_evt_delayed_change_select.
      endif.
    endmodule.                 " STATUS_0100  OUTPUT

  • Alv grid dropdown boxes

    hi friends pls tell
    its urgent
    HOW TO PROVIDE DROP OWN BOXES IN ALV GRID FOR PARTICULAR COLUMN OR CELL  .

    check the below links
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm
    dropdown list on screen
    mark the helpful answers
    ~~Guduri

  • Sorting ALV grid by clicking on header.

    Hey everyone.
    I've got a report displaying an ALV grid where I really don't want to have the toolbar for it showing, so i've taken that out. But I would like to be able to sort the data in the grid by clicking on a field in the header.
    I've seen this in some standard SAP programs, is it very easy to implement?
    Any help much appreciated,
    Cheers.

    Hi,
    Go through the following link.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    hope it helps.
    Regards
    Rajesh Kumar

  • ALV Grid: Unregister keyboard events?

    Hi guys,
    once again I've got some trouble with my ALV-grid control.
    In order to implement my own functionality for removing and adding lines to my alv grid I removed the standard-buttons from the toolbar and added my own.
    Unfortunately the user can still remove lines from the alv by pressing the DEL key on the keyboard.
    Adjusting the layout by setting   ps_layout-no_rowins   =  'X' and ps_layout-no_rowmove  =  'X' doesn't work for me since the alv contains a field CHDATE to show the date when the line was last edited. If the user presses the DEL key there's no way for me to adjust this field.
    So, does anyone have an idea how to "unregister" these keyevents?
    Any help is much appreciated!
    Best regards,
    ron

    Hi guys,
    i just found a way to prevent the deletion of a line by pressing DEL on the keyboard.
    All you have to do is include an additional field (type LVC_T_STYL) to your outtab.
    This structure include the following fields:
    FIELDNAME     LVC_FNAME
    STYLE     LVC_STYLE
    STYLE2     LVC_STYLE
    STYLE3     LVC_STYLE
    STYLE4     LVC_STYLE
    MAXLEN     INT4
    This structures is normally used to set the style for a cell by specifying the FIELDNAME.
    When FIELDNAME is initial the style works for the line. So instead of changing the fieldname just leave it blank and change STYLE to cl_gui_alv_grid=>MC_STYLE_NO_DELETE_ROW
    This way the line can neither be removed with the standard "REMOVE LINE"-button nor by pressing DEL.
    Keep in mind that it doesn't work when you change the layout to layout-no_rowins   =  'X' and layout-no_rowmove  =  'X'.
    Regards,
    Ron

  • ALV-Grid (OO): trigger event CHANGED_DATA when creating/filling grid table

    Hi there,
    I have a grid table being filled of which I know, that it doesn't contain all necessary data to allow the user to continue.
    As there are no mandatory flags to the fields I want to call a method (e.g. SET_DELTA_CELLS: it's marked INTERNAL only and doesn't seam to work anyway) to emulate user input or just trigger the event DATA_CHANGED.
    I also thought about using method ADD_ROWS, but I don't need excess rows that I need to remove again.
    What other possibilities are there?

    >
    Alan Downing wrote:
    > Hi Prabhu,
    >
    > thanks for your answer.
    > Alas, it would require the user to actively change a field and press ENTER or change a cell in order for DATA_CHANGED to being fired.
    >
    > The point is, that I need to check certain data independent of user action (change of cell data). If the user presses the save/ok/continue button he must not be allowed to continue unless all data of the grid is filled where required.
    >
    > regards
    > Alan
    Hi Alan,
    You could write a subroutine which will do all the validations and call this subroutine for every user action for which you think the data should be validated. You could pass the old and new table to this subroutine and compare the values to see if the requirement is fulfilled and the data is valid.
    Hope this helps.
    Best regards,
    Advait

  • ALV-Grid:  Is it possible to catch "LOCAL Function Codes" in any Event ??

    Hi,
    is it possible that i can catch a "Local Function Code" in ALV Grid with an Event??
    For example if you click to an Grid Button on the toolbar than it must call an Event!
    ..........BUTTON: Local APPEND (existing in ALV Toolbar)
    Function Code: '&LOCAL&APPEND'
    My Idea is:
    --- IF i click to the Button "Local APPEND" in the ALV toolbar, than it must after this command give me an Message( "It was Successfull" ).
    But the "Local Function Codes" dont called the Event "User_command" OR "After_user_command" is there any other Event for this "Local Function Codes"???
    Have anyone an idea?
    Thanks in forward.
    Ersin

    Hi,
    See following thread.
    http://scn.sap.com/thread/715996
    Thanks
    Santosh

  • Problem in handling double click in the second alv grid control

    Hi all,
    I have a screen. In the screen , I have 2 custom container and each custom container has 1 alv grid control.
    I need to handle double click event for both of alv grid controls in my screen.
    I defined 2 local event handler class for each alv grid and defined 2 handle_double_click event.
    In the first Alv grid double click works fine , everything is ok, world is peaceful.
    But in the second alvgrid, the row parameters (E_ROW, E_COLUMN, ES_ROW_NO) comes initial so i cannot handle it.
    All i need is to call a different transaction (displaying the equipment-IE03) when user double-click on a field in the second alv grid control. I tried to use hotspot_click event too but it does'nt give the row id either.
    I read some posts in the forms ([Double click event of alv grid control|Double click event of alv grid control]).
    I tried everything but nothing works.
    Please help. Your answers will be appreciated.

    Hello Eagle
    I am not sure where the problem lies in your case but sample report ZUS_SDN_THREE_ALV_GRIDS_01 shows that you can always find out the current cell after the double-click event (in any case you have the current cell already as IMPORTING parameters of the event):
    *& Report  ZUS_SDN_THREE_ALV_GRIDS_01
    *& Flow logic of screen '0100' (no screen elements, ok-code => GD_OKCODE):
    **    PROCESS BEFORE OUTPUT.
    **      MODULE STATUS_0100.
    **    PROCESS AFTER INPUT.
    **      MODULE USER_COMMAND_0100.
    *& Thread: problem in handling double click in the second alv grid control
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1172052"></a>
    REPORT  zus_sdn_three_alv_grids_01.
    DATA:
      gd_okcode        TYPE ui_func,
      gd_repid         TYPE syst-repid,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_splitter      TYPE REF TO cl_gui_splitter_container,
      go_splitter_2    TYPE REF TO cl_gui_splitter_container,
      go_cell_top      TYPE REF TO cl_gui_container,
      go_cell_bottom   TYPE REF TO cl_gui_container,
      go_cell_left     TYPE REF TO cl_gui_container,
      go_cell_right    TYPE REF TO cl_gui_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid,
      go_grid3         TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_outtab        TYPE STANDARD TABLE OF vbak,
      gt_outtab_2      TYPE STANDARD TABLE OF vbap,
      gt_outtab_3      TYPE STANDARD TABLE OF vbep.
    **PARAMETERS:
    **  p_bukrs          TYPE bukrs  DEFAULT '1000'.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          ms_row      TYPE lvc_s_row,
          ms_col      TYPE lvc_s_col.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          ls_outtab      TYPE vbak,
          ls_outtab_2    TYPE vbap,
          ls_outtab_3    TYPE vbep.
        "   Initialize class data
        CLEAR: ms_row,
               ms_col.
        CASE sender.
          WHEN go_grid1.
            ms_row = e_row.
            ms_col = e_column.
    *       Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code
              EXPORTING
                new_code = 'GET_ITEMS'
    *          IMPORTING
    *            rc       =
          WHEN go_grid2.
            ms_row = e_row.
            ms_col = e_column.
    *       Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code
              EXPORTING
                new_code = 'GET_SCHEDULE_LINES'
    *          IMPORTING
    *            rc       =
          WHEN go_grid3.
    **        READ TABLE gt_vbap INTO ls_vbap INDEX e_row-index.
    **        CHECK ( ls_vbap-matnr IS NOT INITIAL ).
    **        SET PARAMETER ID 'MAT' FIELD ls_vbap-matnr.
    **        CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
          WHEN OTHERS.
            RETURN.
        ENDCASE.
      ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  vbak INTO TABLE gt_outtab UP TO 100 ROWS.
      PERFORM init_controls.
    * Display data
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBAK'
        CHANGING
          it_outtab        = gt_outtab
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      REFRESH: gt_outtab_2.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBAP'
        CHANGING
          it_outtab        = gt_outtab_2    " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      REFRESH: gt_outtab_3.
      CALL METHOD go_grid3->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBEP'
        CHANGING
          it_outtab        = gt_outtab_3    " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Link the docking container to the target dynpro
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * NOTE: dynpro does not contain any elements
      CALL SCREEN '0100'.
    * Flow logic of dynpro:
    *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'.  " contains push button "ORDERS"
    *  SET TITLEBAR 'xxx'.
    * Refresh display of detail ALV list
      CALL METHOD go_grid2->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Refresh display of detail ALV list
      CALL METHOD go_grid3->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        " Double-click on first or second ALV grid
        WHEN 'GET_ITEMS'  OR
             'GET_SCHEDULE_LINES'.
          PERFORM get_details.
        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 NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create splitter container
      CREATE OBJECT go_splitter
        EXPORTING
          parent            = go_docking
          rows              = 1
          columns           = 2
    *      NO_AUTODEF_PROGID_DYNNR =
    *      NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Get cell container
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_left.
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 2
        RECEIVING
          container = go_cell_right.
    * Create 2nd splitter container
      CREATE OBJECT go_splitter_2
        EXPORTING
          parent            = go_cell_left
          rows              = 2
          columns           = 1
    *      NO_AUTODEF_PROGID_DYNNR =
    *      NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Get cell container
      CALL METHOD go_splitter_2->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_top.
      CALL METHOD go_splitter_2->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = go_cell_bottom.
    * Create ALV grids
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent = go_cell_top
        EXCEPTIONS
          OTHERS   = 5.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT go_grid2
        EXPORTING
          i_parent = go_cell_bottom
        EXCEPTIONS
          OTHERS   = 5.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT go_grid3
        EXPORTING
          i_parent = go_cell_right
        EXCEPTIONS
          OTHERS   = 5.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Set event handler
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid2.
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid3.
    ENDFORM.                    " INIT_CONTROLS
    *&      Form  GET_DETAILS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM get_details .
    * define local data
      DATA: ls_row      TYPE lvc_s_row,
            ls_col      TYPE lvc_s_col.
      data: ls_outtab   type vbak,
            ls_outtab_2 type vbap,
            ls_outtab_3 type vbep.
      BREAK-POINT.
      CASE gd_okcode.
        WHEN 'GET_ITEMS'.
          CALL METHOD go_grid1->get_current_cell
            IMPORTING
    *          e_row     =
    *          e_value   =
    *          e_col     =
              es_row_id = ls_row
              es_col_id = ls_col
    *          es_row_no =
          read TABLE gt_outtab into ls_outtab index ls_row-index.
          refresh: gt_outtab_2,
                   gt_outtab_3.
          SELECT        * FROM  vbap into TABLE gt_outtab_2
                 WHERE  vbeln  = ls_outtab-vbeln.
        WHEN 'GET_SCHEDULE_LINES'.
          CALL METHOD go_grid2->get_current_cell
            IMPORTING
    *          e_row     =
    *          e_value   =
    *          e_col     =
              es_row_id = ls_row
              es_col_id = ls_col
    *          es_row_no =
          READ TABLE gt_outtab_2 into ls_outtab_2 index ls_row-index.
          refresh: gt_outtab_3.
          SELECT        * FROM  vbep into TABLE gt_outtab_3
                 WHERE  vbeln  = ls_outtab_2-vbeln
                 AND    posnr  = ls_outtab_2-posnr.
        WHEN OTHERS.
          RETURN.
      ENDCASE.
      IF ( lcl_eventhandler=>ms_row = ls_row  AND
           lcl_eventhandler=>ms_col = ls_col ).
        MESSAGE 'Current cell identical'  TYPE 'I'.
      ELSE.
        MESSAGE 'Current cell NOT identical'  TYPE 'I'.
      ENDIF.
    ENDFORM.                    " GET_DETAILS
    Regards
      Uwe

  • Report with 5 ALV grids on 1 screen

    I am trying to build a screen/report with 5 ALV grids which are interactive. One grid will display all sales order. When I click on a Sales order Hotspot, the items of the sales order would appear in the ALV grid box below.
    When i click on an sales order item hotspot, i want the delivery information in another alv grid in the same screen.
    There should be 2 more grids - one displaying the customer information -name,address, in one grid and one grid for open items if any. Any advice is welcome . Should I be creating a split container/docking container or multiple containers ? Sample code is welcome.
    Edited by: Shareen Hegde on Apr 2, 2008 9:25 PM

    Hello Shareen
    Below I have added my sample report ZUS_SDN_THREE_ALV_GRIDS showing three interactive ALV grids. Perhaps it might be useful to you. I would prefer one or multiple splitter containers over multiple "stand-alone" containers.
    *& Report  ZUS_SDN_THREE_ALV_GRIDS
    *& Display Customer data in three ALV lists:
    *& 1st ALV: Customers
    *& 2nd ALV: Sales order of selected customer (double-click)
    *& 3rd ALV: Positions   of selected sales order (double-click)
    *&          Double-click on material -> display material (MM02)
    *& NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
    *& Flow logic of dynpro '0100':
    *&PROCESS BEFORE OUTPUT.
    *&  MODULE STATUS_0100.
    *&PROCESS AFTER INPUT.
    *&  MODULE USER_COMMAND_0100.
    REPORT  zus_sdn_three_alv_grids.
    DATA:
      gd_okcode        TYPE ui_func,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_splitter      TYPE REF TO cl_gui_splitter_container,
      go_splitter_2    TYPE REF TO cl_gui_splitter_container,
      go_cell_top      TYPE REF TO cl_gui_container,
      go_cell_bottom   TYPE REF TO cl_gui_container,
      go_cell_left     TYPE REF TO cl_gui_container,
      go_cell_right    TYPE REF TO cl_gui_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid,
      go_grid3         TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1,
      gt_vbak          TYPE STANDARD TABLE OF vbak,
      gt_vbap          TYPE STANDARD TABLE OF vbap.
    PARAMETERS:
      p_bukrs          TYPE bukrs  DEFAULT '1000'.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender.  " sending control, i.e. ALV grid that raised event
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          ls_knb1      TYPE knb1,
          ls_vbak      TYPE vbak,
          ls_vbap      TYPE vbap.
    *   Distinguish according to sending grid instance
        CASE sender.
          WHEN go_grid1.
            READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
            CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
            CALL METHOD go_grid1->set_current_cell_via_id
              EXPORTING
    *              IS_ROW_ID    =
    *              IS_COLUMN_ID =
                is_row_no    = es_row_no.
    *         Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDERS' ).
          WHEN go_grid2.
            READ TABLE gt_vbak INTO ls_vbak INDEX e_row-index.
            CHECK ( ls_vbak-vbeln IS NOT INITIAL ).
            CALL METHOD go_grid1->set_current_cell_via_id
              EXPORTING
    *              IS_ROW_ID    =
    *              IS_COLUMN_ID =
                is_row_no    = es_row_no.
    *         Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).
          WHEN go_grid3.
            READ TABLE gt_vbap INTO ls_vbap INDEX e_row-index.
            CHECK ( ls_vbap-matnr IS NOT INITIAL ).
            SET PARAMETER ID 'MAT' FIELD ls_vbap-matnr.
            CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
          WHEN OTHERS.
            RETURN.
        ENDCASE.
      ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = p_bukrs.
    * 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 splitter container
      CREATE OBJECT go_splitter
        EXPORTING
          parent            = go_docking
          rows              = 1
          columns           = 2
    *      NO_AUTODEF_PROGID_DYNNR =
    *      NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_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.
    * Get cell container
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_left.
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 2
        RECEIVING
          container = go_cell_right.
    * Create 2nd splitter container
      CREATE OBJECT go_splitter_2
        EXPORTING
          parent            = go_cell_left
          rows              = 2
          columns           = 1
    *      NO_AUTODEF_PROGID_DYNNR =
    *      NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_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.
    * Get cell container
      CALL METHOD go_splitter_2->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_top.
      CALL METHOD go_splitter_2->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = go_cell_bottom.
    * Create ALV grids
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_cell_top
        EXCEPTIONS
          OTHERS            = 5.
      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 OBJECT go_grid2
        EXPORTING
          i_parent          = go_cell_bottom
        EXCEPTIONS
          OTHERS            = 5.
      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 OBJECT go_grid3
        EXPORTING
          i_parent          = go_cell_right
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Set event handler
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid2.
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid3.
    * Display data
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNB1'
        CHANGING
          it_outtab        = gt_knb1
        EXCEPTIONS
          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.
      REFRESH: gt_vbak.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBAK'
        CHANGING
          it_outtab        = gt_vbak    " empty !!!
        EXCEPTIONS
          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.
      REFRESH: gt_vbap.
      CALL METHOD go_grid3->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBAP'
        CHANGING
          it_outtab        = gt_vbap    " empty !!!
        EXCEPTIONS
          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.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          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.
    * NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
      CALL SCREEN '0100'.
    * Flow logic of dynpro:
    *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'.  " contains push button "ORDERS"
    *  SET TITLEBAR 'xxx'.
    * Refresh display of detail ALV list
      CALL METHOD go_grid2->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          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.
    * Refresh display of detail ALV list
      CALL METHOD go_grid3->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          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.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
    *   User has pushed button "Display Orders"
        WHEN 'ORDERS'.
          PERFORM customer_show_orders.
        WHEN 'ORDER_DETAILS'.
          PERFORM order_show_details.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  CUSTOMER_SHOW_ORDERS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM customer_show_orders .
    * define local data
      DATA:
        ld_row      TYPE i,
        ls_knb1     TYPE knb1.
      CALL METHOD go_grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT        * FROM  vbak INTO TABLE gt_vbak
             WHERE  kunnr  = ls_knb1-kunnr.
      REFRESH: gt_vbap.
    ENDFORM.                    " CUSTOMER_SHOW_ORDERS
    *&      Form  ORDER_SHOW_DETAILS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM order_show_details .
    * define local data
      DATA:
        ld_row      TYPE i,
        ls_vbak     TYPE vbak.
      CALL METHOD go_grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_vbak INTO ls_vbak INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT        * FROM  vbap INTO TABLE gt_vbap
             WHERE  vbeln  = ls_vbak-vbeln.
    ENDFORM.                    " ORDER_SHOW_DETAILS
    Regards
      Uwe

  • Calling smartform and displaying ALV grid in ABAP WEBDYNPRO

    Hi all,
    I am new to ABAP web dynpro.I ahve few custom reports which are simple ALV list reports which I now need to convert to ABAP web dynpro application .
    For one particular report,based on the selection screen input,I need to display the ALV list and when I select the records from the ALV list,I need to call a smartform on clik of a push button.
    My questions:
    1. Im using 'REUSE_ALV_GRID_DISPLAY' FM  to display the o/p in my report.Is there any similar FM in webdynpro ABAP which will display my list in ALV GRID in my web dynpro application??/
    2. How to call a smartfrm in ALV grid in web dynpro??
    Edited by: abap_1000 on Jan 9, 2011 6:09 PM

    Hi,
    You can search SDN, there are several posts available. Just to get some idea, you can check --
    [Beginneru00B4s questions on WDA ALV;
    [Reg ALV Display;
    For clicking event on ALV --
    [Reg Row Data fetching on click in ALV;
    For ALV display on WDA --
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110?quicklink=index&overridelayout=true]
    Thanks.
    Kumar Saurav.

  • Splitter and DOUBLE-CLICK event

    I ahev a splitter that displays two ALV grids. With event DOUBLE_CLICK I want to be able to detrmine which grid caused the double_click as I wanted to use one method with conditional logic so some of code could be generic. How would I do this or is it simply better to have two methods double_lclick for grid1 & double_click for grid2 and set handler for each event ?

    Hello Jonathan
    There is a very simple solution to your problem. When you define the event handler methods (e.g. HANDLE_DOUBLE_CLICK) simply add the optional parameter <b>SENDER </b>which is the control that has raised the event.
    For details refer to my previous post in
    How to handle two hot spot clicks on one screen
    Regards
      Uwe

Maybe you are looking for

  • I cannot get a signal from my MacBook Pro to a Samsung T220HD using an HDMI cable

    I was in the Apple store to see how to improve the resolution on my Samsung T220HD, which I had connected to my MacBook Pro using the PC cable and an Mini DisplayPort adaptor.  The staff recommended I buy a Kanex Mini DisplayPort to HDMI Cable instea

  • How does conversion work?

    Hello all, Just wanted to clarify how does conversion process work? Can you explain situations where it directly picks up from legacy system and in which situations Excel Spreadsheet is required. I appreciate your it. Thanks, JEss..

  • Ask the BT chairman to take a look at this forum

    First off I will say that there are lots of very helpful people on this forum, it's the only good thing about BT. Someone should get the chairman of BT to look at this forum, he should see the huge about of unhappy customers. Customers that have a pr

  • Calling Methods in BADI

    Hi, Can anyone tell me how to invoke a method in a BADI from another method which is in the same class. Sample code will be more useful. Thanks Sowmmya VB

  • Best setting for web?

    I am trying to load a picture up to the web and the ones I have loaded have poor resolution. can someone please give me suggestions on what setting I should use from I-PHOTO for the best resolution. Thanks JIm