Loop at screen会loop处理屏幕上的每一个组件,并对其做相应的处理。
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME.
PARAMETERS S_DATE TYPE DATUM DEFAULT SY-DATUM MODIF ID OO.
SELECTION-SCREEN: END OF BLOCK B1.
SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME.
SELECT-OPTIONS: S_DATE2 FOR SY-DATUM MODIF ID PP.
SELECTION-SCREEN: END OF BLOCK B2.
SELECTION-SCREEN: BEGIN OF BLOCK B3 WITH FRAME.
PARAMETERS : R1 RADIOBUTTON GROUP D1 DEFAULT 'X' USER-COMMAND SINGLECLICK,
R2 RADIOBUTTON GROUP D1 .
SELECTION-SCREEN: END OF BLOCK B3.
选择r1 的时候只显示B1;r2时候只显示B2
AT SELECTION-SCREEN OUTPUT.
IF R1 = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'PP'.
SCREEN-ACTIVE = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF R2 = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'OO'.
SCREEN-ACTIVE = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
Modiy屏幕的时候,如果屏幕有必输字段则不能修改,只有把必输项输入值后才能修改屏幕,需要有所取舍;
注意:
PARAMETERS : R1 RADIOBUTTON GROUP D1 DEFAULT 'X' USER-COMMAND SINGLECLICK, 红色这一段话必须有,否则不能动态修改屏幕;选择一次单选框就会触发一次atselection-screen output,实现