SPLITTING CUSTOM CONTAINER BY SPLITTER CONTAINER AND DISPLAYING INTERACTIVE ALV


DATA : it_spfli TYPE TABLE OF spfli,
wa_spfli TYPE spfli,
it_sflight TYPE TABLE OF sflight,
wa_sflight TYPE sflight,
o_cust TYPE REF TO cl_gui_custom_container,
o_spli TYPE REF TO cl_gui_splitter_container,
o_ref1 TYPE REF TO cl_gui_container,
o_ref2 TYPE REF TO cl_gui_container,
o_alv1 TYPE REF TO cl_gui_alv_grid,
o_alv2 TYPE REF TO cl_gui_alv_grid,
ok_code TYPE sy-ucomm.

CLASS handle_event DEFINITION.
PUBLIC SECTION.
CLASS-METHODS handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid 

                  IMPORTING e_row.
ENDCLASS.                    “HANDLE_EVENT DEFINITION

CLASS handle_event IMPLEMENTATION.
METHOD handle_double_click.
READ TABLE it_spfli INTO wa_spfli INDEX e_row.SELECT * FROM sflight INTO TABLE it_sflight WHERE carrid = wa_spfli-carrid.
IF o_alv2 IS NOT BOUND.
CREATE OBJECT o_alv2
EXPORTING
i_parent = o_ref2.

CALL METHOD o_alv2->set_table_for_first_display
EXPORTING
i_structure_name = ‘SFLIGHT’
CHANGING
it_outtab        = it_sflight.
ENDIF.

CALL METHOD o_alv2->refresh_table_display.
ENDMETHOD.                    “HANDLE_DOUBLE_CLICK
ENDCLASS.                    “HANDLE_EVENT IMPLEMENTATION

START-OF-SELECTION.
PERFORM fetch_data_from_spfli.
CALL SCREEN 100.

*———————————————————————-*
FORM fetch_data_from_spfli .
SELECT * FROM spfli INTO TABLE it_spfli.
ENDFORM.                    ” FETCH_DATA_FROM_SPFLI

MODULE status_0100 OUTPUT.
SET PF-STATUS ‘STATUS’.
SET TITLEBAR ‘TITLE’.

ENDMODULE.                 ” STATUS_0100  OUTPUT

MODULE split_container OUTPUT.
IF o_cust IS NOT BOUND.
CREATE OBJECT o_cust
EXPORTING
container_name = ‘CONTAINER’.

CREATE OBJECT o_spli
EXPORTING
parent  = o_cust
rows    = 2
columns = 1.
CALL METHOD o_spli->get_container
EXPORTING
row       = 1
column    = 1
RECEIVING
container = o_ref1.

CALL METHOD o_spli->get_container
EXPORTING
row       = 2
column    = 1
RECEIVING
container = o_ref2.

ENDIF.
ENDMODULE.                 ” SPLIT_CONTAINER  OUTPUT

MODULE display_alv OUTPUT.
IF o_alv1 IS NOT BOUND.
CREATE OBJECT o_alv1
EXPORTING
i_parent = o_ref1.
SET HANDLER handle_event=>handle_double_click FOR o_alv1.
CALL METHOD o_alv1->set_table_for_first_display
EXPORTING
i_structure_name = ‘SPFLI’
CHANGING
it_outtab        = it_spfli.
ENDIF.
ENDMODULE.                 ” DISPLAY_ALV  OUTPUT

MODULE user_command_0100 INPUT.
CASE  ok_code.
WHEN ‘BACK’.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.                 ” USER_COMMAND_0100  INPUT

  SCREEN 100 FLOW LOGIC

PROCESS BEFORE OUTPUT.
MODULE status_0100.
MODULE split_container.
MODULE display_alv.

PROCESS AFTER INPUT.
MODULE user_command_0100.


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s