report ztest .
TABLES: vbak, ltak.
DATA:
err_sw.
PARAMETERS: rb1 RADIOBUTTON GROUP rb1 USER-COMMAND sel DEFAULT 'X'.
PARAMETERS: rb2 RADIOBUTTON GROUP rb1.
SELECTION-SCREEN: SKIP 1.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_auart FOR vbak-auart DEFAULT 'ZRE'
NO INTERVALS MODIF ID rb1.
SELECT-OPTIONS: s_date FOR vbak-erdat MODIF ID rb1.
SELECTION-SCREEN: END OF BLOCK b1.
SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
SELECT-OPTIONS: s_tanum FOR ltak-tanum MODIF ID rb2.
SELECT-OPTIONS: s_bdatu FOR ltak-bdatu MODIF ID rb2.
SELECTION-SCREEN: END OF BLOCK b2.
AT SELECTION-SCREEN OUTPUT.
IF rb1 = 'X'.
PERFORM hide_rb2_options.
ELSE.
PERFORM hide_rb1_options.
ENDIF.
INITIALIZATION.
START-OF-SELECTION.
CLEAR err_sw.
IF rb1 = 'X'.
IF s_auart IS INITIAL
OR s_date IS INITIAL.
MESSAGE i208(00) WITH 'Required field not entered'.
err_sw = 'X'.
ENDIF.
ELSE.
IF s_tanum IS INITIAL
OR s_bdatu IS INITIAL.
MESSAGE i208(00) WITH 'Required field not entered'.
err_sw = 'X'.
ENDIF.
ENDIF.
CHECK err_sw NE 'X'.
WRITE:/ 'Hi!'.
*&---------------------------------------------------------------------*
*& Form hide_rb2_options
*&---------------------------------------------------------------------*
FORM hide_rb2_options.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'RB1'.
screen-active = 1.
MODIFY SCREEN.
WHEN 'RB2'.
screen-active = 0.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
ENDFORM. " hide_rb2_options
*&---------------------------------------------------------------------*
*& Form hide_rb1_options
*&---------------------------------------------------------------------*
FORM hide_rb1_options.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'RB2'.
screen-active = 1.
MODIFY SCREEN.
WHEN 'RB1'.
screen-active = 0.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
ENDFORM. " hide_rb1_options
ALSO READ:
- Selection Screen With Push Buttons.
- Selection Screen Events.
- Selection Screen With Push Buttons With Events.
- Display LOGO On Selection Screen.
- Selection Screen Listbox From Table Entries.
TABLES: vbak, ltak.
DATA:
err_sw.
PARAMETERS: rb1 RADIOBUTTON GROUP rb1 USER-COMMAND sel DEFAULT 'X'.
PARAMETERS: rb2 RADIOBUTTON GROUP rb1.
SELECTION-SCREEN: SKIP 1.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_auart FOR vbak-auart DEFAULT 'ZRE'
NO INTERVALS MODIF ID rb1.
SELECT-OPTIONS: s_date FOR vbak-erdat MODIF ID rb1.
SELECTION-SCREEN: END OF BLOCK b1.
SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
SELECT-OPTIONS: s_tanum FOR ltak-tanum MODIF ID rb2.
SELECT-OPTIONS: s_bdatu FOR ltak-bdatu MODIF ID rb2.
SELECTION-SCREEN: END OF BLOCK b2.
AT SELECTION-SCREEN OUTPUT.
IF rb1 = 'X'.
PERFORM hide_rb2_options.
ELSE.
PERFORM hide_rb1_options.
ENDIF.
INITIALIZATION.
START-OF-SELECTION.
CLEAR err_sw.
IF rb1 = 'X'.
IF s_auart IS INITIAL
OR s_date IS INITIAL.
MESSAGE i208(00) WITH 'Required field not entered'.
err_sw = 'X'.
ENDIF.
ELSE.
IF s_tanum IS INITIAL
OR s_bdatu IS INITIAL.
MESSAGE i208(00) WITH 'Required field not entered'.
err_sw = 'X'.
ENDIF.
ENDIF.
CHECK err_sw NE 'X'.
WRITE:/ 'Hi!'.
*&---------------------------------------------------------------------*
*& Form hide_rb2_options
*&---------------------------------------------------------------------*
FORM hide_rb2_options.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'RB1'.
screen-active = 1.
MODIFY SCREEN.
WHEN 'RB2'.
screen-active = 0.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
ENDFORM. " hide_rb2_options
*&---------------------------------------------------------------------*
*& Form hide_rb1_options
*&---------------------------------------------------------------------*
FORM hide_rb1_options.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'RB2'.
screen-active = 1.
MODIFY SCREEN.
WHEN 'RB1'.
screen-active = 0.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
ENDFORM. " hide_rb1_options
ALSO READ:
- Selection Screen With Push Buttons.
- Selection Screen Events.
- Selection Screen With Push Buttons With Events.
- Display LOGO On Selection Screen.
- Selection Screen Listbox From Table Entries.
hi venkat,
ReplyDeletethis post is very useful, thnx a ton.
good program
ReplyDeleteThanks very much. Nice piece of code.
ReplyDeleteI came across this site while finding answer to my interview question. i am glad i found it.
ReplyDelete