此前做的多窗口时,大多以显示为主,并且显示 的表格对象以ALV显示 ,这样不方便编辑维护(比如:ABAP代码模板3-多自定义窗口),当我们需要类似ME21N,ME22N,ME23N,这种有主从单据创建,维护,显示 的单据功能操作时,可以使用些模板处理。程序 中有主表,从表,维护,必输,数据有效性验证等功能。
创建单据时如图
修改数据时如图
程序通过输入事务码来判断创建,修改,显示 ,不同的事务码有不同的显示 操作项目。
程序中ZLMS_ZLME01161_HEAD为表头的显示 结构 ,其内容就是数据主表内容,
ZLMS_ZLME01161_ITEM1是项目表,比项目数据表多增加SEL(用于表控制 的选择)
ZLMS_ZLME01161_ITEM2是项目明细表,比项目数据表多增加SEL(用于表控制 的选择)
1.代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
*&********************************************************************* *& PROGRAM NAME : ***1 *& Module Name : ***8单 *& Author : 杨森 *& Started on : 20230601 *& Transaction : ZLME00140 *& Program type : Report *& Program ID : ZLME01161 *& Program Description : ZLME01161 *&*&******************************************************************* *& REVISION LOG * *& * *& LOG# DATE AUTHOR DESCRIPTION * *& ---- ---- ------ ----------- * *&********************************************************************* REPORT zlme01161. INCLUDE ZLME01161_TOP. INCLUDE ZLME01161_MAIN. INCLUDE ZLME01161_PBO. INCLUDE ZLME01161_PAI. INCLUDE ZLME01161_FRM. INCLUDE ZLME01161_F01. "fcode_tc_mark_lines |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
*&---------------------------------------------------------------------* *& 包含 ZLME00140_TOP *&---------------------------------------------------------------------* "screen DATA: ok_code TYPE sy-ucomm, save_code TYPE sy-ucomm. DATA: gv_message TYPE bapi_msg, gv_status TYPE c. "全局 DATA: gv_order TYPE ZLMT03820-ZYCBGDH, gv_id TYPE char10 VALUE 'BGD', gv_tlsqd TYPE zlmt00302-tlsqd. CONSTANTS:gv_create TYPE sy-tcode VALUE 'ZLM03991', gv_modify TYPE sy-tcode VALUE 'ZLM03992', gv_display TYPE sy-tcode VALUE 'ZLM03993'. DATA: gt_list TYPE vrm_values, gw_list LIKE LINE OF gt_list. "TC COMP CONTROLS: tc_0100 TYPE TABLEVIEW USING SCREEN 0100, tc_0101 TYPE TABLEVIEW USING SCREEN 0100, tc_0102 TYPE TABLEVIEW USING SCREEN 0100. DATA: g_tc_0101_lines LIKE sy-loopc, g_tc_0102_lines LIKE sy-loopc. "抬头: TABLES:ZLMS_ZLME01161_HEAD. "行项目 TABLES:ZLMS_ZLME01161_ITEM1. TABLES:ZLMS_ZLME01161_ITEM2. "行项目 TYPES: BEGIN OF gty_item1. INCLUDE TYPE ZLMS_ZLME01161_ITEM1. TYPES: END OF gty_item1. TYPES: BEGIN OF gty_item2. INCLUDE TYPE ZLMS_ZLME01161_ITEM2. TYPES: END OF gty_item2. DATA: gt_item1 TYPE TABLE OF ZLMS_ZLME01161_ITEM1, gt_item2 TYPE TABLE OF ZLMS_ZLME01161_ITEM2, gt_item1_delete TYPE TABLE OF ZLMS_ZLME01161_ITEM1, "存放删除行项目 gw_item1 TYPE gty_item1, gw_item2 TYPE gty_item2. DATA: gt_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE, gt_messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE. CONSTANTS: c_dismode TYPE ctu_mode VALUE 'N', c_updmode TYPE ctu_update VALUE 'S', c_racommit TYPE ctu_rafc VALUE 'X'. "screen DATA: gv_name1 TYPE c LENGTH 40, "填单人1 gv_name2 TYPE c LENGTH 40, "填单人2 gv_name3 TYPE c LENGTH 60, "地点名称 gv_name4 TYPE c LENGTH 60, "当班主管 gv_name5 TYPE c LENGTH 20, "移动类型描述 gv_name6 TYPE c LENGTH 20, "工厂 gv_name7 TYPE c LENGTH 20, "成本中心描述 gv_name8 TYPE c LENGTH 20. "基金中心描述 |
1 2 3 4 5 6 7 8 9 |
*&---------------------------------------------------------------------* *& 包含 ZLME00140_MAIN *&---------------------------------------------------------------------* START-OF-SELECTION. PERFORM insert_row TABLES gt_item1. CALL SCREEN 100. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 |
*&---------------------------------------------------------------------* *& 包含 ZLME00140_PBO *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Module STATUS_0100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE STATUS_0100 OUTPUT. DATA: LV_TEXT TYPE CHAR4, BEGIN OF EX_BUT OCCURS 0, UCOMM TYPE SY-UCOMM, END OF EX_BUT. CASE SY-TCODE. WHEN GV_CREATE. LV_TEXT = TEXT-600. WHEN GV_MODIFY. LV_TEXT = TEXT-601. WHEN GV_DISPLAY. LV_TEXT = TEXT-602. WHEN OTHERS. ENDCASE. PERFORM MODIFY_SCREEN. "屏幕调整 及 默认值 * REFRESH EX_BUT. IF ZLMS_ZLME01161_HEAD-ZYSFS = 'A'."门到门 EX_BUT-UCOMM = 'TJLP'."提交理赔OA APPEND EX_BUT. ELSEIF ZLMS_ZLME01161_HEAD-ZYSFS = 'B'"短驳. AND ( ZLMS_ZLME01161_HEAD-ZSPZT1 <> 'N' AND ZLMS_ZLME01161_HEAD-ZSPZT1 <> 'F' ) AND ( ZLMS_ZLME01161_HEAD-ZSPZT2 <> 'N' AND ZLMS_ZLME01161_HEAD-ZSPZT2 <> 'F' ). EX_BUT-UCOMM = 'TJLP'."提交理赔OA APPEND EX_BUT. ENDIF. IF SY-TCODE = GV_DISPLAY. EX_BUT-UCOMM = 'DELI'."提交异常OA APPEND EX_BUT. EX_BUT-UCOMM = 'TJLP'."提交理赔OA APPEND EX_BUT. EX_BUT-UCOMM = 'SAVE'. APPEND EX_BUT. ELSEIF SY-TCODE = GV_CREATE. * EX_BUT-UCOMM = 'DELI'."提交异常OA * APPEND EX_BUT. EX_BUT-UCOMM = 'TJLP'."提交理赔OA APPEND EX_BUT. ELSE."MODIFY IF ( ZLMS_ZLME01161_HEAD-ZSPZT1 = 'N' OR ZLMS_ZLME01161_HEAD-ZSPZT1 = 'F' ).". EX_BUT-UCOMM = 'DELI'."提交异常OA APPEND EX_BUT. ENDIF. IF ( ZLMS_ZLME01161_HEAD-ZSPZT2 = 'N' OR ZLMS_ZLME01161_HEAD-ZSPZT2 = 'F' ).". EX_BUT-UCOMM = 'TJLP'."提交理赔OA APPEND EX_BUT. ENDIF. ENDIF. *依据审批状态判断 IF ( SY-UCOMM = 'ENTER' AND SY-TCODE NE GV_DISPLAY ) AND ( ( ZLMS_ZLME01161_HEAD-ZSPZT1 = '' OR ZLMS_ZLME01161_HEAD-ZSPZT1 = 'A' OR ZLMS_ZLME01161_HEAD-ZSPZT1 = 'T' ) ). PERFORM CHECK_OBLIGATORY. ENDIF. SET PF-STATUS '0100' EXCLUDING EX_BUT. SET TITLEBAR '0100' WITH LV_TEXT. ENDMODULE. MODULE TC_0101_CHANGE_TC_ATTR OUTPUT. DESCRIBE TABLE GT_ITEM1 LINES TC_0101-LINES. ENDMODULE. MODULE TC_0101_GET_LINES OUTPUT. G_TC_0101_LINES = SY-LOOPC. ENDMODULE. MODULE TC_0102_CHANGE_TC_ATTR OUTPUT. DESCRIBE TABLE GT_ITEM2 LINES TC_0102-LINES. ENDMODULE. MODULE TC_0102_GET_LINES OUTPUT. G_TC_0102_LINES = SY-LOOPC. ENDMODULE. MODULE CHECK_ITEM1_OBLIGATORY OUTPUT. * * return. CLEAR GV_STATUS. CASE ZLMS_ZLME01161_HEAD-ZYSFS. WHEN 'A'. IF ZLMS_ZLME01161_ITEM1-EBELN IS NOT INITIAL. PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_ITEM1-EBELP TC_0101-CURRENT_LINE 'ZLMS_ZLME01161_ITEM1-EBELP'."订单项目 IF ZLMS_ZLME01161_ITEM1-ZYCXL IS INITIAL. PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_ITEM1-ZYCXL TC_0101-CURRENT_LINE 'ZLMS_ZLME01161_ITEM1-ZYCXL'."异常小类 PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_ITEM1-ZYCJS TC_0101-CURRENT_LINE 'ZLMS_ZLME01161_ITEM1-ZYCJS'."异常件数 ENDIF. ENDIF. WHEN 'B'. IF ZLMS_ZLME01161_ITEM1-VBELN IS NOT INITIAL. PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_ITEM1-POSNR TC_0101-CURRENT_LINE 'ZLMS_ZLME01161_ITEM1-POSNR'."订单项目 IF ZLMS_ZLME01161_ITEM1-ZYCXL IS INITIAL. PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_ITEM1-ZYCXL TC_0101-CURRENT_LINE 'ZLMS_ZLME01161_ITEM1-ZYCXL'."异常小类 PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_ITEM1-ZYCJS TC_0101-CURRENT_LINE 'ZLMS_ZLME01161_ITEM1-ZYCJS'."异常件数 ENDIF. ENDIF. WHEN OTHERS. ENDCASE. IF GV_STATUS = 'E'. MESSAGE S013(ZLM01) DISPLAY LIKE 'E'."请填写必填项! ENDIF. ENDMODULE. MODULE CHECK_ITEM2_OBLIGATORY OUTPUT. ENDMODULE. *&---------------------------------------------------------------------* *& Module DATA_HELP1 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE DATE_HELP2 INPUT. * PERFORM date_help CHANGING ZLMS_ZLME01161_ITEM1-psrq. ENDMODULE. *&---------------------------------------------------------------------* *& Module MAT_PSPNR_HELP INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE MAT_PSPNR_HELP INPUT. * PERFORM f4if_field_value_request USING 'PEG_CNSMPTN2WBS' 'MAT_PSPNR' 'ZLMS_ZLME01161_HEAD-MAT_PSPNR'. ENDMODULE. *&---------------------------------------------------------------------* *& Module DEPRT_HELP INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE DEPRT_HELP INPUT. * DATA: lt_dynpread TYPE TABLE OF dynpread WITH HEADER LINE. * DATA: lw_objec TYPE objec. * * CALL FUNCTION 'HRIQ_OBJID_REQUEST' "根据搜帮名取得其元数据 * EXPORTING * plvar = '01' * otype = 'O' * IMPORTING * sel_object = lw_objec. * REFRESH lt_dynpread. * lt_dynpread-fieldname = 'ZLMS_ZLME01161_HEAD-DEPRT'. "屏幕字段 * lt_dynpread-fieldvalue = lw_objec-objid. "选择值 * APPEND lt_dynpread. * CALL FUNCTION 'DYNP_VALUES_UPDATE' "把值更新回屏幕 * EXPORTING * dyname = sy-cprog * dynumb = sy-dynnr * TABLES * dynpfields = lt_dynpread. ENDMODULE. *&---------------------------------------------------------------------* *& Module BWART_HELP INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE BWART_HELP INPUT. * DATA: BEGIN OF lt_bwart OCCURS 0, * bwart TYPE t156-bwart, * btext TYPE t156t-btext, * END OF lt_bwart. * REFRESH lt_bwart. * IF ZLMS_ZLME01161_HEAD-lltyp = 'C'. * lt_bwart-bwart = '913'. * APPEND lt_bwart. * lt_bwart-bwart = '941'. * APPEND lt_bwart. * lt_bwart-bwart = '929'. * APPEND lt_bwart. * LOOP AT lt_bwart. * SELECT SINGLE btext FROM t156t INTO lt_bwart-btext WHERE bwart = lt_bwart-bwart AND spras = sy-langu. * MODIFY lt_bwart. * ENDLOOP. * CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' * EXPORTING * retfield = 'BWART' * dynpprog = sy-repid * dynpnr = sy-dynnr * dynprofield = 'ZLMS_ZLME01161_HEAD-BWART' * value_org = 'S' * TABLES * value_tab = lt_bwart. * ELSEIF ZLMS_ZLME01161_HEAD-lltyp = 'F'. * lt_bwart-bwart = '221'. * APPEND lt_bwart. ** lt_bwart-bwart = '927'. ** APPEND lt_bwart. * LOOP AT lt_bwart. * SELECT SINGLE btext FROM t156t INTO lt_bwart-btext WHERE bwart = lt_bwart-bwart AND spras = sy-langu. * MODIFY lt_bwart. * ENDLOOP. * CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' * EXPORTING * retfield = 'BWART' * dynpprog = sy-repid * dynpnr = sy-dynnr * dynprofield = 'ZLMS_ZLME01161_HEAD-BWART' * value_org = 'S' * TABLES * value_tab = lt_bwart. * ELSE. * PERFORM f4if_field_value_request USING 'T156T' 'BWART ' 'ZLMS_ZLME01161_HEAD-BWART'. * ENDIF. ENDMODULE. *&---------------------------------------------------------------------* *& Module EMATN_HELP INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE EMATN_HELP INPUT. * DATA: BEGIN OF lt_matnr OCCURS 0, * ematn TYPE makt-matnr, * maktx TYPE makt-maktx, * END OF lt_matnr. * DATA: lv_line TYPE int4, * lw_item TYPE gty_item1. * CLEAR lv_line. * GET CURSOR LINE lv_line. * READ TABLE gt_item1 INTO lw_item INDEX lv_line. * SELECT ematn makt~maktx * INTO CORRESPONDING FIELDS OF TABLE lt_matnr * FROM ampl INNER JOIN makt * ON ampl~ematn = makt~matnr * WHERE bmatn = lw_item-matnr. * CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' * EXPORTING * retfield = 'EMATN' * dynpprog = sy-repid * dynpnr = sy-dynnr * dynprofield = 'ZLMS_ZLME01161_ITEM1-EMATN' * value_org = 'S' * TABLES * value_tab = lt_matnr. ENDMODULE. *&---------------------------------------------------------------------* *& Module MATNR_HELP INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE MATNR_HELP INPUT. * DATA: BEGIN OF lt_matnr_dlh OCCURS 0, * matnr TYPE mara-matnr, * maktx TYPE makt-maktx, * END OF lt_matnr_dlh. * * SELECT mara~matnr maktx INTO TABLE lt_matnr_dlh * FROM makt INNER JOIN mara * ON makt~matnr = mara~matnr * WHERE spras = sy-langu * AND mtart NE 'HERS'. * * CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' * EXPORTING * retfield = 'MATNR' * dynpprog = sy-repid * dynpnr = sy-dynnr * dynprofield = 'ZLMS_ZLME01161_ITEM1-MATNR' * value_org = 'S' * TABLES * value_tab = lt_matnr_dlh. ENDMODULE. *&---------------------------------------------------------------------* *& Module ZYCBGDH_HELP1 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE ZYCBGDH_HELP INPUT. * DATA: BEGIN OF lt_ZYCBGDH OCCURS 0, * ZYCBGDH TYPE ZLMT03820-ZYCBGDH, * END OF lt_ZYCBGDH. * SELECT ZYCBGDH INTO TABLE lt_ZYCBGDH FROM ZLMT03820 WHERE KGS = ''. * CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' * EXPORTING * retfield = 'ZYCBGDH' * dynpprog = sy-repid * dynpnr = sy-dynnr * dynprofield = 'ZLMS_ZLME01161_HEAD-ZYCBGDH' * value_org = 'S' * TABLES * value_tab = lt_ZYCBGDH. ENDMODULE. *&---------------------------------------------------------------------* *& Module AUFNR_HELP INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE AUFNR_HELP INPUT. * PERFORM aufnr_help. ENDMODULE. *&---------------------------------------------------------------------* *& Module PLANS_LIST INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE PLANS_LIST1 INPUT. PERFORM PLANS_LIST USING 'PLANS1'. ENDMODULE. MODULE PLANS_LIST2 INPUT. PERFORM PLANS_LIST USING 'PLANS2'. ENDMODULE. MODULE ZLPDX_LIST INPUT. PERFORM PF_ZLPDX_LIST . ENDMODULE. *&---------------------------------------------------------------------* *& Form AUFNR_HELP *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM AUFNR_HELP . * DATA: BEGIN OF lt_aufk OCCURS 0, * aufnr TYPE aufk-aufnr, * auart TYPE aufk-auart, * END OF lt_aufk. * SELECT aufnr auart INTO TABLE lt_aufk FROM aufk. "#EC CI_NOWHERE * IF ZLMS_ZLME01161_HEAD-lltyp = 'A'."A是生产订单 AUFK-AUART <> 'ZM*' * DELETE lt_aufk WHERE auart(2) = 'ZM'. * ELSEIF ZLMS_ZLME01161_HEAD-lltyp = 'B'."B是维修订单 AUFK-AUART = 'ZM*' * DELETE lt_aufk WHERE auart(2) <> 'ZM'. * ENDIF. * CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' * EXPORTING * retfield = 'AUFNR' * dynpprog = sy-repid * dynpnr = sy-dynnr * dynprofield = 'ZLMS_ZLME01161_HEAD-AUFNR' * value_org = 'S' * TABLES * value_tab = lt_aufk. ENDFORM. *&---------------------------------------------------------------------* *& Form PLANS_LIST *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PLANS_LIST USING P_FIELDNAME TYPE CHAR10. DATA:LT_LIST TYPE VRM_VALUES, LS_LIST TYPE VRM_VALUE, LT_ZHRS01030 TYPE TABLE OF ZHRS01030 WITH HEADER LINE. DATA: L_VRM_ID TYPE VRM_ID. DATA: L_PERNR TYPE PERSNO. IF P_FIELDNAME = 'PLANS1'. L_PERNR = ZLMS_ZLME01161_HEAD-CNAME_CRE1. ELSE. L_PERNR = ZLMS_ZLME01161_HEAD-CNAME_CRE2. ENDIF. CALL FUNCTION 'ZFM_HR_GET_PLANS_LIST_FOR_LM' EXPORTING IV_PERNR = L_PERNR * IV_BEGDA = SY-DATUM * IV_ENDDA = SY-DATUM TABLES ET_PLANS_LIST = LT_ZHRS01030. LOOP AT LT_ZHRS01030. CLEAR LS_LIST. LS_LIST-KEY = LT_ZHRS01030-PLANS. LS_LIST-TEXT = LT_ZHRS01030-PLSTX. APPEND LS_LIST TO LT_LIST. ENDLOOP. CONCATENATE 'ZLMS_ZLME01161_HEAD-' P_FIELDNAME INTO L_VRM_ID. * PERFORM vrm_set_values USING 'ZLMS_ZLME01161_HEAD-PLANS1' lt_list. PERFORM VRM_SET_VALUES USING L_VRM_ID LT_LIST. ENDFORM. FORM PF_ZLPDX_LIST . DATA:LT_LIST TYPE VRM_VALUES, LS_LIST TYPE VRM_VALUE. DATA: L_VRM_ID TYPE VRM_ID. BREAK YANGSEN. SELECT * INTO TABLE @DATA(LT_ZLMT03820_DX) FROM ZLMT03820_DX WHERE ZYCXL = @ZLMS_ZLME01161_ITEM2-ZYCXL . . LOOP AT LT_ZLMT03820_DX INTO DATA(LS_ZLMT03820_DX). CLEAR LS_LIST. LS_LIST-KEY = LS_ZLMT03820_DX-ZLPDX. LS_LIST-TEXT = ''. APPEND LS_LIST TO LT_LIST. ENDLOOP. L_VRM_ID = 'ZLMS_ZLME01161_ITEM2-ZLPDX' . * PERFORM vrm_set_values USING 'ZLMS_ZLME01161_HEAD-PLANS1' lt_list. PERFORM VRM_SET_VALUES USING L_VRM_ID LT_LIST. ENDFORM. *&---------------------------------------------------------------------* *& Form DATA_HELP *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * <--P_ZLMS_ZLME01161_HEAD_ZZFHRQ text *----------------------------------------------------------------------* FORM DATE_HELP CHANGING PV_DATE. * DATA: select_date TYPE sy-datum. * CLEAR:select_date. * * CALL FUNCTION 'F4_DATE' * EXPORTING * date_for_first_month = sy-datum * IMPORTING * select_date = select_date "用户选择后返回的日期 * EXCEPTIONS * calendar_buffer_not_loadable = 1 * date_after_range = 2 * date_before_range = 3 * date_invalid = 4 * factory_calendar_not_found = 5 * holiday_calendar_not_found = 6 * parameter_conflict = 7 * OTHERS = 8. * IF sy-subrc = 0. * pv_date = select_date. * ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form F4IF_FIELD_VALUE_REQUEST *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_0114 text * -->P_0115 text * -->P_0116 text *----------------------------------------------------------------------* FORM F4IF_FIELD_VALUE_REQUEST USING PV_TABNAME PV_FIELDNAME PV_FIELD. * CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST' * EXPORTING * tabname = pv_tabname * fieldname = pv_fieldname * dynpprog = sy-repid * dynpnr = sy-dynnr * dynprofield = pv_field. ENDFORM. *&---------------------------------------------------------------------* *& Form VRM_SET_VALUES *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* * -->P_LT_LIST1 text *&---------------------------------------------------------------------* FORM VRM_SET_VALUES USING PV_ID PT_LIST TYPE VRM_VALUES. CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = PV_ID VALUES = PT_LIST. ENDFORM. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
*&---------------------------------------------------------------------* *& 包含 ZLME00140_PAI *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE USER_COMMAND_0100 INPUT. DATA:LV_NEW_OLD_FLAG TYPE C. "新旧物料标识 SAVE_CODE = OK_CODE. CLEAR:OK_CODE. CASE SAVE_CODE. WHEN 'BACK' OR 'UP' OR 'CANCL'. LEAVE PROGRAM. WHEN 'SAVE'. PERFORM PRF_SAVE_DATA."保存 WHEN 'ENTER'. PERFORM GET_DESCRIPTION TABLES GT_ITEM1 CHANGING ZLMS_ZLME01161_HEAD. WHEN 'DELI'. "提交OA审批 PERFORM PRF_SAVE_DATA."保存 PERFORM DELIVER_DATA USING '1' . WHEN 'TJLP'. "提交理赔OA PERFORM PRF_SAVE_DATA."保存 PERFORM DELIVER_DATA USING '2' . " WHEN 'PRINT'. PERFORM PRINT_DATA TABLES GT_ITEM1 CHANGING ZLMS_ZLME01161_HEAD. WHEN 'SPJL'. PERFORM DIS_LOG. WHEN GV_CREATE. PERFORM CLEAR_INITIAL. CALL TRANSACTION GV_CREATE. WHEN GV_MODIFY. PERFORM CLEAR_INITIAL. SET PARAMETER ID GV_ID FIELD GV_ORDER. CALL TRANSACTION GV_MODIFY AND SKIP FIRST SCREEN. WHEN GV_DISPLAY. PERFORM CLEAR_INITIAL. SET PARAMETER ID GV_ID FIELD GV_ORDER. CALL TRANSACTION GV_DISPLAY AND SKIP FIRST SCREEN. ****BEGIN OF MODIFY BY PENGFS 20200609 * WHEN 'DELETE1'. "删除领料申请单 * PERFORM FRM_DELTE_ZYCBGDH TABLES GT_ITEM1 * CHANGING ZLMS_ZLME01161_HEAD.. * WHEN 'CANCEL'."撤销领料申请单 * PERFORM FRM_CANCEL_ZYCBGDH TABLES GT_ITEM1 * CHANGING ZLMS_ZLME01161_HEAD. * WHEN 'PRINT_FL'."打印发料交接单 * PERFORM FRM_PRINT_FLJJD TABLES GT_ITEM1 * CHANGING ZLMS_ZLME01161_HEAD. ****END OF MODIFY BY PENGFS 20200609 WHEN 'LAD1'."项目上传文件 PERFORM FRM_UPLOAD_ATT1. WHEN 'LAD2'."项目明细上传文件 BREAK YANGSEN. PERFORM FRM_UPLOAD_ATT2. WHEN OTHERS. ENDCASE. ENDMODULE. MODULE TC_0101_MODIFY INPUT. PERFORM CALCULATE_ITEM1_DATA_TC CHANGING ZLMS_ZLME01161_ITEM1. MODIFY GT_ITEM1 FROM ZLMS_ZLME01161_ITEM1 INDEX TC_0101-CURRENT_LINE. ENDMODULE. MODULE TC_0101_CHECK_PO INPUT. PERFORM CALCULATE_ITEM1_PO_TC CHANGING ZLMS_ZLME01161_ITEM1. MODIFY GT_ITEM1 FROM ZLMS_ZLME01161_ITEM1 INDEX TC_0101-CURRENT_LINE. ENDMODULE. MODULE TC_0101_CHECK_ZYCXL INPUT. "小类 PERFORM CALCULATE_ITEM1_ZYCXL_TC CHANGING ZLMS_ZLME01161_ITEM1. MODIFY GT_ITEM1 FROM ZLMS_ZLME01161_ITEM1 INDEX TC_0101-CURRENT_LINE. ENDMODULE. MODULE TC_0101_CHECK_ZSL INPUT. "异常数量 PERFORM CALCULATE_ITEM1_ZSL_TC CHANGING ZLMS_ZLME01161_ITEM1. MODIFY GT_ITEM1 FROM ZLMS_ZLME01161_ITEM1 INDEX TC_0101-CURRENT_LINE. ENDMODULE. MODULE TC_0102_MODIFY INPUT. PERFORM CALCULATE_ITEM2_DATA_TC CHANGING ZLMS_ZLME01161_ITEM2. MODIFY GT_ITEM2 FROM ZLMS_ZLME01161_ITEM2 INDEX TC_0102-CURRENT_LINE. ENDMODULE. *&---------------------------------------------------------------------* *& Module TABLE CONTROL USERCOMMAND *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE TC_0101_MARK INPUT. DATA: G_TC_0101_WA2 LIKE LINE OF GT_ITEM1. IF TC_0101-LINE_SEL_MODE = 1 AND ZLMS_ZLME01161_ITEM1-SEL = 'X'. LOOP AT GT_ITEM1 INTO G_TC_0101_WA2 WHERE SEL = 'X'. G_TC_0101_WA2-SEL = ''. MODIFY GT_ITEM1 FROM G_TC_0101_WA2 TRANSPORTING SEL. ENDLOOP. ENDIF. MODIFY GT_ITEM1 FROM ZLMS_ZLME01161_ITEM1 INDEX TC_0101-CURRENT_LINE TRANSPORTING SEL. ENDMODULE. MODULE TC_0102_MARK INPUT. DATA: G_TC_0102_WA2 LIKE LINE OF GT_ITEM2. IF TC_0102-LINE_SEL_MODE = 1 AND ZLMS_ZLME01161_ITEM2-SEL = 'X'. LOOP AT GT_ITEM2 INTO G_TC_0102_WA2 WHERE SEL = 'X'. G_TC_0102_WA2-SEL = ''. MODIFY GT_ITEM2 FROM G_TC_0102_WA2 TRANSPORTING SEL. ENDLOOP. ENDIF. MODIFY GT_ITEM2 FROM ZLMS_ZLME01161_ITEM2 INDEX TC_0102-CURRENT_LINE TRANSPORTING SEL. ENDMODULE. MODULE TC_0101_CHECK_ZLPDX INPUT. PERFORM CALCULATE_ITEM2_ZLPDX_TC CHANGING ZLMS_ZLME01161_ITEM2. MODIFY GT_ITEM2 FROM ZLMS_ZLME01161_ITEM2 INDEX TC_0102-CURRENT_LINE. ENDMODULE. MODULE TC_0101_CHECK_ZLPJS INPUT. PERFORM CALCULATE_ITEM2_ZLPJS_TC CHANGING ZLMS_ZLME01161_ITEM2."理赔件数 MODIFY GT_ITEM2 FROM ZLMS_ZLME01161_ITEM2 INDEX TC_0102-CURRENT_LINE. ENDMODULE. MODULE TC_0101_USER_COMMAND INPUT. SAVE_CODE = SY-UCOMM. CASE SAVE_CODE. WHEN 'TC_INS1'. PERFORM FCODE_INSERT_ROW TABLES GT_ITEM1. CLEAR:SY-UCOMM. WHEN 'TC_DEL1'. PERFORM FCODE_DELETE_ROW TABLES GT_ITEM1. CLEAR:SY-UCOMM. WHEN 'TC_ALL1'. PERFORM FCODE_TC_MARK_LINES1 TABLES GT_ITEM1. CLEAR:SY-UCOMM. WHEN 'TC_SAL1'. PERFORM FCODE_TC_DEMARK_LINES1 TABLES GT_ITEM1. CLEAR:SY-UCOMM. ENDCASE. ENDMODULE. MODULE TC_0102_USER_COMMAND INPUT. SAVE_CODE = SY-UCOMM. CASE SAVE_CODE. * WHEN 'TC_CO2'."COPY单行 * PERFORM FCODE_INSERT_ROW TABLES GT_ITEM2. * CLEAR:SY-UCOMM. WHEN 'TC_DEL2'. PERFORM FCODE_DELETE_ROW2 . CLEAR:SY-UCOMM. WHEN 'TC_COP2'."复制选择行 PERFORM FCODE_COPY_SELECTED . CLEAR:SY-UCOMM. WHEN 'TC_COPA2'."复制所有行 PERFORM FCODE_COPY_ALL . CLEAR:SY-UCOMM. WHEN 'TC_ALL2'. PERFORM FCODE_TC_MARK_LINES2 TABLES GT_ITEM2. CLEAR:SY-UCOMM. WHEN 'TC_SAL2'. PERFORM FCODE_TC_DEMARK_LINES2 TABLES GT_ITEM2. CLEAR:SY-UCOMM. ENDCASE. ENDMODULE. *& Module GET_DB_DATA INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE GET_DB_DATA INPUT. CASE SY-TCODE. WHEN GV_MODIFY. PERFORM GET_DB_DATA . PERFORM AUTHORITY_CHECK_INPUT. PERFORM ENQUEUE_EZ USING ZLMS_ZLME01161_HEAD-ZYCBGDH. WHEN GV_DISPLAY. PERFORM GET_DB_DATA. WHEN OTHERS. ENDCASE. ENDMODULE. *&---------------------------------------------------------------------* *& Module GET_PERNR_DATA INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Module BACK INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE BACK INPUT. SAVE_CODE = OK_CODE. CLEAR:OK_CODE. CASE SAVE_CODE. WHEN 'BACK' OR 'UP' OR 'CANCL'. LEAVE PROGRAM. WHEN OTHERS. ENDCASE. ENDMODULE. *&---------------------------------------------------------------------* *& Module LLTYP_MODIFY INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Module AUTHORITY_CHECK_WERKS INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE CHECK_WERKS_INPUT INPUT. PERFORM AUTHORITY_CHECK_INPUT_WERKS. "权限检查 ENDMODULE. *&---------------------------------------------------------------------* *& Module CHECK_BWART_INPUT INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Module CHECK_MAT_PSPNR_INPUT INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Module CHECK_FISTL_INPUT INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE CHECK_PLANS_INPUT INPUT. PERFORM CHECK_PLANS_INPUT. ENDMODULE. *&---------------------------------------------------------------------* *& Module GET_HRAQX_DATA INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE CHECK_ZYSFS_INPUT INPUT. PERFORM CHECK_ZYSFS_INPUT. ENDMODULE. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 |
*&---------------------------------------------------------------------* *& 包含 ZLME00140_FRM *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form INSERT_ROW *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_PT_ITEM text *----------------------------------------------------------------------* FORM INSERT_ROW TABLES PT_ITEM STRUCTURE ZLMS_ZLME01161_ITEM1. DATA: LW_ITEM TYPE GTY_ITEM1. DO 10 TIMES. LW_ITEM-ZHXM = LW_ITEM-ZHXM + 1. APPEND LW_ITEM TO PT_ITEM[]. ENDDO. ENDFORM. *&---------------------------------------------------------------------* *& Form GET_DB_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_gt_item1 text * <--P_ZLMS_ZLME01161_HEAD text *----------------------------------------------------------------------* FORM GET_DB_DATA . DATA: LV_ZYCBGDH TYPE ZLMT03820-ZYCBGDH, LV_LLJPD TYPE ZLMT00307-LLJPD, LW_ITEM TYPE GTY_ITEM1, LV_XLH TYPE ATWRT, LV_MAKTX TYPE MAKT-MAKTX. CLEAR:LV_ZYCBGDH. LV_ZYCBGDH = ZLMS_ZLME01161_HEAD-ZYCBGDH. PERFORM CLEAR_INITIAL. ZLMS_ZLME01161_HEAD-ZYCBGDH = LV_ZYCBGDH. SELECT SINGLE * INTO CORRESPONDING FIELDS OF ZLMS_ZLME01161_HEAD FROM ZLMT03820 WHERE ZYCBGDH = ZLMS_ZLME01161_HEAD-ZYCBGDH . IF SY-SUBRC <> 0. MESSAGE E509(ZLM02) WITH LV_ZYCBGDH ."异常报告单&1不存在 RETURN. ENDIF. IF SY-TCODE = GV_DISPLAY. ELSE. CASE ZLMS_ZLME01161_HEAD-ZYSFS. WHEN 'A'."门到门 IF ZLMS_ZLME01161_HEAD-ZSPZT1 = 'N' OR ZLMS_ZLME01161_HEAD-ZSPZT1 = 'F' OR ZLMS_ZLME01161_HEAD-ZSPZT1 = 'J' . MESSAGE W507(ZLM02) WITH ZLMS_ZLME01161_HEAD-ZYCBGDH ZLMS_ZLME01161_HEAD-ZSPZT1."异常报告单,不可修改 ENDIF. WHEN 'B'."短驳 IF ZLMS_ZLME01161_HEAD-ZSPZT2 = 'N' OR ZLMS_ZLME01161_HEAD-ZSPZT2 = 'F' OR ZLMS_ZLME01161_HEAD-ZSPZT2 = 'J'. MESSAGE W508(ZLM02) WITH ZLMS_ZLME01161_HEAD-ZYCBGDH ZLMS_ZLME01161_HEAD-ZSPZT2."异常报告单,不可修改 ENDIF. WHEN OTHERS. ENDCASE. ENDIF. SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ITEM1 FROM ZLMT03821 WHERE ZYCBGDH = ZLMS_ZLME01161_HEAD-ZYCBGDH. SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ITEM2 FROM ZLMT03822 WHERE ZYCBGDH = ZLMS_ZLME01161_HEAD-ZYCBGDH. * IF GT_ITEM1 IS NOT INITIAL. * SELECT * * INTO TABLE @DATA(LT_EKPO) * FROM EKPO * FOR ALL ENTRIES IN @GT_ITEM1 * WHERE EBELN = @GT_ITEM1-EBELN. * ENDIF. * * IF LT_EKPO IS NOT INITIAL. * SELECT * * INTO TABLE @DATA(LT_MAKT) * FROM MAKT * FOR ALL ENTRIES IN @LT_EKPO * WHERE ( MATNR = @LT_EKPO-MATNR * OR MATNR = @LT_EKPO-EMATN ) * AND SPRAS = @SY-LANGU. * ENDIF. * * SORT LT_EKPO BY EBELN EBELP. * SORT LT_MAKT BY MATNR. * LOOP AT GT_ITEM1 ASSIGNING FIELD-SYMBOL(<ITEM1>). * READ TABLE LT_EKPO INTO DATA(LS_EKPO) WITH KEY EBELN = <ITEM1>-EBELN * EBELP = <ITEM1>-EBELP * BINARY SEARCH. * IF SY-SUBRC = 0. * <ITEM1>-MATNR = LS_EKPO-MATNR. * <ITEM1>-EMATN = LS_EKPO-EMATN. * ENDIF. * IF <ITEM1>-MATNR IS NOT INITIAL. * READ TABLE LT_MAKT INTO DATA(LS_MAKT) WITH KEY MATNR = <ITEM1>-MATNR * BINARY SEARCH. * IF SY-SUBRC = 0. * <ITEM1>-MAKTX = LS_MAKT-MAKTX. * ENDIF. * ENDIF. * IF <ITEM1>-EMATN IS NOT INITIAL. * READ TABLE LT_MAKT INTO LS_MAKT WITH KEY MATNR = <ITEM1>-EMATN * BINARY SEARCH. * IF SY-SUBRC = 0. * <ITEM1>-EMAKTX = LS_MAKT-MAKTX. * ENDIF. * ENDIF. * ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form MODIFY_SCREEN *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM MODIFY_SCREEN . DATA: L_LIN TYPE INT1. CASE SY-TCODE. WHEN GV_CREATE. PERFORM NOT_DISPLAY_SCREEN_CHANGE. LOOP AT SCREEN. IF SCREEN-NAME = 'ZLMS_ZLME01161_HEAD-ZYCBGDH'. SCREEN-INPUT = 0. ENDIF. MODIFY SCREEN. ENDLOOP. WHEN GV_MODIFY. IF ZLMS_ZLME01161_HEAD-ZYCBGDH IS INITIAL. LOOP AT SCREEN. IF SCREEN-NAME = 'ZLMS_ZLME01161_HEAD-ZYCBGDH'. SCREEN-INPUT = 1. ELSE. SCREEN-INPUT = 0. ENDIF. MODIFY SCREEN. ENDLOOP. EXIT. ENDIF. PERFORM NOT_DISPLAY_SCREEN_CHANGE. LOOP AT SCREEN. IF SCREEN-NAME = 'ZLMS_ZLME01161_HEAD-ZYCBGDH' . SCREEN-INPUT = 1. * ELSEIF SCREEN-NAME = 'ZLMS_ZLME01161_ITEM1-CB_UPLOAD' OR SCREEN-NAME = 'ZLMS_ZLME01161_ITEM2-CB_UPLOAD' . * SCREEN-INPUT = 1. ELSEIF SCREEN-NAME = 'ZLMS_ZLME01161_HEAD-ZYSFS'. SCREEN-INPUT = 0. ENDIF. MODIFY SCREEN. ENDLOOP. WHEN GV_DISPLAY. LOOP AT SCREEN. IF SCREEN-NAME = 'ZLMS_ZLME01161_HEAD-ZYCBGDH'. SCREEN-INPUT = 1. ELSEIF SCREEN-NAME = 'ZLMS_ZLME01161_ITEM1-CB_UPLOAD' OR SCREEN-NAME = 'ZLMS_ZLME01161_ITEM2-CB_UPLOAD' . SCREEN-INPUT = 1. ELSE. SCREEN-INPUT = 0. ENDIF. MODIFY SCREEN. ENDLOOP. WHEN OTHERS. ENDCASE. * **END OF MODIFY BY PENGFS 20200612******* LOOP AT SCREEN. IF SCREEN-NAME = 'ZLMS_ZLME01161_ITEM1-SEL' OR SCREEN-NAME = 'ZLMS_ZLME01161_ITEM2-SEL'. SCREEN-INPUT = 1. MODIFY SCREEN. ENDIF. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form NOT_DISPLAY_SCREEN_CHANGE *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM NOT_DISPLAY_SCREEN_CHANGE . DATA: L_OBJNAME TYPE CHAR72, L_STRUNAME TYPE CHAR20, L_FIELDNAME TYPE CHAR72. RANGES: II_FIELDNAME_A_ITEM1 FOR L_OBJNAME,"item1可输入字段 II_FIELDNAME_A_ITEM2 FOR L_OBJNAME,"item2可输入字段 II_FIELDNAME_B_ITEM1 FOR L_OBJNAME,"item1可输入字段 II_FIELDNAME_B_ITEM2 FOR L_OBJNAME."item2可输入字段 II_FIELDNAME_A_ITEM1[] = VALUE #( ( SIGN = 'I' OPTION = 'EQ' LOW = 'EBELN' ) ( SIGN = 'I' OPTION = 'EQ' LOW = 'EBELP' ) ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZYCXL' ) "异常小类 ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZYCJS' ) "异常件数 ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZBZ' ) "备注 ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZSL' ) "数量 ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZJS' ) "件数 ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZDJZL' ) "单件重量(公斤) ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0101_MARK' ) "全选 ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0101_DEMARK' ) "全不选 ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0101_DELETE' ) "删除 ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0101_INSERT' ) "插入 ( SIGN = 'I' OPTION = 'EQ' LOW = 'CB_UPLOAD' ) "上传文件 ). II_FIELDNAME_A_ITEM2[] = VALUE #( ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZBZ' ) "备注 ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0102_COPY_ALL' ) "复制所有行 ( SIGN = 'I' OPTION = 'EQ' LOW = 'CB_UPLOAD' ) "上传文件 ). II_FIELDNAME_B_ITEM1[] = VALUE #( ( SIGN = 'I' OPTION = 'EQ' LOW = 'VBELN' ) ( SIGN = 'I' OPTION = 'EQ' LOW = 'POSNR' ) ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZYCXL' ) "异常小类 ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZYCJS' ) "异常件数 ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZDJZL' ) "单件重量(公斤) ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZBZ' ) "备注 ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0101_MARK' ) "全选 ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0101_DEMARK' ) "全不选 ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0101_DELETE' ) "删除 ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0101_INSERT' ) "插入 ( SIGN = 'I' OPTION = 'EQ' LOW = 'CB_UPLOAD' ) "上传文件 ). II_FIELDNAME_B_ITEM2[] = VALUE #( ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZLPJS' ) "理赔件数 ( SIGN = 'I' OPTION = 'EQ' LOW = 'LIFNR' ) "供应商帐户号 ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZBZ' ) "备注 ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0102_MARK' ) "全选 ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0102_DEMARK' ) "全不选 ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0102_DELETE' ) "删除行 ( SIGN = 'I' OPTION = 'EQ' LOW = 'TC_0102_COPY' ) "复制行 ( SIGN = 'I' OPTION = 'EQ' LOW = 'CB_UPLOAD' ) "上传文件 ( SIGN = 'I' OPTION = 'EQ' LOW = 'ZLPDX' ) "理赔对象 ). "进入界面运输方式必输,才能输入其他 IF ( ZLMS_ZLME01161_HEAD-ZYSFS IS INITIAL OR ZLMS_ZLME01161_HEAD-WERKS IS INITIAL ) AND SY-TCODE = GV_CREATE. LOOP AT SCREEN. IF SCREEN-NAME NE 'ZLMS_ZLME01161_HEAD-ZYSFS' AND SCREEN-NAME NE 'ZLMS_ZLME01161_HEAD-WERKS'. SCREEN-INPUT = 0. ENDIF. MODIFY SCREEN. ENDLOOP. RETURN. ENDIF. *"A 已保存 *N 已提交 *F 同意 *J 拒绝 *T 退回修改 " IF ZLMS_ZLME01161_HEAD-ZYSFS = 'A' ."门到门 LOOP AT SCREEN. IF SCREEN-NAME = 'ZLMS_ZLME01161_HEAD-PLANS2'. SCREEN-INPUT = 0. ENDIF. IF ( ZLMS_ZLME01161_HEAD-ZSPZT1 = 'N' OR ZLMS_ZLME01161_HEAD-ZSPZT1 = 'F' OR ZLMS_ZLME01161_HEAD-ZSPZT1 = 'J' )." SCREEN-INPUT = 0. ELSE. CLEAR: L_STRUNAME, L_FIELDNAME. SPLIT SCREEN-NAME AT '-' INTO L_STRUNAME L_FIELDNAME. IF L_STRUNAME = 'ZLMS_ZLME01161_HEAD'. ELSEIF ( L_STRUNAME = 'ZLMS_ZLME01161_ITEM1' AND L_FIELDNAME IN II_FIELDNAME_A_ITEM1 ) OR ( L_STRUNAME = 'ZLMS_ZLME01161_ITEM2' AND L_FIELDNAME IN II_FIELDNAME_A_ITEM2 ) ." SCREEN-INPUT = 1. ELSE. SCREEN-INPUT = 0. ENDIF. ENDIF. MODIFY SCREEN. ENDLOOP. ELSEIF ZLMS_ZLME01161_HEAD-ZYSFS = 'B'. "短驳 LOOP AT SCREEN. IF SCREEN-NAME = 'ZLMS_ZLME01161_HEAD-PLANS2'. IF ZLMS_ZLME01161_HEAD-ZSPZT1 = 'F' AND NOT ( ZLMS_ZLME01161_HEAD-ZSPZT2 = 'N' OR ZLMS_ZLME01161_HEAD-ZSPZT2 = 'F' OR ZLMS_ZLME01161_HEAD-ZSPZT2 = 'J' ). SCREEN-INPUT = 1. ELSE. SCREEN-INPUT = 0. ENDIF. MODIFY SCREEN. CONTINUE. ENDIF. IF ( ZLMS_ZLME01161_HEAD-ZSPZT2 = 'N' OR ZLMS_ZLME01161_HEAD-ZSPZT2 = 'F' OR ZLMS_ZLME01161_HEAD-ZSPZT2 = 'J' ) OR ZLMS_ZLME01161_HEAD-ZSPZT1 = 'N'. SCREEN-INPUT = 0. ELSEIF ( ZLMS_ZLME01161_HEAD-ZSPZT1 = 'F' OR ZLMS_ZLME01161_HEAD-ZSPZT1 = 'J' ). CLEAR: L_STRUNAME, L_FIELDNAME. SPLIT SCREEN-NAME AT '-' INTO L_STRUNAME L_FIELDNAME. IF L_STRUNAME = 'ZLMS_ZLME01161_ITEM2' AND L_FIELDNAME IN II_FIELDNAME_B_ITEM2." SCREEN-INPUT = 1. ELSE. SCREEN-INPUT = 0. ENDIF. ELSE. CLEAR: L_STRUNAME, L_FIELDNAME. SPLIT SCREEN-NAME AT '-' INTO L_STRUNAME L_FIELDNAME. IF L_STRUNAME = 'ZLMS_ZLME01161_HEAD'. "SCREEN-INPUT = 1. ELSEIF ( L_STRUNAME = 'ZLMS_ZLME01161_ITEM1' AND L_FIELDNAME IN II_FIELDNAME_B_ITEM1 ). * OR ( L_STRUNAME = 'ZLMS_ZLME01161_ITEM2' AND L_FIELDNAME IN II_FIELDNAME_B_ITEM2 )." SCREEN-INPUT = 1. ELSE. SCREEN-INPUT = 0. ENDIF. ENDIF. MODIFY SCREEN. ENDLOOP. ENDIF. * LOOP AT SCREEN. * CLEAR: L_STRUNAME,L_FIELDNAME. * SPLIT SCREEN-NAME AT '-' INTO L_STRUNAME L_FIELDNAME. * IF ZLMS_ZLME01161_HEAD-ZSPZT1 = 'A' OR ZLMS_ZLME01161_HEAD-ZSPZT2 = 'T'."保存,退回 * CASE ZLMS_ZLME01161_HEAD-ZYSFS ."门到门/短驳. * WHEN 'A'."门到门 * IF SCREEN-NAME = 'ZLMS_ZLME01161_HEAD-PLANS2' ."职位2 * SCREEN-INPUT = 0. * ELSEIF SCREEN-NAME(20) = 'ZLMS_ZLME01161_ITEM1'. * IF L_FIELDNAME IN II_FIELDNAME_A_ITEM1. * SCREEN-INPUT = 1. * ELSE. * SCREEN-INPUT = 0. * ENDIF. * ELSEIF SCREEN-NAME(20) = 'ZLMS_ZLME01161_ITEM2'. * IF L_FIELDNAME IN II_FIELDNAME_A_ITEM2. * SCREEN-INPUT = 1. * ELSE. * SCREEN-INPUT = 0. * ENDIF. * ENDIF. ** ELSEIF SY-TCODE = GV_MODIFY. ** ENDIF. * WHEN 'B'."短驳 * IF SCREEN-NAME = 'ZLMS_ZLME01161_HEAD-PLANS2' ."职位2 * SCREEN-INPUT = 1. * ELSEIF SCREEN-NAME(20) = 'ZLMS_ZLME01161_ITEM1'. * IF L_FIELDNAME IN II_FIELDNAME_B_ITEM1. * SCREEN-INPUT = 1. * ELSE. * SCREEN-INPUT = 0. * ENDIF. * ELSEIF SCREEN-NAME(20) = 'ZLMS_ZLME01161_ITEM2'. * IF L_FIELDNAME IN II_FIELDNAME_B_ITEM2. * SCREEN-INPUT = 1. * ELSE. * SCREEN-INPUT = 0. * ENDIF. * ENDIF. ** ELSEIF SY-TCODE = GV_MODIFY. ** ENDIF. * WHEN OTHERS. * ENDCASE. * ELSEIF ZLMS_ZLME01161_HEAD-ZSPZT1 = 'N' OR ZLMS_ZLME01161_HEAD-ZSPZT1 = 'F'."已提交,同意 **head item1 不能修改,门到门时ITEM2也不能修改。 * IF L_STRUNAME = 'ZLMS_ZLME01161_HEAD' OR L_STRUNAME = 'ZLMS_ZLME01161_ITEM1' * OR ( ZLMS_ZLME01161_HEAD-ZYSFS = 'A' AND L_STRUNAME = 'ZLMS_ZLME01161_ITEM2' ). * SCREEN-INPUT = 0. * ENDIF. * ENDIF. * IF ZLMS_ZLME01161_HEAD-ZSPZT2 = 'A' OR ZLMS_ZLME01161_HEAD-ZSPZT2 = 'T' ."保存,退回 **只管ITME2及相关 ** ZLMS_ZLME01161_HEAD-ZYSFS = 'B' * ENDIF. * MODIFY SCREEN. *ENDLOOP. *****************************************默认值赋值************************************** IF ZLMS_ZLME01161_HEAD-ERDAT IS INITIAL. ZLMS_ZLME01161_HEAD-ERDAT = SY-DATUM. ZLMS_ZLME01161_HEAD-ERZET = SY-UZEIT. ZLMS_ZLME01161_HEAD-ERNAM = SY-UNAME. ELSEIF ZLMS_ZLME01161_HEAD-AEDAT IS INITIAL. * ZLMS_ZLME01161_HEAD-AEDAT = SY-DATUM. * ZLMS_ZLME01161_HEAD-AEZET = SY-UZEIT. * ZLMS_ZLME01161_HEAD-AENAM = SY-UNAME. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form TC_CONTROL 表控件按钮 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_gt_item1 text *----------------------------------------------------------------------* FORM FCODE_INSERT_ROW TABLES PT_ITEM STRUCTURE ZLMS_ZLME01161_ITEM1. DATA: LV_LINES TYPE INT4, LV_ZHXM TYPE ZLM_HXM10. " GET CURSOR LINE LV_LINES. "* *在当前行后插入行 " IF LV_LINES IS INITIAL. " LV_LINES = 1. " ENDIF. " READ TABLE PT_ITEM INTO DATA(LS_ITEM) INDEX LV_LINES. " CHECK SY-SUBRC = 0. " LV_ZHXM = LS_ITEM-ZHXM. " LOOP AT PT_ITEM ASSIGNING FIELD-SYMBOL(<ITEM>) . " IF <ITEM>-ZHXM > LV_ZHXM. " <ITEM>-ZHXM = <ITEM>-ZHXM + 1. " ENDIF. " ENDLOOP. " CLEAR:LS_ITEM. " LS_ITEM-ZYCBGDH = ZLMS_ZLME01161_HEAD-ZYCBGDH. " LS_ITEM-ZHXM = LV_ZHXM + 1. " LV_LINES = LV_LINES + 1."在当前行后面插入行。 " INSERT LS_ITEM INTO PT_ITEM INDEX LV_LINES. " *--------------------------------------------------------------------* *在最后增加行. SORT PT_ITEM BY ZHXM. LV_LINES = LINES( PT_ITEM ). READ TABLE PT_ITEM INTO DATA(LS_ITEM) INDEX LV_LINES. CHECK SY-SUBRC = 0 . LV_ZHXM = LS_ITEM-ZHXM . CLEAR:LS_ITEM. LS_ITEM-ZYCBGDH = ZLMS_ZLME01161_HEAD-ZYCBGDH. LS_ITEM-WERKS = ZLMS_ZLME01161_HEAD-WERKS. LS_ITEM-ZHXM = LV_ZHXM + 1. APPEND LS_ITEM TO PT_ITEM. ENDFORM. FORM FCODE_DELETE_ROW TABLES PT_ITEM STRUCTURE ZLMS_ZLME01161_ITEM1. DATA: LW_ITEM TYPE GTY_ITEM1. DELETE PT_ITEM[] WHERE SEL IS NOT INITIAL. IF SY-SUBRC <> 0. MESSAGE S020(ZLM01) DISPLAY LIKE 'W'. ENDIF. ENDFORM. FORM FCODE_TC_MARK_LINES1 TABLES PT_ITEM STRUCTURE ZLMS_ZLME01161_ITEM1. FIELD-SYMBOLS <FS_TABLE> TYPE GTY_ITEM1. LOOP AT PT_ITEM ASSIGNING <FS_TABLE>. <FS_TABLE>-SEL = 'X'. ENDLOOP. ENDFORM. FORM FCODE_TC_DEMARK_LINES1 TABLES PT_ITEM STRUCTURE ZLMS_ZLME01161_ITEM1. FIELD-SYMBOLS <FS_TABLE> TYPE GTY_ITEM1. LOOP AT PT_ITEM ASSIGNING <FS_TABLE>. <FS_TABLE>-SEL = SPACE. ENDLOOP. ENDFORM. FORM FCODE_TC_MARK_LINES2 TABLES PT_ITEM STRUCTURE ZLMS_ZLME01161_ITEM2. FIELD-SYMBOLS <FS_TABLE> TYPE GTY_ITEM2. LOOP AT PT_ITEM ASSIGNING <FS_TABLE>. <FS_TABLE>-SEL = 'X'. ENDLOOP. ENDFORM. FORM FCODE_TC_DEMARK_LINES2 TABLES PT_ITEM STRUCTURE ZLMS_ZLME01161_ITEM2. FIELD-SYMBOLS <FS_TABLE> TYPE GTY_ITEM2. LOOP AT PT_ITEM ASSIGNING <FS_TABLE>. <FS_TABLE>-SEL = SPACE. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form CALCULATE_ITEM_DATA_TC *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * <--P_ZLMS_ZLME01161_ITEM1 text *----------------------------------------------------------------------* FORM CALCULATE_ITEM1_DATA_TC CHANGING PW_ITEM1 STRUCTURE ZLMS_ZLME01161_ITEM1. * * "检查异常小类 * IF PW_ITEM1-ZYCXL IS NOT INITIAL . * SELECT SINGLE * * INTO @DATA(LS_ZLMT03820_LB) * FROM ZLMT03820_LB * WHERE ZYCXL = @PW_ITEM1-ZYCXL . * IF SY-SUBRC <> 0 . * MESSAGE E503(ZLM02)."异常小类不存在 * ENDIF. * PW_ITEM1-ZYCDL = LS_ZLMT03820_LB-ZYCDL. * PW_ITEM1-ZYCXLMS = LS_ZLMT03820_LB-ZYCXLMS. * ENDIF. * * * IF ZLMS_ZLME01161_HEAD-ZYSFS = 'A'."门到门 **EBELN."采购凭证号 **EBELP."采购凭证的项目编号 **ZYCXL."异常小类 PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_HEAD-DBZGYGH '' 'ZLMS_ZLME01161_HEAD-DBZGYGH'. **ZYCJS."异常件数 **ZBZ."备注 IF GV_STATUS = 'E'. **ZSL."数量 CLEAR GV_STATUS. **ZJS."件数 MESSAGE E013(ZLM01)."请填写必填项! **ZDJZL."单件重量(公斤) * IF PW_ITEM1-EBELN IS NOT INITIAL AND PW_ITEM1-EBELP IS NOT INITIAL. * SELECT SINGLE * * INTO @DATA(LS_EKPO) * FROM EKPO * WHERE EBELN = @PW_ITEM1-EBELN * AND EBELP = @PW_ITEM1-EBELP * AND WERKS = @ZLMS_ZLME01161_HEAD-WERKS. * IF SY-SUBRC <> 0. * MESSAGE E504(ZLM02) WITH ZLMS_ZLME01161_HEAD-WERKS PW_ITEM1-EBELN PW_ITEM1-EBELP ."采购订单&1项目&2不存在 * ENDIF. * PW_ITEM1-MEINS = LS_EKPO-MEINS. * PW_ITEM1-WERKS = LS_EKPO-WERKS. * SELECT SINGLE * * INTO @DATA(LS_EKKO) * FROM EKKO * WHERE EBELN = @PW_ITEM1-EBELN. * IF SY-SUBRC <> 0. * MESSAGE E505(ZLM02) WITH PW_ITEM1-EBELN ''."采购订单&1不存在 * ENDIF. * PW_ITEM1-ZHTH = LS_EKKO-ZZZHTBH."纸质合同编号 * PW_ITEM1-ZYCZL = PW_ITEM1-ZYCJS * PW_ITEM1-ZDJZL."异常重量 = 异常件数*单件重量;KG单位转单据单位输入 * PW_ITEM1-LIFNR = LS_EKKO-LIFNR."纸质合同编号 * ENDIF. * ELSEIF ZLMS_ZLME01161_HEAD-ZYSFS = 'B'."短驳 * IF PW_ITEM1-VBELN IS NOT INITIAL AND PW_ITEM1-POSNR IS NOT INITIAL. * SELECT SINGLE * * INTO @DATA(LS_LIPS) * FROM LIPS * WHERE VBELN = @PW_ITEM1-VBELN * AND POSNR = @PW_ITEM1-POSNR * AND WERKS = @ZLMS_ZLME01161_HEAD-WERKS. * IF SY-SUBRC <> 0. * MESSAGE E515(ZLM02) WITH ZLMS_ZLME01161_HEAD-WERKS PW_ITEM1-VBELN PW_ITEM1-POSNR ."工厂&1下不存在交货单&2项目&3 * ENDIF. * PW_ITEM1-EBELN = LS_LIPS-VGBEL. * PW_ITEM1-EBELP = LS_LIPS-VGPOS. * * * PW_ITEM1-MEINS = LS_LIPS-VRKME. * PW_ITEM1-WERKS = LS_LIPS-WERKS. * PW_ITEM1-ZSL = LS_LIPS-LFIMG."数量 = 实际已交货量(按销售单位) * PW_ITEM1-ZJS = LS_LIPS-YYJS."件数 = 预约件数 * PW_ITEM1-ZDJZL = LS_LIPS-DJBZZ ."单件重量(公斤) * SELECT SINGLE * * INTO @DATA(LS_LIKP) * FROM LIKP * WHERE VBELN = @PW_ITEM1-VBELN. * IF SY-SUBRC = 0 . * PW_ITEM1-ZCM = LS_LIKP-ZZCM."船名 * PW_ITEM1-ZHC = LS_LIKP-ZZHC."航次 * * PW_ITEM1-ZTDH = LS_LIKP-ZZZDH."总单号/提运单号 * * SELECT SINGLE BGDH * INTO PW_ITEM1-ZBGDH"报关单号 * FROM ZLMT00371 * WHERE VBELN = PW_ITEM1-VBELN * AND POSNR = PW_ITEM1-POSNR. * * * ENDIF. * * * SELECT SINGLE TKNUM * INTO PW_ITEM1-TKNUM"装运编号 * FROM VTTP * WHERE VBELN = PW_ITEM1-VBELN.. * * "承运商 * IF PW_ITEM1-TKNUM IS NOT INITIAL. * SELECT SINGLE TDLNR * INTO PW_ITEM1-TDLNR * FROM VTTK * WHERE TKNUM = PW_ITEM1-TKNUM. * ENDIF. * "收货数量 = 过账后后过账数量. * SELECT * * INTO TABLE @DATA(LT_MSEG) * FROM MSEG * WHERE VBELN_IM = @PW_ITEM1-VBELN * AND VBELP_IM = @PW_ITEM1-POSNR. * LOOP AT LT_MSEG INTO DATA(LS_MSEG). * IF LS_MSEG-SHKZG = 'S'. * PW_ITEM1-ZSHSL = PW_ITEM1-ZSHSL + LS_MSEG-MENGE. * ENDIF. * ENDLOOP. * CLEAR:LT_MSEG. * IF PW_ITEM1-EBELN IS NOT INITIAL. * SELECT SINGLE * * INTO LS_EKKO * FROM EKKO * WHERE EBELN = PW_ITEM1-EBELN. * IF SY-SUBRC = 0. ** MESSAGE E505(ZLM02) WITH PW_ITEM1-EBELN ''."采购订单&1不存在 * PW_ITEM1-ZHTH = LS_EKKO-ZZZHTBH."纸质合同编号 * PW_ITEM1-LIFNR = LS_EKKO-LIFNR."纸质合同编号 * ENDIF. * ENDIF. * PW_ITEM1-ZYCZL = PW_ITEM1-ZYCJS * PW_ITEM1-ZDJZL."异常重量 = 异常件数*单件重量;KG单位转单据单位输入 * ENDIF. * ENDIF. ENDFORM. FORM CALCULATE_ITEM2_DATA_TC CHANGING PW_ITEM1 STRUCTURE ZLMS_ZLME01161_ITEM2. ENDFORM. *&---------------------------------------------------------------------* *& Form SAVE_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_gt_item1 text * <--P_ZLMS_ZLME01161_HEAD text *----------------------------------------------------------------------* FORM PRF_SAVE_DATA. PERFORM CHECK_OBLIGATORY. ****BEGIN OF MODIFY BY PENGFS 20200609 PERFORM FRM_SAVE_BEF_CHECK CHANGING LV_NEW_OLD_FLAG. ****END OF MODIFY BY PENGFS 20200609 * PERFORM FRM_RESERVATION_SIMULATE. IF GV_STATUS NE 'E'. IF GT_ITEM1[] IS NOT INITIAL. PERFORM SAVE_DATA . ELSE. MESSAGE E443(ZLM01) ."没有行项目无法保存 ENDIF. ENDIF. ENDFORM. FORM SAVE_DATA . * GT_ITEM1 * CHANGING ZLMS_ZLME01161_HEAD DATA: LS_ITEM1 TYPE GTY_ITEM1, LS_ITEM2 TYPE GTY_ITEM2, LS_ZLMT03820 TYPE ZLMT03820, "抬头保存 LT_ZLMT03821 TYPE TABLE OF ZLMT03821, "行项目保存 LT_ZLMT03822 TYPE TABLE OF ZLMT03822, "行项目明细保存 LS_ZLMT03821 TYPE ZLMT03821, "行项目保存 LS_ZLMT03822 TYPE ZLMT03822. "行项目明细保存 CLEAR:GV_ORDER. CASE SY-TCODE. WHEN GV_CREATE. ZLMS_ZLME01161_HEAD-ZSPZT1 = 'A'. ZLMS_ZLME01161_HEAD-ERNAM = SY-UNAME. ZLMS_ZLME01161_HEAD-ERDAT = SY-DATUM. ZLMS_ZLME01161_HEAD-ERZET = SY-UZEIT. IF ZLMS_ZLME01161_HEAD-ZYCBGDH IS INITIAL. PERFORM GET_NUMBE_RANGE CHANGING ZLMS_ZLME01161_HEAD-ZYCBGDH. ENDIF. * IF GV_STATUS NE 'E'. * * ELSE. * CLEAR ZLMS_ZLME01161_HEAD-ZYCBGDH. * ENDIF. WHEN GV_MODIFY. IF ZLMS_ZLME01161_HEAD-ZSPZT1 = ''. ZLMS_ZLME01161_HEAD-ZSPZT1 = 'A'. ENDIF. IF ZLMS_ZLME01161_HEAD-ZSPZT1 = 'F' AND ZLMS_ZLME01161_HEAD-ZSPZT2 = '' ."状态1同意 ZLMS_ZLME01161_HEAD-ZSPZT2 = 'A'. ENDIF. ZLMS_ZLME01161_HEAD-AENAM = SY-UNAME. ZLMS_ZLME01161_HEAD-AEDAT = SY-DATUM. ZLMS_ZLME01161_HEAD-AEZET = SY-UZEIT. WHEN OTHERS. ENDCASE. IF ZLMS_ZLME01161_HEAD-ZYCBGDH IS NOT INITIAL. CLEAR: LS_ZLMT03820,LT_ZLMT03821,LT_ZLMT03822. MOVE-CORRESPONDING ZLMS_ZLME01161_HEAD TO LS_ZLMT03820. IF GT_ITEM1 IS NOT INITIAL. LOOP AT GT_ITEM1 INTO LS_ITEM1. LS_ITEM1-ZYCBGDH = ZLMS_ZLME01161_HEAD-ZYCBGDH. MODIFY GT_ITEM1 FROM LS_ITEM1. MOVE-CORRESPONDING LS_ITEM1 TO LS_ZLMT03821. APPEND LS_ZLMT03821 TO LT_ZLMT03821. CLEAR LS_ITEM1. ENDLOOP. ENDIF. IF GT_ITEM2 IS NOT INITIAL. LOOP AT GT_ITEM2 INTO LS_ITEM2. LS_ITEM2-ZYCBGDH = ZLMS_ZLME01161_HEAD-ZYCBGDH. MODIFY GT_ITEM2 FROM LS_ITEM2. MOVE-CORRESPONDING LS_ITEM2 TO LS_ZLMT03822. APPEND LS_ZLMT03822 TO LT_ZLMT03822. CLEAR LS_ITEM2. ENDLOOP. ENDIF. DELETE FROM ZLMT03821 WHERE ZYCBGDH = ZLMS_ZLME01161_HEAD-ZYCBGDH. DELETE FROM ZLMT03822 WHERE ZYCBGDH = ZLMS_ZLME01161_HEAD-ZYCBGDH. MODIFY ZLMT03820 FROM LS_ZLMT03820. MODIFY ZLMT03821 FROM TABLE LT_ZLMT03821. MODIFY ZLMT03822 FROM TABLE LT_ZLMT03822. COMMIT WORK AND WAIT. MESSAGE S506(ZLM02) WITH ZLMS_ZLME01161_HEAD-ZYCBGDH."异常报告单保存成功 GV_ORDER = ZLMS_ZLME01161_HEAD-ZYCBGDH. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form POPUP_TO_CONFIRM *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_TEXT_100 text * -->P_TEXT_200 text * -->P_TEXT_300 text * <--P_LV_ANSWER text *----------------------------------------------------------------------* FORM POPUP_TO_CONFIRM USING P_TEXT_100 P_TEXT_300 CHANGING PV_ANSWER. CALL FUNCTION 'POPUP_TO_CONFIRM' EXPORTING TITLEBAR = P_TEXT_300 TEXT_QUESTION = P_TEXT_100 TEXT_BUTTON_1 = TEXT-603 TEXT_BUTTON_2 = TEXT-604 DISPLAY_CANCEL_BUTTON = '' IMPORTING ANSWER = PV_ANSWER EXCEPTIONS TEXT_NOT_FOUND = 1 OTHERS = 2. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form GET_DESCRIPTION *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_gt_item1 text * <--P_ZLMS_ZLME01161_HEAD text *----------------------------------------------------------------------* FORM GET_DESCRIPTION TABLES PT_ITEM STRUCTURE ZLMS_ZLME01161_ITEM1 CHANGING ZLMS_ZLME01161_HEAD STRUCTURE ZLMS_ZLME01161_HEAD. ENDFORM. *&---------------------------------------------------------------------* *& Form GET_PERNR_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * <--P_ZLMS_ZLME01161_HEAD text *----------------------------------------------------------------------* FORM GET_PERNR_DATA. DATA: LV_NAME TYPE ZSQRXM, LV_DEPT TYPE ZSQRBM, LV_DEPTNO TYPE ZHRBMBH. DATA: LT_ZHRS01030 TYPE TABLE OF ZHRS01030 WITH HEADER LINE. DATA: L_LINES TYPE INT4. CLEAR:GV_NAME1,GV_NAME2. IF ZLMS_ZLME01161_HEAD-CNAME_CRE1 IS NOT INITIAL AND ZLMS_ZLME01161_HEAD-PLANS1 IS INITIAL. CALL FUNCTION 'ZFM_HR_GET_USERNAME' EXPORTING PERNR = ZLMS_ZLME01161_HEAD-CNAME_CRE1 IMPORTING NAME = LV_NAME "申请人姓名 DEPT = LV_DEPT "部门名称 DEPTNO = LV_DEPTNO. "部门 GV_NAME1 = LV_NAME. CALL FUNCTION 'ZFM_HR_GET_PLANS_LIST_FOR_LM' EXPORTING IV_PERNR = ZLMS_ZLME01161_HEAD-CNAME_CRE1 * IV_BEGDA = SY-DATUM * IV_ENDDA = SY-DATUM TABLES ET_PLANS_LIST = LT_ZHRS01030. L_LINES = LINES( LT_ZHRS01030 ). IF L_LINES = 1. READ TABLE LT_ZHRS01030 INDEX 1. ZLMS_ZLME01161_HEAD-PLANS1 = LT_ZHRS01030-PLANS. ENDIF. ENDIF. CLEAR:LV_NAME,LV_DEPT,LV_DEPTNO,LT_ZHRS01030[],LT_ZHRS01030. IF ZLMS_ZLME01161_HEAD-CNAME_CRE2 IS NOT INITIAL AND ZLMS_ZLME01161_HEAD-PLANS2 IS INITIAL AND ZLMS_ZLME01161_HEAD-ZYSFS = 'B' AND ZLMS_ZLME01161_HEAD-ZSPZT1 = 'F'. CALL FUNCTION 'ZFM_HR_GET_USERNAME' EXPORTING PERNR = ZLMS_ZLME01161_HEAD-CNAME_CRE2 IMPORTING NAME = LV_NAME "申请人姓名 DEPT = LV_DEPT "部门名称 DEPTNO = LV_DEPTNO. "部门 GV_NAME2 = LV_NAME. CALL FUNCTION 'ZFM_HR_GET_PLANS_LIST_FOR_LM' EXPORTING IV_PERNR = ZLMS_ZLME01161_HEAD-CNAME_CRE2 * IV_BEGDA = SY-DATUM * IV_ENDDA = SY-DATUM TABLES ET_PLANS_LIST = LT_ZHRS01030. L_LINES = LINES( LT_ZHRS01030 ). IF L_LINES = 1. READ TABLE LT_ZHRS01030 INDEX 1. ZLMS_ZLME01161_HEAD-PLANS2 = LT_ZHRS01030-PLANS. ENDIF. ENDIF. ENDFORM. *& Form GET_ITEM_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_gt_item1 text *----------------------------------------------------------------------* FORM GET_ITEM_DATA TABLES PT_ITEM STRUCTURE ZLMS_ZLME01161_ITEM1. * DATA: LW_ITEM TYPE gty_item1, * LV_ORDER TYPE RESB-AUFNR, * LV_ZHXM TYPE ZLMT03821-ZHXM, * LV_AUART TYPE AUFK-AUART, "判断是生产订单还是维修订单 * LV_OBJNR TYPE AUFK-OBJNR, "判断状态是否是 I0002 * LV_STAT TYPE JEST-STAT. "判断状态是否是 I0002 * DATA: BEGIN OF LT_MARD OCCURS 0, * LGORT TYPE MARD-LGORT, * LABST TYPE MARD-LABST, * END OF LT_MARD, * LV_ZZ TYPE ATWRT, * LV_MENGE_301 TYPE ZLMT03821-MENGE, * LV_MENGE_303 TYPE ZLMT00303-MENGE. * RANGES:RG_RSNUM FOR RESB-RSNUM, * RG_BMATN FOR AMPL-BMATN. * * REFRESH: PT_ITEM,gt_item1_DELETE. * IF ZLMS_ZLME01161_HEAD-AUFNR IS NOT INITIAL."生产订单优先级大 * SELECT MATNR * BDMNG AS MENGE * WERKS * BDTER * ENMNG * RSNUM * RSPOS * INTO CORRESPONDING FIELDS OF TABLE PT_ITEM * FROM RESB * WHERE AUFNR = ZLMS_ZLME01161_HEAD-AUFNR * AND RSNUM IN RG_RSNUM * AND BDMNG IS NOT NULL. * CLEAR:LV_AUART. * SELECT SINGLE AUART OBJNR INTO (LV_AUART,LV_OBJNR) * FROM AUFK WHERE AUFNR = ZLMS_ZLME01161_HEAD-AUFNR. * IF ZLMS_ZLME01161_HEAD-LLTYP = 'A'."A是生产订单 AUFK-AUART <> 'ZM*' * IF LV_AUART(2) = 'ZM'. * MESSAGE E350(ZLM01)."请填写生产订单 * ENDIF. * ELSEIF ZLMS_ZLME01161_HEAD-LLTYP = 'B'."B是维修订单 AUFK-AUART = 'ZM*' * REFRESH PT_ITEM. * SELECT MATNR * BDMNG AS MENGE * WERKS * BDTER * ENMNG * RSNUM * RSPOS * INTO CORRESPONDING FIELDS OF TABLE PT_ITEM * FROM RESB * WHERE AUFNR = ZLMS_ZLME01161_HEAD-AUFNR * AND RSNUM IN RG_RSNUM * AND XLOEK NE 'X' * AND POSTP NE 'T' * AND BDMNG IS NOT NULL. * IF LV_AUART(2) <> 'ZM'. * MESSAGE E351(ZLM01)."请填写维修订单 * ENDIF. * SELECT SINGLE STAT INTO LV_STAT * FROM JEST WHERE OBJNR = LV_OBJNR AND STAT = 'I0002' AND INACT = ''. * IF SY-SUBRC NE 0. * MESSAGE E474(ZLM01)."工单状态为下达才可领料 * ELSE. * SELECT SINGLE STAT INTO LV_STAT * FROM JEST WHERE OBJNR = LV_OBJNR AND ( STAT = 'E0004' OR STAT = 'E0005' ) AND INACT = ''. ** SELECT SINGLE objnr INTO lv_objnr ** FROM jsto INNER JOIN tj30 ON jsto~stsma = tj30~stsma WHERE objnr = lv_objnr AND ** ( estat = 'E0004' OR estat = 'E0005' ) AND INIST = 'X'. * IF SY-SUBRC <> 0. * MESSAGE E474(ZLM01)."工单状态为下达才可领料 * ENDIF. * ENDIF. * ENDIF. * ELSEIF ZLMS_ZLME01161_HEAD-PLNUM IS NOT INITIAL. * SELECT MATNR * BDMNG AS MENGE * WERKS * BDTER * ENMNG * RSNUM * RSPOS * INTO CORRESPONDING FIELDS OF TABLE PT_ITEM * FROM RESB * WHERE PLNUM = ZLMS_ZLME01161_HEAD-PLNUM * AND RSNUM IN RG_RSNUM. * ENDIF. * IF PT_ITEM[] IS INITIAL. * PERFORM INSERT_ROW TABLES PT_ITEM. * IF ZLMS_ZLME01161_HEAD-AUFNR IS NOT INITIAL. * LV_ORDER = ZLMS_ZLME01161_HEAD-AUFNR. * ELSE. * LV_ORDER = ZLMS_ZLME01161_HEAD-PLNUM. * ENDIF. * MESSAGE S135(ZLM01) WITH LV_ORDER DISPLAY LIKE 'E'."订单&1没有数据 * ELSE. * "抬头工厂 * CLEAR:ZLMS_ZLME01161_HEAD-WERKS. * SELECT SINGLE WERKS INTO ZLMS_ZLME01161_HEAD-WERKS FROM AUFK WHERE AUFNR = ZLMS_ZLME01161_HEAD-AUFNR. * "物料描述 小物料 物料关系 * LOOP AT PT_ITEM INTO LW_ITEM. * * "物料描述 多个小物料对应一个物料 * IF LW_ITEM-MATNR IS NOT INITIAL AND LW_ITEM-EMATN IS NOT INITIAL. * SELECT SINGLE MAKTX FROM MAKT INTO LW_ITEM-MAKTX WHERE MATNR = LW_ITEM-EMATN AND SPRAS = SY-LANGU. * ELSEIF LW_ITEM-MATNR IS NOT INITIAL AND LW_ITEM-EMATN IS INITIAL. * SELECT SINGLE MAKTX FROM MAKT INTO LW_ITEM-MAKTX WHERE MATNR = LW_ITEM-MATNR AND SPRAS = SY-LANGU. * ELSEIF LW_ITEM-MATNR IS INITIAL AND LW_ITEM-EMATN IS NOT INITIAL. * SELECT SINGLE BMATN FROM AMPL INTO LW_ITEM-MATNR WHERE EMATN = LW_ITEM-EMATN AND BMATN IN RG_BMATN. * SELECT SINGLE MAKTX FROM MAKT INTO LW_ITEM-MAKTX WHERE MATNR = LW_ITEM-EMATN. * ENDIF. * "如果领料类型为B * IF ZLMS_ZLME01161_HEAD-LLTYP = 'B'. * CLEAR:LV_MENGE_301,LV_MENGE_303. * LW_ITEM-MENGE1 = LW_ITEM-MENGE - LW_ITEM-ENMNG. * SELECT SINGLE SUM( MENGE ) INTO LV_MENGE_301 FROM ZLMT03821 WHERE RSNUM = LW_ITEM-RSNUM AND RSPOS = LW_ITEM-RSPOS. * SELECT SINGLE SUM( MENGE ) INTO LV_MENGE_303 FROM ZLMT00303 WHERE RSNUM = LW_ITEM-RSNUM AND RSPOS = LW_ITEM-RSPOS. * LW_ITEM-MENGE2 = LW_ITEM-MENGE - ( LV_MENGE_301 - LV_MENGE_303 ). * SELECT SINGLE MAKTX FROM MAKT INTO LW_ITEM-MAKTX WHERE MATNR = LW_ITEM-MATNR AND SPRAS = SY-LANGU. * IF LW_ITEM-MENGE1 < 0 OR LW_ITEM-MENGE2 < 0 . * DELETE PT_ITEM. * CONTINUE. * ENDIF. * IF LW_ITEM-MENGE1 < LW_ITEM-MENGE2. * LW_ITEM-MENGE = LW_ITEM-MENGE1. * ELSE. * LW_ITEM-MENGE = LW_ITEM-MENGE2. * ENDIF. * IF LW_ITEM-MENGE IS INITIAL. * DELETE PT_ITEM. * CONTINUE. * ENDIF. * ENDIF. * * "供应商 * SELECT SINGLE LIFNR FROM MCHA INTO LW_ITEM-LIFNR WHERE MATNR = LW_ITEM-MATNR * AND WERKS = LW_ITEM-WERKS * AND CHARG = LW_ITEM-CHARG. * "库存数量 * IF ZLMS_ZLME01161_HEAD-WERKS IS INITIAL. * ZLMS_ZLME01161_HEAD-WERKS = LW_ITEM-WERKS. * ENDIF. * REFRESH LT_MARD. * SELECT LGORT LABST FROM MARD INTO TABLE LT_MARD WHERE MATNR = LW_ITEM-MATNR * AND WERKS = LW_ITEM-WERKS. * LOOP AT LT_MARD WHERE LGORT(2) NE '31'. * LW_ITEM-LABST = LT_MARD-LABST + LW_ITEM-LABST. * ENDLOOP. * * "单位 * SELECT SINGLE MEINS FROM MARA INTO LW_ITEM-MEINS WHERE MATNR = LW_ITEM-MATNR. * "需求量 = 需求量 - 提货量 * LW_ITEM-MENGE = LW_ITEM-MENGE - LW_ITEM-ENMNG. * "抬头工厂 * CLEAR:ZLMS_ZLME01161_HEAD-LLSQRQ,ZLMS_ZLME01161_HEAD-RSNUM. * ZLMS_ZLME01161_HEAD-LLSQRQ = LW_ITEM-BDTER. * ZLMS_ZLME01161_HEAD-RSNUM = LW_ITEM-RSNUM. * * "纸种 * CLEAR LV_ZZ. * IF LW_ITEM-MATNR IS NOT INITIAL. * CALL FUNCTION 'ZFM_LM_MATERIAL_OBJECT' * EXPORTING * IV_MATNR = LW_ITEM-MATNR * IV_OBJECTTABLE = 'MARA' * IMPORTING * EV_ZZ = LV_ZZ. * IF LV_ZZ IS NOT INITIAL. * LW_ITEM-ZZMS = LV_ZZ. * DATA(LV_LENTH) = STRLEN( LV_ZZ ). * LV_LENTH = LV_LENTH - 3. * LW_ITEM-ZZ = LV_ZZ+LV_LENTH(3). * ENDIF. * ENDIF. * * "行项目 * LV_ZHXM = LV_ZHXM + 1. * LW_ITEM-ZHXM = LV_ZHXM. * * MODIFY PT_ITEM FROM LW_ITEM. * CLEAR LW_ITEM. * ENDLOOP. * DELETE PT_ITEM WHERE MENGE IS INITIAL. * ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form CHECK_OBLIGATORY *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM CHECK_OBLIGATORY . * DATA: LW_ITEM TYPE gty_item1, * LV_AUFNR TYPE AUFK-AUFNR. CLEAR GV_STATUS. "head "通用必输判断 PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_HEAD-ZYSFS '' 'ZLMS_ZLME01161_HEAD-ZYSFS'. PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_HEAD-WERKS '' 'ZLMS_ZLME01161_HEAD-WERKS'. PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_HEAD-PLANS1 '' 'ZLMS_ZLME01161_HEAD-PLANS1'. CASE ZLMS_ZLME01161_HEAD-ZYSFS."门到门/短驳 WHEN 'A'. * "生产订单或计划订单必输判断 * PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_HEAD-AUFNR '' 'ZLMS_ZLME01161_HEAD-AUFNR'. * IF GV_STATUS = 'E'. * PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_HEAD-PLNUM '' 'ZLMS_ZLME01161_HEAD-PLNUM'. * IF ZLMS_ZLME01161_HEAD-PLNUM IS NOT INITIAL. * CLEAR GV_STATUS. * ENDIF. * ENDIF. * "当审批级别为A,当班主管员工号必输 * PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_HEAD-DBZGYGH '' 'ZLMS_ZLME01161_HEAD-DBZGYGH'. WHEN 'B'. IF ZLMS_ZLME01161_HEAD-ZSPZT1 = 'F' AND ZLMS_ZLME01161_HEAD-ZSPZT2 <> 'F'. PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_HEAD-PLANS2 '' 'ZLMS_ZLME01161_HEAD-PLANS2'. ENDIF. * PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_HEAD-AUFNR '' 'ZLMS_ZLME01161_HEAD-AUFNR'. * PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_HEAD-KOSTL '' 'ZLMS_ZLME01161_HEAD-KOSTL'. * SELECT SINGLE AUFNR INTO LV_AUFNR FROM VIAUFKS * WHERE AUART = 'ZM08' AND ILART IN ('M05','M06','M07') AND AUFNR = ZLMS_ZLME01161_HEAD-AUFNR. * IF SY-SUBRC <> 0. * PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_HEAD-MAT_PSPNR '' 'ZLMS_ZLME01161_HEAD-MAT_PSPNR'. * ENDIF. * WHEN 'C' OR 'I'. * "成本中心必输 * PERFORM CHECK_FIELD_INITIAL USING ZLMS_ZLME01161_HEAD-KOSTL '' 'ZLMS_ZLME01161_HEAD-KOSTL'. * IF ZLMS_ZLME01161_HEAD-BWART = '941'. * &nbs |