DATA : lr_toolbar TYPE REF TO cl_gui_toolbar,
lr_cust_cont TYPE REF TO cl_gui_custom_container,
lt_btn TYPE ttb_button,
ls_btn TYPE stb_button.
CALL SCREEN 0001.
*&---------------------------------------------------------------------*
*& Module CREATE_PFSTATUS OUTPUT
*&---------------------------------------------------------------------*
MODULE create_pfstatus OUTPUT.
SET PF-STATUS 'STATUS'.
ENDMODULE. " CREATE_PFSTATUS OUTPUT
*&---------------------------------------------------------------------*
*& Module CREATE_TOOLBAR OUTPUT
*&---------------------------------------------------------------------*
MODULE create_toolbar OUTPUT.
IF lr_cust_cont IS NOT BOUND.
CREATE OBJECT lr_cust_cont
EXPORTING
container_name = 'TOOLBAR'
repid = sy-repid
dynnr = sy-dynnr.
ENDIF.
IF lr_toolbar IS NOT BOUND.
CREATE OBJECT lr_toolbar
EXPORTING
parent = lr_cust_cont
display_mode = cl_gui_toolbar=>m_mode_horizontal " Display mode
name = 'Demo Toolbar'
EXCEPTIONS
cntl_install_error = 1
cntl_error = 2
cntb_wrong_version = 3
OTHERS = 4.
ENDIF.
CLEAR : ls_btn.
ls_btn-butn_type = '0'.
ls_btn-function = 'TSAVE'.
ls_btn-icon = '@2L@'.
ls_btn-text = 'Save'.
APPEND ls_btn TO lt_btn.
CLEAR : ls_btn.
ls_btn-butn_type = '3'. "Separator
APPEND ls_btn TO lt_btn.
CLEAR : ls_btn.
ls_btn-butn_type = '0'.
ls_btn-function = 'EDIT'.
ls_btn-icon = '@TE@'.
ls_btn-text = 'Edit'.
APPEND ls_btn TO lt_btn.
CLEAR : ls_btn.
ls_btn-butn_type = '3'. " Separator
APPEND ls_btn TO lt_btn.
CLEAR : ls_btn.
ls_btn-butn_type = '0'.
ls_btn-function = 'TCANCEL'.
ls_btn-icon = '@0W@'.
ls_btn-text = 'Cancel'.
APPEND ls_btn TO lt_btn.
CALL METHOD lr_toolbar->add_button_group
EXPORTING
data_table = lt_btn
EXCEPTIONS
dp_error = 1
cntb_error_fcode = 2
OTHERS = 3.
ENDMODULE. " CREATE_TOOLBAR OUTPUT
*&---------------------------------------------------------------------*
*& Module HANDLE_USERACTION INPUT
*&---------------------------------------------------------------------*
MODULE handle_useraction INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " HANDLE_USERACTION INPUT
---------------------------------------------------------------------------------------------------------
Screen flow logic.
Screen layout with container.
lr_cust_cont TYPE REF TO cl_gui_custom_container,
lt_btn TYPE ttb_button,
ls_btn TYPE stb_button.
CALL SCREEN 0001.
*&---------------------------------------------------------------------*
*& Module CREATE_PFSTATUS OUTPUT
*&---------------------------------------------------------------------*
MODULE create_pfstatus OUTPUT.
SET PF-STATUS 'STATUS'.
ENDMODULE. " CREATE_PFSTATUS OUTPUT
*&---------------------------------------------------------------------*
*& Module CREATE_TOOLBAR OUTPUT
*&---------------------------------------------------------------------*
MODULE create_toolbar OUTPUT.
IF lr_cust_cont IS NOT BOUND.
CREATE OBJECT lr_cust_cont
EXPORTING
container_name = 'TOOLBAR'
repid = sy-repid
dynnr = sy-dynnr.
ENDIF.
IF lr_toolbar IS NOT BOUND.
CREATE OBJECT lr_toolbar
EXPORTING
parent = lr_cust_cont
display_mode = cl_gui_toolbar=>m_mode_horizontal " Display mode
name = 'Demo Toolbar'
EXCEPTIONS
cntl_install_error = 1
cntl_error = 2
cntb_wrong_version = 3
OTHERS = 4.
ENDIF.
CLEAR : ls_btn.
ls_btn-butn_type = '0'.
ls_btn-function = 'TSAVE'.
ls_btn-icon = '@2L@'.
ls_btn-text = 'Save'.
APPEND ls_btn TO lt_btn.
CLEAR : ls_btn.
ls_btn-butn_type = '3'. "Separator
APPEND ls_btn TO lt_btn.
CLEAR : ls_btn.
ls_btn-butn_type = '0'.
ls_btn-function = 'EDIT'.
ls_btn-icon = '@TE@'.
ls_btn-text = 'Edit'.
APPEND ls_btn TO lt_btn.
CLEAR : ls_btn.
ls_btn-butn_type = '3'. " Separator
APPEND ls_btn TO lt_btn.
CLEAR : ls_btn.
ls_btn-butn_type = '0'.
ls_btn-function = 'TCANCEL'.
ls_btn-icon = '@0W@'.
ls_btn-text = 'Cancel'.
APPEND ls_btn TO lt_btn.
CALL METHOD lr_toolbar->add_button_group
EXPORTING
data_table = lt_btn
EXCEPTIONS
dp_error = 1
cntb_error_fcode = 2
OTHERS = 3.
ENDMODULE. " CREATE_TOOLBAR OUTPUT
*&---------------------------------------------------------------------*
*& Module HANDLE_USERACTION INPUT
*&---------------------------------------------------------------------*
MODULE handle_useraction INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " HANDLE_USERACTION INPUT
---------------------------------------------------------------------------------------------------------
Screen flow logic.
Screen layout with container.
Execute the program.
No comments:
Post a Comment