ABAP多标签选择屏幕的使用

REPORT zzzzz.

DATA: g_dynnr LIKE sy
-dynnr. "当前屏幕的编号

"定义两个子屏幕
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
PARAMETERS p_file TYPE tabname.
SELECTION
-SCREEN END OF SCREEN 100.

SELECTION
-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
PARAMETERS p_file2 TYPE tabname.
SELECTION
-SCREEN END OF SCREEN 300.

"将两个屏幕合并到TAB里面
"
类似于通常的BEGIN OF BLOCK
"
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE title1.

SELECTION
-SCREEN BEGIN OF TABBED BLOCK mytab FOR 11 LINES.
SELECTION
-SCREEN TAB (20) text1 USER-COMMAND but1.
SELECTION
-SCREEN TAB (20) text2 USER-COMMAND but2.
SELECTION
-SCREEN END OF BLOCK mytab.

INITIALIZATION .
text1
='ONE'.
text2
='TWO'.

mytab
-prog = sy-repid.
"初始化屏幕0100
IF g_dynnr = space.
mytab
-dynnr =100.
mytab
-activetab ='BUT1'.
ENDIF.

AT SELECTION
-SCREEN. "PAI
CASE sy-dynnr.
WHEN
1000.
CASE sy
-ucomm.
WHEN
'BUT1'.
mytab
-dynnr =100.
WHEN
'BUT2'.
mytab
-dynnr =300.
WHEN OTHERS.
ENDCASE.
ENDCASE.

AT SELECTION
-SCREEN OUTPUT. "PBO

START
-OF-SELECTION.
CASE mytab
-dynnr.
WHEN
100.
MESSAGE
'100' TYPE 'S' DISPLAY LIKE 'S'.
WHEN
300.
MESSAGE
'300' TYPE 'S' DISPLAY LIKE 'S'.
ENDCASE.
posted @ 2011-04-26 09:55  Leo Tin  阅读(985)  评论(0编辑  收藏  举报