Dynamic Selection Screen.
*& Report YABC
*&---------------------------------------------------------------------*
REPORT YABC.
class lcl_selscr DEFINITION.
PUBLIC SECTION.
class-DATA:
f_date_Text type char30.
CLASS-METHODS:
set_text
IMPORTING
if_name type char8
if_type type char1
if_text type char30,
change_screen.
PRIVATE SECTION.
class-DATA:
t_text type STANDARD TABLE OF RSSELTEXTS.
ENDCLASS. "lcl_selscr DEFINITION
*.... Selection Screen
SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE aaa.
PARAMETERS: p_so RADIOBUTTON GROUP rd1 DEFAULT 'X' USER-COMMAND USR1,
p_cre RADIOBUTTON GROUP rd1,
p_deb RADIOBUTTON GROUP rd1.
PARAMETERS: p_date type datum.
SELECTION-SCREEN: end of BLOCK blk1.
*.... Initialization
INITIALIZATION.
aaa = 'Select an option to continue'.
*.... At Selection-Screen Output
at SELECTION-SCREEN OUTPUT.
* text for Radiobuttons
lcl_selscr=>set_text( if_name = 'P_SO' if_type = 'P' if_TEXT = 'Sales Order' ).
lcl_selscr=>set_text( if_NAME = 'P_CRE' if_type = 'P' if_text = 'Credit memo' ).
lcl_selscr=>set_text( if_NAME = 'P_DEB' if_type = 'P' if_TEXT = 'Debit memo' ).
* determine the text for the P_DATE
CASE 'X'.
WHEN p_so. lcl_selscr=>f_date_text = 'Sales Order Entry Date'.
WHEN p_cre. lcl_selscr=>f_date_text = 'Credit Memo Entry Date'.
WHEN p_deb. lcl_selscr=>f_date_text = 'Debit Memo Entry Date'.
ENDCASE.
lcl_selscr=>set_text( if_name = 'P_DATE' if_type = 'P' if_TEXT = lcl_selscr=>f_date_text ).
* Change the Selection Screen
lcl_selscr=>change_screen( ).
*.... Start of selection
START-OF-SELECTION.
WRITE: 'Date Text', lcl_selscr=>f_date_text.
*----------------------------------------------------------------------*
* Selection Screen Class definition
*----------------------------------------------------------------------*
CLASS lcl_selscr IMPLEMENTATION.
METHOD set_text.
data: la_text LIKE LINE OF t_Text.
la_text-name = if_name.
la_text-KIND = if_type.
la_text-text = if_text.
APPEND la_text to t_text.
ENDMETHOD. "set_text
METHOD change_screen.
CALL FUNCTION 'SELECTION_TEXTS_MODIFY'
EXPORTING
PROGRAM = sy-cprog
TABLES
SELTEXTS = t_text.
ENDMETHOD. "change_screen
ENDCLASS
No comments:
Post a Comment