参考选择屏幕(控制选择屏幕两个屏幕,单值输入……通过函数实现单值输入)详解编程语言

参考选择屏幕(控制选择屏幕两个屏幕,单值输入……通过函数实现单值输入)详解编程语言参考选择屏幕(控制选择屏幕两个屏幕,单值输入……通过函数实现单值输入)详解编程语言

  1 TABLES:likp,vbap,vbak,vttp. 
  2 DATA:gl_restrict TYPE sscr_restrict. 
  3  
  4 SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN. 
  5 SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001. 
  6 SELECT-OPTIONS: s_vstel FOR likp-vstel NO INTERVALS,               "装运点 
  7                 s_lfdat FOR likp-lfdat NO INTERVALS    NO-EXTENSION ,                            "交货日期 
  8                 s_lfart FOR likp-lfart DEFAULT 'LF' NO INTERVALS MODIF ID lf,              "交货类型 
  9                 s_prodh FOR vbap-prodh NO INTERVALS,                          "产品层次 
 10                 s_vbeln1 FOR likp-vbeln,                                       "交货单号 
 11                 s_vtweg FOR vbak-vtweg NO INTERVALS.                          "销售渠道 
 12  
 13 SELECTION-SCREEN BEGIN OF BLOCK bk2 WITH FRAME TITLE text-002. 
 14 * 配送方式 
 15 SELECTION-SCREEN BEGIN OF LINE. 
 16 SELECTION-SCREEN COMMENT 1(8) text-003. 
 17 SELECTION-SCREEN POSITION 33. 
 18 PARAMETERS r_rd1 RADIOBUTTON GROUP sg1 DEFAULT 'X' USER-COMMAND rd_click. 
 19 SELECTION-SCREEN COMMENT 34(4) text-004 FOR FIELD r_rd1. 
 20 SELECTION-SCREEN POSITION 45. 
 21 PARAMETERS r_rd2 RADIOBUTTON GROUP sg1. 
 22 SELECTION-SCREEN COMMENT 46(4) text-005 FOR FIELD r_rd2. 
 23 SELECTION-SCREEN END OF LINE. 
 24 * 拣配状态 
 25 SELECTION-SCREEN BEGIN OF LINE. 
 26 SELECTION-SCREEN COMMENT 1(8) text-006. 
 27 SELECTION-SCREEN POSITION 33. 
 28 PARAMETERS p_ck1 AS CHECKBOX. 
 29 SELECTION-SCREEN COMMENT 34(4) text-007 FOR FIELD p_ck1. 
 30 SELECTION-SCREEN POSITION 45. 
 31 PARAMETERS p_ck2 AS CHECKBOX. 
 32 SELECTION-SCREEN COMMENT 46(4) text-008 FOR FIELD p_ck2. 
 33 SELECTION-SCREEN END OF LINE. 
 34  
 35 SELECTION-SCREEN END OF BLOCK bk2. 
 36 SELECTION-SCREEN END OF BLOCK bk1. 
 37 SELECTION-SCREEN END OF SCREEN 100. 
 38  
 39 * subscreen 200 
 40 SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN. 
 41 SELECTION-SCREEN BEGIN OF BLOCK bk3 WITH FRAME TITLE text-015. 
 42 PARAMETERS: p_vbeln TYPE likp-vbeln   MODIF ID mop. 
 43 SELECTION-SCREEN: PUSHBUTTON 63(5) pubu USER-COMMAND mailbutt. 
 44 SELECT-OPTIONS: s_vbeln FOR likp-vbeln NO-DISPLAY. 
 45 SELECTION-SCREEN END OF BLOCK bk3. 
 46 SELECTION-SCREEN END OF SCREEN 200. 
 47  
 48 * tab screen 
 49 SELECTION-SCREEN: BEGIN OF TABBED BLOCK mytab FOR 25 LINES, 
 50                   TAB (20) button1 USER-COMMAND push1, 
 51                   TAB (20) button2 USER-COMMAND push2, 
 52                   END OF BLOCK mytab. 
 53  
 54 INITIALIZATION. 
 55   PERFORM frm_set_tab. 
 56   PERFORM frm_select_option. 
 57  
 58 AT SELECTION-SCREEN OUTPUT. 
 59   PERFORM frm_output_set. 
 60  
 61 *&---------------------------------------------------------------------* 
 62 *& 参数输入检查 
 63 *&---------------------------------------------------------------------* 
 64 AT SELECTION-SCREEN. 
 65   PERFORM frm_set_screen. 
 66 *&---------------------------------------------------------------------* 
 67 *&      Form  frm_set_tab 
 68 *&---------------------------------------------------------------------* 
 69 *       text 
 70 *----------------------------------------------------------------------* 
 71 FORM frm_set_tab. 
 72   DATA: lv_tab TYPE char1. 
 73  
 74   button1 = '查询1'. 
 75   button2 = '查询2'. 
 76   mytab-prog = sy-repid. 
 77   IMPORT p1 = lv_tab FROM MEMORY ID 'ZDQWM_099_TAB'. 
 78   IF lv_tab IS INITIAL. 
 79     mytab-dynnr = 100. 
 80     mytab-activetab = 'PUSH1'. 
 81   ELSE. 
 82     IF lv_tab = 'A'. 
 83       mytab-dynnr = 100. 
 84       mytab-activetab = 'PUSH1'. 
 85     ENDIF. 
 86     IF lv_tab = 'B'. 
 87       mytab-dynnr = 200. 
 88       mytab-activetab = 'PUSH2'. 
 89     ENDIF. 
 90   ENDIF. 
 91 *  mytab-dynnr = 100. 
 92 *  mytab-activetab = 'PUSH1'. 
 93 ENDFORM.                    "frm_set_tab 
 94 *&---------------------------------------------------------------------* 
 95 *&      Form  frm_set_screen 
 96 *&---------------------------------------------------------------------* 
 97 *       text 
 98 *----------------------------------------------------------------------* 
 99 FORM frm_set_screen. 
100  
101   CASE sy-ucomm. 
102     WHEN 'PUSH1'. 
103       mytab-dynnr = 100. 
104       EXPORT p1 = 'A' TO MEMORY ID 'ZDQWM_099_TAB'. 
105     WHEN 'PUSH2'. 
106       mytab-dynnr = 200. 
107       EXPORT p1 = 'B' TO MEMORY ID 'ZDQWM_099_TAB'. 
108     WHEN 'MAILBUTT'. 
109       PERFORM show_box. 
110  
111     WHEN OTHERS. 
112       ... 
113   ENDCASE. 
114  
115 ENDFORM.                    "frm_set_screen 
116 *&---------------------------------------------------------------------* 
117 *&      Form  FRM_OUTPUT_SET 
118 *&---------------------------------------------------------------------* 
119 *       text 
120 *----------------------------------------------------------------------* 
121 *  -->  p1        text 
122 *  <--  p2        text 
123 *----------------------------------------------------------------------* 
124 FORM frm_output_set . 
125   IF p_vbeln IS INITIAL. 
126     WRITE icon_enter_more  AS ICON TO pubu. 
127   ELSE. 
128     WRITE icon_display_more AS ICON TO pubu. 
129   ENDIF. 
130 ENDFORM.                    " FRM_OUTPUT_SET 
131  
132 *&---------------------------------------------------------------------* 
133 *&      Form  frm_select_option 
134 *&---------------------------------------------------------------------* 
135 *       text 
136 *----------------------------------------------------------------------* 
137 FORM frm_select_option. 
138  
139   REFRESH gl_restrict-ass_tab. 
140   PERFORM frm_set_key USING 'KEY1' 'S_VSTEL'. 
141   PERFORM frm_set_key USING 'KEY2' 'S_PRODH'. 
142   PERFORM frm_set_key USING 'KEY3' 'S_VTWEG'. 
143   PERFORM frm_set_key USING 'KEY4' 'S_LFART'. 
144   PERFORM frm_set_key USING 'KEY10' 'S_VBELN2'. 
145 *    PERFORM frm_set_key USING 'KEY11' 'S_POS'. 
146   CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'                 "只执行一次 
147     EXPORTING 
148       restriction            = gl_restrict 
149     EXCEPTIONS 
150       too_late               = 1 
151       repeated               = 2 
152       selopt_without_options = 3 
153       selopt_without_signs   = 4 
154       invalid_sign           = 5 
155       empty_option_list      = 6 
156       invalid_kind           = 7 
157       repeated_kind_a        = 8 
158       OTHERS                 = 9. 
159   IF sy-subrc <> 0. 
160     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno 
161     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. 
162   ENDIF. 
163  
164 ENDFORM.                    "frm_select_option 
165 *&---------------------------------------------------------------------* 
166 *&      Form  frm_set_key 
167 *&---------------------------------------------------------------------* 
168 *       text 
169 *----------------------------------------------------------------------* 
170 *      -->L_KEY      text 
171 *      -->L_NAME     text 
172 *----------------------------------------------------------------------* 
173 FORM frm_set_key USING l_key l_name. 
174   DATA: wl_restrict TYPE sscr_restrict, 
175         wl_optlist TYPE sscr_opt_list, 
176         wl_ass TYPE sscr_ass. 
177  
178   CONSTANTS:  cl_s TYPE char1 VALUE 'S', 
179               cl_x TYPE c VALUE 'X', 
180               cl_i TYPE char1 VALUE 'I'. 
181  
182   wl_optlist-name = l_key.      "选项框id,不同select-option不能重复 
183   wl_optlist-options-eq = cl_x. 
184   APPEND wl_optlist TO gl_restrict-opt_list_tab. 
185   CLEAR: wl_optlist. 
186  
187   wl_ass-kind = cl_s. 
188   wl_ass-name = l_name.   "select-option id 
189   wl_ass-sg_main = cl_i. 
190   wl_ass-sg_addy = space. 
191   wl_ass-op_main = l_key. 
192   APPEND wl_ass TO gl_restrict-ass_tab. 
193   CLEAR: wl_ass. 
194 ENDFORM.                    "frm_set_key 
195 *&---------------------------------------------------------------------* 
196 *&      Form  SHOW_BOX 
197 *&---------------------------------------------------------------------* 
198 *       text 
199 *----------------------------------------------------------------------* 
200 *  -->  p1        text 
201 *  <--  p2        text 
202 *----------------------------------------------------------------------* 
203 FORM show_box . 
204   DATA: wh_excluded_options TYPE rsoptions. 
205   DATA: w_message TYPE char100. 
206 *输入单值,排除其他 
207   wh_excluded_options-ne = 'X'. 
208   wh_excluded_options-bt = 'X'. 
209   wh_excluded_options-nb = 'X'. 
210   wh_excluded_options-ge = 'X'. 
211   wh_excluded_options-gt = 'X'. 
212   wh_excluded_options-le = 'X'. 
213   wh_excluded_options-lt = 'X'. 
214   wh_excluded_options-cp = 'X'. 
215   wh_excluded_options-np = 'X'. 
216  
217   CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG' 
218     EXPORTING 
219       title             = '批量处理' 
220       just_incl         = 'X'         "只有包含输入 
221       excluded_options  = wh_excluded_options 
222     TABLES 
223       range             = s_vbeln 
224     EXCEPTIONS 
225       no_range_tab      = 1 
226       cancelled         = 2 
227       internal_error    = 3 
228       invalid_fieldname = 4 
229       OTHERS            = 5. 
230   IF sy-subrc <> 0. 
231     IF sy-subrc = 2. 
232       MESSAGE '取消批量处理' TYPE 'S'. 
233       EXIT. 
234     ENDIF. 
235     CALL FUNCTION 'MESSAGE_TEXT_BUILD' 
236       EXPORTING 
237         msgid               = sy-msgid 
238         msgnr               = sy-msgno 
239         msgv1               = sy-msgv1 
240         msgv2               = sy-msgv2 
241         msgv3               = sy-msgv3 
242         msgv4               = sy-msgv4 
243       IMPORTING 
244         message_text_output = w_message. 
245     MESSAGE w_message TYPE 'S' DISPLAY LIKE 'E'. 
246     EXIT. 
247   ENDIF. 
248 ENDFORM.                    " SHOW_BOX

View Code

 参考选择屏幕(控制选择屏幕两个屏幕,单值输入……通过函数实现单值输入)详解编程语言参考选择屏幕(控制选择屏幕两个屏幕,单值输入……通过函数实现单值输入)详解编程语言

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/18411.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论