Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV on Subscreen

Former Member
0 Kudos

Hi,

i have an Problem with handle Events from ALV in an Subscreen.

I have create the eventhandle and have set it to my ALV on the subscreen. But the event doesn't raise.

Where have I to implement this handler? It can't be the same as in normal Screens. There it runs without any Problems.

Where are the differents?

Thanks,

Peter

1 REPLY 1

MarcinPciak
Active Contributor
0 Kudos

Peter,

This is implemented similary to main screen's ALV. Actually there is no difference for the system whether AVL is embeded in main screen or a subscreen. The handler must be correctly set and that's it. Refer below program. It uses ALV in subscreen and the event handling works fine


"program
CLASS cl_ev_handler DEFINITION.
  PUBLIC SECTION.
    METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
                              IMPORTING e_row e_column es_row_no.
ENDCLASS.                    "cl_ev_handler DEFINITION


CLASS cl_ev_handler IMPLEMENTATION.
  METHOD handle_double_click .
    DATA: l_mess TYPE string,
          l_row(2) TYPE c.

    DATA: it_sub TYPE lvc_t_grpl.

    WRITE es_row_no-row_id TO l_row.
    CONCATENATE 'Double click at: ' e_column-fieldname 'in'
                                     l_row 'row.'
                                     INTO l_mess SEPARATED BY space.
    MESSAGE l_mess TYPE 'I'.
  ENDMETHOD .                    "handle_double_click
ENDCLASS.                    "cl_ev_handler IMPLEMENTATION


DATA: r_cc_container TYPE REF TO cl_gui_custom_container.
DATA: r_alv_grid TYPE REF TO cl_gui_alv_grid.
DATA  r_ev_handler TYPE REF TO cl_ev_handler.

DATA: it_sflight TYPE TABLE OF sflight.

START-OF-SELECTION.

  SELECT * FROM sflight INTO TABLE it_sflight UP TO 10 ROWS.

  CALL SCREEN 100.

"subscreen's pbo (0101)
MODULE pbo_subscreen OUTPUT.

  IF r_cc_container IS INITIAL.
    CREATE OBJECT r_cc_container
      EXPORTING
        container_name    = 'CCONTAINER'.

    CREATE OBJECT r_alv_grid
      EXPORTING
       i_parent           = r_cc_container.

    CALL METHOD r_alv_grid->set_table_for_first_display
      EXPORTING
        i_structure_name = 'SFLIGHT'
      CHANGING
        it_outtab        = it_sflight.

    CREATE OBJECT r_ev_handler.
    SET HANDLER r_ev_handler->handle_double_click FOR r_alv_grid.
  ENDIF.
ENDMODULE.       


"screen 100 (main screen) flow layout
PROCESS BEFORE OUTPUT.
  CALL SUBSCREEN area INCLUDING sy-repid '0101'.       

Regards

Marcin