*&---------------------------------------------------------------------*
*& Global Declarations *
*&---------------------------------------------------------------------*
* Class Definitions
CLASS screen_handler DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
CLASS-DATA screen TYPE REF TO screen_handler.
CLASS-METHODS create_screen.
METHODS constructor.
PRIVATE SECTION.
DATA: container_html TYPE REF TO cl_gui_custom_container,
container_box TYPE REF TO cl_gui_dialogbox_container,
picture TYPE REF TO cl_gui_picture,
tree TYPE REF TO cl_gui_simple_tree,
html_viewer TYPE REF TO cl_gui_html_viewer,
list_viewer TYPE REF TO cl_gui_alv_grid.
METHODS: fill_tree,
fill_picture,
handle_node_double_click
FOR EVENT node_double_click OF cl_gui_simple_tree
IMPORTING node_key,
close_box
FOR EVENT close OF cl_gui_dialogbox_container,
fill_html IMPORTING i_carrid TYPE spfli-carrid,
fill_list IMPORTING i_carrid TYPE spfli-carrid
i_connid TYPE spfli-connid.
ENDCLASS.
* Class Implementations
CLASS screen_handler IMPLEMENTATION.
METHOD create_screen.
IF screen IS INITIAL.
CREATE OBJECT screen.
ENDIF.
ENDMETHOD.
METHOD constructor.
DATA: l_event_tab TYPE cntl_simple_events,
l_event LIKE LINE OF l_event_tab,
l_docking TYPE REF TO cl_gui_docking_container,
l_splitter TYPE REF TO cl_gui_splitter_container,
l_container_screen TYPE REF TO cl_gui_custom_container,
l_container_top TYPE REF TO cl_gui_container,
l_container_bottom TYPE REF TO cl_gui_container.
CREATE OBJECT tree
EXPORTING parent = l_container_bottom
node_selection_mode =
cl_gui_simple_tree=>node_sel_mode_single.
l_event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
l_event-appl_event = ' '. "system event, does not trigger PAI
APPEND l_event TO l_event_tab.
CALL METHOD tree->set_registered_events
EXPORTING events = l_event_tab.
SET HANDLER me->handle_node_double_click FOR tree.
METHOD fill_tree.
DATA: l_node_table TYPE TABLE OF abdemonode,
l_node TYPE abdemonode,
l_spfli TYPE spfli,
l_spfli_tab TYPE SORTED TABLE OF spfli
WITH UNIQUE KEY carrid connid.
SELECT carrid connid
FROM spfli
INTO CORRESPONDING FIELDS OF TABLE l_spfli_tab.
l_node-hidden = ' '. " All nodes are visible,
l_node-disabled = ' '. " selectable,
l_node-isfolder = 'X'. " a folder,
l_node-expander = ' '. " have no '+' sign for expansion.
LOOP AT l_spfli_tab INTO l_spfli.
AT NEW carrid.
l_node-node_key = l_spfli-carrid.
CLEAR l_node-relatkey.
CLEAR l_node-relatship.
l_node-text = l_spfli-carrid.
l_node-n_image = ' '.
l_node-exp_image = ' '.
APPEND l_node TO l_node_table.
ENDAT.
AT NEW connid.
CONCATENATE l_spfli-carrid l_spfli-connid INTO l_node-node_key.
l_node-relatkey = l_spfli-carrid.
l_node-relatship = cl_gui_simple_tree=>relat_last_child.
l_node-text = l_spfli-connid.
l_node-n_image = '@AV@'. "AV is the internal code
l_node-exp_image = '@AV@'. "for an airplane icon
ENDAT.
APPEND l_node TO l_node_table.
ENDLOOP.
METHOD fill_list.
DATA: l_flight_tab TYPE TABLE OF demofli,
BEGIN OF l_flight_title,
carrname TYPE scarr-carrname,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
END OF l_flight_title,
l_list_layout TYPE lvc_s_layo.
IF container_box IS INITIAL.
CREATE OBJECT container_box
EXPORTING width = 250
height = 200
top = 100
left = 400
caption = 'Flight List'.
SET HANDLER close_box FOR container_box.
CREATE OBJECT list_viewer
EXPORTING i_parent = container_box.
ENDIF.
SELECT SINGLE c~carrname p~cityfrom p~cityto
INTO CORRESPONDING FIELDS OF l_flight_title
FROM ( scarr AS c
INNER JOIN spfli AS p ON c~carrid = p~carrid )
WHERE p~carrid = i_carrid AND
p~connid = i_connid.
SELECT fldate seatsmax seatsocc
INTO CORRESPONDING FIELDS OF TABLE l_flight_tab
FROM sflight
WHERE carrid = i_carrid AND connid = i_connid
ORDER BY fldate.
CONCATENATE l_flight_title-carrname
i_connid
l_flight_title-cityfrom
l_flight_title-cityto
INTO l_list_layout-grid_title SEPARATED BY space.
l_list_layout-smalltitle = 'X'. "The list title has small fonts,
l_list_layout-cwidth_opt = 'X'. "the column width is adjusted,
l_list_layout-no_toolbar = 'X'. "the toolbar is suppressed.
*&---------------------------------------------------------------------*
*& Processing Blocks called by the Runtime Environment *
*&---------------------------------------------------------------------*
* Event Block LOAD-OF-PROGRAM
LOAD-OF-PROGRAM.
CALL SCREEN 100.
* Dialog Module PBO
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
SET TITLEBAR 'TIT_100'.
CALL METHOD screen_handler=>create_screen.
ENDMODULE.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.