动态选择屏幕

 1 *&---------------------------------------------------------------------*
 2 *& Report  ZR001
 3 *&
 4 *&---------------------------------------------------------------------*
 5 *&
 6 *&
 7 *&---------------------------------------------------------------------*
 8 
 9 REPORT zrjyc001.
10 
11 
12 
13 *定义一个工作区
14 DATA: BEGIN OF gs_sel,
15   werks TYPE marc-werks,
16   matnr TYPE mara-matnr,
17   mtart TYPE mara-mtart,
18   beskz TYPE marc-beskz,
19   ersda TYPE mara-ersda,
20   END OF gs_sel.
21 
22 *定义选择屏幕块区域BLK1,其中包含两个radiobutton 和一个check box
23 
24 SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
25 PARAMETERS:p_but1 RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND cm1,
26            p_but2 RADIOBUTTON GROUP g1,
27            p_chek1 AS CHECKBOX DEFAULT 'X'.
28 SELECTION-SCREEN END OF BLOCK blk1.
29 
30 *定义选择屏幕块区域BLk2。
31 
32 SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
33 SELECT-OPTIONS:
34   s_werks FOR gs_sel-werks MODIF ID ty1 OBLIGATORY DEFAULT 9020,
35   s_matnr FOR gs_sel-matnr MODIF ID ty1,
36   s_mtart FOR gs_sel-mtart MODIF ID ty2,
37   s_beskz FOR gs_sel-beskz MODIF ID ty2,
38   s_ersda FOR gs_sel-ersda MODIF ID ty2.
39 SELECTION-SCREEN END OF BLOCK blk2.
40 
41 AT SELECTION-SCREEN OUTPUT.
42   IF p_but2 IS NOT INITIAL . "当p_but2被选中的时候,调用函数获取当前日期。
43     PERFORM frm_get_date.
44   ENDIF.
45 
46   LOOP AT SCREEN.
47     CASE screen-group1.
48       WHEN 'TY1'.
49         IF screen-name = 'S_MATNR-LOW'.
50           IF p_but1 IS NOT INITIAL. "当p_but1被选中时,设置S_MATNR-LOW必输项属性
51             screen-required = '2'.
52 *            MESSAGE 'aa' type 'E'.
53           ENDIF.
54         ENDIF.
55 
56       WHEN 'TY2'.
57         IF p_but2 IS INITIAL."当pub2未被选中时,不显示
58           screen-active = '0'.
59         ELSE.
60           screen-active = '1'.
61           IF screen-name = 'S_ERSDA-LOW'.
62             screen-required = '2'."当p_but2被选中时,设置S_ERSDA-LOW必输项属性
63           ENDIF.
64         ENDIF.
65     ENDCASE.
66     MODIFY SCREEN.
67   ENDLOOP.
68 
69 AT SELECTION-SCREEN ON s_ersda.
70   IF p_but2 IS NOT INITIAL AND
71     sy-ucomm <> 'CM1' AND s_ersda IS INITIAL.
72     MESSAGE e001(00) WITH text-003.
73   ENDIF.
74 
75 AT SELECTION-SCREEN ON s_matnr.
76   IF p_but1 IS NOT INITIAL AND
77      sy-ucomm <> 'CM1' AND s_matnr IS INITIAL.
78     MESSAGE e001(00) WITH text-003.
79   ENDIF.
80 
81 *&---------------------------------------------------------------------*
82 *&                FRM_GET_DATE
83 *&---------------------------------------------------------------------*
84 FORM frm_get_date.
85 *  REFRESH:s_ersda.
86   DELETE  s_ersda[]  WHERE  sign  EQ  space .
87   s_ersda-high = sy-datum.
88   CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
89     EXPORTING
90       date      = s_ersda-high
91       days      = '00'
92       months    = 3
93       signum    = '/'
94       years     = '00'
95     IMPORTING
96       calc_date = s_ersda-low.
97   APPEND s_ersda.
98 
99 ENDFORM.

 

上一篇:TWebBrowser 与 MSHTML(4): location、history、screen、navigator 对象的属性与方法纵览


下一篇:14.计分_1(添加Play按钮)