SAP Custom Splitter Container cl_gui_splitter_container ABAP Example Code
REPORT ZSPLITTERTEST.
DATA :
OK_CODE LIKE sy-ucomm,
SAVE_OK LIKE sy-ucomm.
DATA :
url(256) TYPE C,
init(1) TYPE C.
" cl_gui_custom_container container for hosting splitter
DATA cl_gui_custom_container_obj TYPE REF TO cl_gui_custom_container.
" cl_gui_splitter_container splitter container
DATA cl_gui_splitter_container_obj TYPE REF TO cl_gui_splitter_container.
" cl_gui_container objects for splitter
DATA cl_gui_container_1 TYPE REF TO cl_gui_container.
DATA cl_gui_container_2 TYPE REF TO cl_gui_container.
DATA cl_gui_container_3 TYPE REF TO cl_gui_container.
" cl_gui_picture objects
DATA cl_gui_picture_1 TYPE REF TO cl_gui_picture.
DATA cl_gui_picture_2 TYPE REF TO cl_gui_picture.
DATA cl_gui_picture_3 TYPE REF TO cl_gui_picture.
START-OF-SELECTION.
CALL SCREEN 100.
END-OF-SELECTION.
Code
MODULE STATUS_0100 OUTPUT.
SET TITLEBAR 'TITLE'.
SET PF-STATUS 'STATUS'.
IF init IS INITIAL.
CREATE OBJECT cl_gui_custom_container_obj EXPORTING container_name = 'CUSTOM'.
" Create SPLITTER and SPLITTER panes
CREATE OBJECT cl_gui_splitter_container_obj
EXPORTING parent = cl_gui_custom_container_obj
rows = 1
columns = 3.
CALL METHOD cl_gui_splitter_container_obj->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = cl_gui_container_1.
CALL METHOD cl_gui_splitter_container_obj->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = cl_gui_container_2.
CALL METHOD cl_gui_splitter_container_obj->get_container
EXPORTING
row = 1
column = 3
RECEIVING
container = cl_gui_container_3.
DATA repid TYPE sy-repid.
DATA dynnr TYPE sy-dynnr.
repid = sy-repid.
dynnr = sy-dynnr.
CREATE OBJECT cl_gui_picture_1 EXPORTING parent = cl_gui_container_1.
CREATE OBJECT cl_gui_picture_2 EXPORTING parent = cl_gui_container_2.
CREATE OBJECT cl_gui_picture_3 EXPORTING parent = cl_gui_container_3.
" Request an URL from the data provider by exporting the pic_data.
CLEAR url.
PERFORM load_pic_from_db CHANGING url.
" load picture
CALL METHOD cl_gui_picture_1->load_picture_from_url
EXPORTING
url = url.
CLEAR url.
url = 'file://C:\sap-logo.gif'.
CALL METHOD cl_gui_picture_2->load_picture_from_url
EXPORTING
url = url.
CLEAR url.
url = 'http://www.sap-press.com/images/logo_books_online_162_50.gif'.
CALL METHOD cl_gui_picture_3->load_picture_from_url
EXPORTING
url = url.
init = 'X'.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
Code
FORM load_pic_from_db CHANGING url.
DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
DATA html_table LIKE w3html OCCURS 1.
DATA return_code LIKE w3param-ret_code.
DATA content_type LIKE w3param-cont_type.
DATA content_length LIKE w3param-cont_len.
DATA pic_data LIKE w3mime OCCURS 0.
DATA pic_size TYPE i.
REFRESH query_table.
query_table-name = '_OBJECT_ID'.
query_table-value = 'ENJOYSAP_LOGO'.
APPEND query_table.
CALL FUNCTION 'WWW_GET_MIME_OBJECT'
TABLES
query_string = query_table
html = html_table
mime = pic_data
CHANGING
return_code = return_code
content_type = content_type
content_length = content_length
EXCEPTIONS
OBJECT_NOT_FOUND = 1
parameter_not_found = 2
OTHERS = 3.
IF sy-subrc = 0.
pic_size = content_length.
ENDIF.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'
subtype = cndp_sap_tab_unknown
size = pic_size
lifetime = cndp_lifetime_transaction
TABLES
data = pic_data
CHANGING
url = url
EXCEPTIONS
OTHERS = 1.
ENDFORM. " load_pic_from_db
Code
MODULE USER_COMMAND_0100 INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'EXIT' OR 'CNCL' OR 'BACK'.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Code