screen子窗口的切换

selection-screen子窗口

1:se51建立Ytest001的子屏幕0120, 在子屏的layout上面放如下4个控件

三个pushbutton:N1,N2,EXIT,和一个subscreen:A1。并在元素清单里添加ok_code.

2.flow logic代码:

PROCESS BEFORE OUTPUT.
call SUBSCREEN A1 INCLUDING sy-repid num1.
PROCESS AFTER
INPUT.
call SUBSCREEN A1.
module user_command_0100.

3Ytest001主代码如下:

REPORT   YTEST00A.
*定义子窗口800
selection-
screen begin of screen 800 as subscreen.
  
PARAMETERS: a1(10) TYPE c,
               a2(
10) TYPE c,
               a3(
10) TYPE c.
   SELECTION-
SCREEN END OF SCREEN 800.
*  定义子窗口900
   selection-
screen begin of screen 900 as subscreen.
  
PARAMETERS: b1(10) TYPE c,
               b2(
10) TYPE c,
               b3(
10) TYPE c.
   SELECTION-
SCREEN END OF SCREEN 900.
*  返回码
  
data : ok_code type sy-ucomm,
          save_ok
type sy-ucomm.
*    初始为窗口800
  
data:num1(4) type n value '800'.
*   启动120窗口
   start-
of-selection.
  
call SCREEN 120.
*   处理按钮事件
  
Module user_command_0100 input.
   save_ok = ok_code.
  
clear ok_code.
  
case save_ok.
*   第一个按钮调用800窗口
    
when 'S1'.
     num1 =
800.
*  调用900窗口
    
when 'S2'.
     num1 =
900.
    
when  'EXIT'.
leave program.
ENDCASE.
      
endmodule.

4.实现效果如下:

初始屏是0120800的组合,点击子窗口2后就会出现900屏的信息,

从而实现子窗口的切换。

posted @ 2011-08-21 23:00  VerySky  阅读(1302)  评论(0)    收藏  举报