此模板可以做为单屏幕显示主从表显示操作的模板,主要优点及功能如下
1.简单查询,快速显示;
2.使用OO的ALV,显示数据主表,双击主表数据行时,生成相关明细表数据;
3.带选择行,并可增加处理功能按钮;
4.查询条件多TAB,分别业务查询显示;
5.新需求时,修改简单;
6.包含EXECL导入到SAP并保存到表;
7.可以下载导入模板,模板使用SMW0上传;
8,包含处理进度条功能,
1.此模板实现效果
2.一、创建程序
1 2 3 4 5 6 7 8 9 10 |
INCLUDE ZSDR0226_TOP. INCLUDE ZSDR0226_SCR. INCLUDE ZSDR0226_CLS. INCLUDE ZSDR0226_DYN. INCLUDE ZSDR0226_FRM. INCLUDE ZSDR0226_F01. INCLUDE ZSDR0226_F02. INCLUDE ZSDR0226_F03. INCLUDE ZSHOW_JD."用于显示数据查询处理进度 |
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 |
*&---------------------------------------------------------------------* *& 包括 ZSDR0226_TOP *&---------------------------------------------------------------------* TABLES: SSCRFIELDS. TABLES: ZSDT0226A_H,ZSDT0226B_H, ZSDT0226_I, ZWMT0008,MKPF,MSEG,T023,T179T. TYPE-POOLS SLIS. *--------------------------------------------------------------------* TYPES: BEGIN OF TY_ALV, OBJKEY TYPE CHAR79, "错误显示组的ID, ZEBELN TYPE ZEBELN01, ZBTYPE TYPE ZBTYPE, LIFNR TYPE LIFNR, ZWLGS TYPE ZWLGS, ZDQFB TYPE ZDQFB, KUNNR TYPE KUNNR, ZCONNO TYPE ZCONNO, TAX_RATE TYPE ZTAX_RATE, ZSTATUS TYPE ZSTATUS01, ZCREN TYPE ZCREN, ZCRED TYPE ZCRED, ZBUKRS01 TYPE ZBUKRS01, ZBUKRS02 TYPE ZBUKRS02, ZBUKRS03 TYPE ZBUKRS03, ZBUKRS04 TYPE ZBUKRS04, ZBUKRS05 TYPE ZBUKRS05, ZBUKRS06 TYPE ZBUKRS06, ZBUKRS07 TYPE ZBUKRS07, ZBUKRS08 TYPE ZBUKRS08, ZBUKRS09 TYPE ZBUKRS09, ZBUKRS10 TYPE ZBUKRS10, ZSEL(1), "选择行 STATU TYPE ICONNAME,"用于显示红黄标记 MESSAGE TYPE MSGTX, "短错误提示 IDKEY TYPE CHAR79, "行ID CELLSTYLES TYPE LVC_T_STYL, END OF TY_ALV. DATA: GT_ALV TYPE TABLE OF TY_ALV, GS_ALV TYPE TY_ALV. FIELD-SYMBOLS: <ALV> STRUCTURE GS_ALV DEFAULT GS_ALV. *--------------------------------------------------------------------* *--------------------------------------------------------------------* TYPES: BEGIN OF TY_ALV_P. INCLUDE STRUCTURE ZSDT0226_LOG. TYPES: ZSEL(1), "选择行 STATU TYPE ICONNAME,"用于显示红黄标记 IDKEY TYPE CHAR79, "行ID CELLSTYLES TYPE LVC_T_STYL, END OF TY_ALV_P. DATA: GT_ALV_P TYPE TABLE OF TY_ALV_P, GS_ALV_P TYPE TY_ALV_P. FIELD-SYMBOLS: <ALV_P> STRUCTURE GS_ALV_P DEFAULT GS_ALV_P. *--------------------------------------------------------------------* TYPES: BEGIN OF TY_ALV_I. INCLUDE STRUCTURE ZSDT0226_I. TYPES: ZSEL, STATU TYPE ICONNAME, MESSAGE(100), IDKEY TYPE CHAR79, "行ID CELLSTYLES TYPE LVC_T_STYL. TYPES: END OF TY_ALV_I. DATA: GT_ALV_I TYPE TABLE OF TY_ALV_I, GS_ALV_I TYPE TY_ALV_I. FIELD-SYMBOLS: <ALV_I> STRUCTURE GS_ALV_I DEFAULT GS_ALV_I. DATA: GT_LOG LIKE TABLE OF MASSMSG, GS_LOG LIKE MASSMSG. FIELD-SYMBOLS: <LOG> STRUCTURE GS_LOG DEFAULT GS_LOG. DATA: GT_STRUCTURE TYPE LVC_T_FCAT, GT_STRUCTURE1 TYPE LVC_T_FCAT, GT_STRUCTURE2 TYPE LVC_T_FCAT, GT_STRUCTURE3 TYPE LVC_T_FCAT, GS_STRUCTURE TYPE LVC_S_FCAT, WA_LAYOUT TYPE LVC_S_LAYO, S_DISVARIANT TYPE DISVARIANT, * GR_GRID TYPE REF TO CL_GUI_ALV_GRID, G_DOCKING TYPE REF TO CL_GUI_DOCKING_CONTAINER. DATA: G_CONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER, G_GRID1 TYPE REF TO CL_GUI_ALV_GRID, G_CONTAINER2 TYPE REF TO CL_GUI_CUSTOM_CONTAINER, G_GRID2 TYPE REF TO CL_GUI_ALV_GRID, G_CONTAINER3 TYPE REF TO CL_GUI_CUSTOM_CONTAINER, G_GRID3 TYPE REF TO CL_GUI_ALV_GRID, G_CONTAINER4 TYPE REF TO CL_GUI_CUSTOM_CONTAINER, G_GRID4 TYPE REF TO CL_GUI_ALV_GRID. DATA: GT_FILTER2 TYPE LVC_T_FILT, GT_FILTER3 TYPE LVC_T_FILT, GS_FILTER2 TYPE LINE OF LVC_T_FILT, GS_FILTER3 TYPE LINE OF LVC_T_FILT. *&---------------------------------------------------------------------* *& 宏定义 *&---------------------------------------------------------------------* DEFINE BULID_FIELDLOG. GS_STRUCTURE-FIELDNAME = &1. GS_STRUCTURE-COLTEXT = &2. GS_STRUCTURE-REF_TABLE = &3. GS_STRUCTURE-REF_FIELD = &4. GS_STRUCTURE-EDIT = &5. GS_STRUCTURE-LZERO = &6. GS_STRUCTURE-NO_ZERO = &7. GS_STRUCTURE-JUST = &8. GS_STRUCTURE-KEY = &9. GS_STRUCTURE-COL_OPT = 'X'. IF &1 EQ 'ZSEL'. GS_STRUCTURE-CHECKBOX = 'X'. ENDIF. APPEND GS_STRUCTURE TO GT_STRUCTURE. CLEAR GS_STRUCTURE. END-OF-DEFINITION. DEFINE APPEND_ERR. GS_LOG-OBJKEY = &1. GS_LOG-MSGTY = &2. GS_LOG-MSGID = &3. GS_LOG-MSGNO = &4. GS_LOG-MSGV1 = &5. GS_LOG-MSGV2 = &6. GS_LOG-MSGV3 = &7. GS_LOG-MSGV4 = &8. APPEND GS_LOG TO GT_LOG. END-OF-DEFINITION. |
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 |
*&---------------------------------------------------------------------* *& 包括 ZSDR0226_SCR *&---------------------------------------------------------------------* DATA:BEGIN OF S_SCREEN, DYNNR LIKE SY-DYNNR, ACTIVETAB(132), PROG LIKE SY-REPID, END OF S_SCREEN . SELECTION-SCREEN FUNCTION KEY 1. SELECTION-SCREEN FUNCTION KEY 2. PARAMETERS: P_DYNNR LIKE SY-DYNNR NO-DISPLAY. SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF BLOCK BL10 WITH FRAME TITLE TEXT-T01. PARAMETERS: P_CHK11 RADIOBUTTON GROUP IN , P_CHK12 RADIOBUTTON GROUP IN . PARAMETERS: P_FILE LIKE RLGRAP-FILENAME MEMORY ID FLN. SELECTION-SCREEN END OF BLOCK BL10. SELECTION-SCREEN END OF SCREEN 100. SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF BLOCK BL20 WITH FRAME TITLE TEXT-T02. SELECT-OPTIONS: S_ZEBELN FOR ZSDT0226A_H-ZEBELN MEMORY ID ZEB, S_ZBTYPE FOR ZSDT0226A_H-ZBTYPE, S_ZCREN FOR ZSDT0226A_H-ZCREN DEFAULT SY-UNAME, S_ZCRED FOR ZSDT0226A_H-ZCRED. SELECTION-SCREEN END OF BLOCK BL20. SELECTION-SCREEN END OF SCREEN 200. SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF BLOCK BL30 WITH FRAME TITLE TEXT-T01. SELECT-OPTIONS:S_ZWERKS FOR ZWMT0008-ZWERKS MEMORY ID ZWE, S_MBLNR FOR MKPF-MBLNR, S_BUDAT FOR MKPF-BUDAT DEFAULT SY-DATUM, *BEGIN OF ZC 2014.1.2 S_LIFNR FOR MSEG-LIFNR,"供应商 S_ABTNR FOR T023-ABTNR,"品类 S_PRODH FOR T179T-PRODH."品牌 *END OF ZC 2013.1.2 PARAMETERS CB_PRT AS CHECKBOX. SELECTION-SCREEN END OF BLOCK BL30. SELECTION-SCREEN END OF SCREEN 300. * STANDARD SELECTION SCREEN SELECTION-SCREEN: BEGIN OF TABBED BLOCK MYTAB FOR 9 LINES, TAB (20) BUTTON1 USER-COMMAND PUSH1, TAB (20) BUTTON2 USER-COMMAND PUSH2 , TAB (20) BUTTON3 USER-COMMAND PUSH3 , END OF BLOCK MYTAB. INITIALIZATION. PERFORM INI_DEFAULT. * 工具栏添加下载模板按钮 PERFORM ADD_FUNCKEY. AT SELECTION-SCREEN OUTPUT. PERFORM SET_SCREEN."依据屏幕变化设置屏幕元素的相关属性 AT SELECTION-SCREEN. PERFORM CHECK_PAR." 检查输入的选择屏幕参数的有效性 AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE. PERFORM FRM_GET_FILEPATH CHANGING P_FILE. START-OF-SELECTION. PERFORM GET_DATA. "读取数据 END-OF-SELECTION. PERFORM SHOW_ALV. "ALV显示 *&---------------------------------------------------------------------* *& Form INI_DEFAULT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM INI_DEFAULT. BUTTON1 = TEXT-010. BUTTON2 = TEXT-020. BUTTON3 = TEXT-030. MYTAB-PROG = SY-REPID. IMPORT S_SCREEN TO S_SCREEN FROM MEMORY ID 'S_SCREEN' . IF S_SCREEN-PROG = MYTAB-PROG AND SY-BATCH <> 'X'. MOVE-CORRESPONDING S_SCREEN TO MYTAB. P_DYNNR = MYTAB-DYNNR. ELSE. MYTAB-DYNNR = 100. MYTAB-ACTIVETAB = 'PUSH1'. P_DYNNR = MYTAB-DYNNR. ENDIF. S_ZCRED-SIGN = 'I'. S_ZCRED-OPTION = 'BT'. S_ZCRED-LOW = SY-DATUM - 1. S_ZCRED-HIGH = SY-DATUM . APPEND S_ZCRED. ENDFORM. "INI_DEFAULT *&---------------------------------------------------------------------* *& Form SET_SCREEN *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM SET_SCREEN . IF P_DYNNR IS NOT INITIAL. CASE P_DYNNR. WHEN '100'. MYTAB-DYNNR = 100. MYTAB-ACTIVETAB = 'PUSH1'. WHEN '200'. MYTAB-DYNNR = 200. MYTAB-ACTIVETAB = 'PUSH2'. WHEN '300'. MYTAB-DYNNR = 300. MYTAB-ACTIVETAB = 'PUSH3'. ENDCASE. ENDIF. ENDFORM. " SET_SCREEN *&---------------------------------------------------------------------* *& Form CHECK_PAR *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM CHECK_PAR . * 下载数据导入模板 IF SSCRFIELDS-UCOMM = 'FC01'. PERFORM FRM_EXCEL_DOWN USING 'A'. SSCRFIELDS-UCOMM = ''. RETURN. ELSEIF SSCRFIELDS-UCOMM = 'FC02'. PERFORM FRM_EXCEL_DOWN USING 'B'. SSCRFIELDS-UCOMM = ''. RETURN. ENDIF. IF SY-UCOMM = 'ONLI' ."执行时 * IF P_CHK01 = 'X'. * IF P_ZGZRQ IS INITIAL * OR P_HKONT1 IS INITIAL * OR P_RSTGR IS INITIAL. * MESSAGE E105(ZDX_001). * * ENDIF. * ENDIF. ENDIF. CASE SY-DYNNR. WHEN 1000. CASE SY-UCOMM. WHEN 'PUSH1'. MYTAB-DYNNR = 100. MYTAB-ACTIVETAB = 'PUSH1'. WHEN 'PUSH2'. MYTAB-DYNNR = 200. MYTAB-ACTIVETAB = 'PUSH2'. WHEN 'PUSH3'. MYTAB-DYNNR = 300. MYTAB-ACTIVETAB = 'PUSH3'. ENDCASE. P_DYNNR = MYTAB-DYNNR. ENDCASE. ENDFORM. " CHECK_PAR *&---------------------------------------------------------------------* *& Form FRM_EXCEL_DOWN *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM FRM_EXCEL_DOWN USING P_TYPE. DATA: LV_OBJID TYPE W3OBJID, LS_RETURN TYPE BAPIRET2, L_FIELDNAME TYPE STRING. LV_OBJID = 'ZSDR0226'. CONCATENATE LV_OBJID P_TYPE INTO LV_OBJID. CLEAR LS_RETURN. L_FIELDNAME = '批发导入模板'. CONCATENATE L_FIELDNAME P_TYPE '.XLSX' INTO L_FIELDNAME. CALL FUNCTION 'ZFC_EXCEL_DOWNLOAD_FROM_SMW0' EXPORTING I_OBJID = LV_OBJID I_FIELDNAME = L_FIELDNAME IMPORTING E_RETURN = LS_RETURN. IF LS_RETURN-TYPE EQ 'E'. MESSAGE LS_RETURN-MESSAGE TYPE 'S' DISPLAY LIKE 'E'. * STOP. LEAVE LIST-PROCESSING. ENDIF. ENDFORM. " FRM_EXCEL_DOWN |
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 |
*&---------------------------------------------------------------------* *& 包括 ZSDR0226_CLS *&---------------------------------------------------------------------* CLASS LCL_EVENT_RECEIVER DEFINITION. PUBLIC SECTION. CLASS-METHODS: TOOLBAR FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID IMPORTING E_OBJECT E_INTERACTIVE, AFTER_USER_COMMAND FOR EVENT AFTER_USER_COMMAND OF CL_GUI_ALV_GRID IMPORTING E_UCOMM, HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN , HANDLE_DOUBLE_CLICK_P FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN. ENDCLASS. "LCL_EVENT_RECEIVER DEFINITION *&---------------------------------------------------------------------* * 类的实施 *&---------------------------------------------------------------------* CLASS LCL_EVENT_RECEIVER IMPLEMENTATION. METHOD TOOLBAR. PERFORM FRM_EVENT_TOOLBAR USING E_OBJECT E_INTERACTIVE. ENDMETHOD. "toolbar METHOD AFTER_USER_COMMAND. CASE E_UCOMM. WHEN '&ALL'. PERFORM SET_ALL_SELECTED USING 'X'. WHEN '&SAL'. PERFORM SET_ALL_SELECTED USING ' '. WHEN '&PRO1'. PERFORM PF_PRO1." WHEN '&PRO2'. PERFORM PF_PRO2." WHEN '&DELE'. PERFORM PF_PRO_DELE." ENDCASE. ENDMETHOD. "AFTER_USER_COMMAND METHOD HANDLE_DOUBLE_CLICK. PERFORM DILL_DOUBLE_CLICK USING E_ROW E_COLUMN. ENDMETHOD. "HANDLE_DOUBLE_CLICK METHOD HANDLE_DOUBLE_CLICK_P. PERFORM DILL_DOUBLE_CLICK_P USING E_ROW E_COLUMN. ENDMETHOD. "HANDLE_DOUBLE_CLICK ENDCLASS. "LCL_EVENT_RECEIVER IMPLEMENTATION |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
*&---------------------------------------------------------------------* *& 包括 ZSDR0226_DYN *&---------------------------------------------------------------------* MODULE USER_COMMAND_9001 INPUT. LEAVE TO SCREEN 0. ENDMODULE. " USER_EXIT INPUT *&---------------------------------------------------------------------* *& Module STATUS_9001 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE STATUS_9001 OUTPUT. DATA: LV_TITLE TYPE STRING. * lv_title = lines( gt_alv[] ). ** lv_title = '销售价格查询报表 条目数【' && lv_title && '】'. * CONCATENATE SY-TITLE ' 条目数【' lv_title '】' * INTO lv_title . LV_TITLE = SY-TITLE . SET PF-STATUS 'ZST'. SET TITLEBAR 'TITLE' WITH LV_TITLE. ENDMODULE. " STATUS_9001 OUTPUT |
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 |
*&---------------------------------------------------------------------* *& 包括 ZSDR0226_FRM *&---------------------------------------------------------------------* FORM SHOW_ALV . IF GT_ALV IS INITIAL. MESSAGE S100(ZSD) DISPLAY LIKE 'E' .. LEAVE LIST-PROCESSING. ENDIF. IF SY-BATCH = 'X' . PERFORM SET_ALL_SELECTED USING 'X'. PERFORM PF_PRO_DATA." RETURN. ENDIF. PERFORM CREATE_STRU. PERFORM DISPLAY_ALV. CALL SCREEN 9001. ENDFORM. "show_alv *&---------------------------------------------------------------------* *& Form CREATE_STRU *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* FORM CREATE_STRU . CLEAR: GT_STRUCTURE,GT_STRUCTURE[],GS_STRUCTURE. * BULID_FIELDLOG: * 'ZSEL' '选择' '' '' 'X' '' '' '' 'X', * 'STATU' '状态' 'ICON' 'NAME' '' '' '' '' 'X', * 'MESSAGE' '消息' '' '' '' '' '' '' 'X', *--------------------------------------------------------------------* *抬头表 PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZSEL' '选择' '' '' 'X' '' '' '' 'X' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'STATU' '状态' 'ICON' 'NAME' '' '' '' '' 'X' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZEBELN' '批发业务单号' '' '' '' '' '' '' 'X' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZBTYPE' '类型' 'ZSDT0226A_H' 'ZBTYPE' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'MESSAGE' '消息' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZSTATUS' '完成状态' 'ZSDT0226A_H' 'ZSTATUS' '' '' '' '' '' CHANGING GT_STRUCTURE1. READ TABLE GT_ALV INTO GS_ALV WITH KEY ZBTYPE = 'A'. IF SY-SUBRC = 0. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'LIFNR' '供应商' 'ZSDT0226A_H' 'LIFNR' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZWLGS' '物流公司' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZDQFB' '分部' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'KUNNR' '客户编码' 'ZSDT0226A_H' 'KUNNR' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZCONNO' '合同编号' 'ZSDT0226A_H' 'ZCONNO' '' '' '' '' '' CHANGING GT_STRUCTURE1. ENDIF. READ TABLE GT_ALV INTO GS_ALV WITH KEY ZBTYPE = 'B'. IF SY-SUBRC = 0. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZBUKRS01' '公司主体1' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZBUKRS02' '公司主体2' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZBUKRS03' '公司主体3' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZBUKRS04' '公司主体4' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZBUKRS05' '公司主体5' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZBUKRS06' '公司主体6' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZBUKRS07' '公司主体7' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZBUKRS08' '公司主体8' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZBUKRS09' '公司主体9' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZBUKRS10' '公司主体10' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. ENDIF. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'TAX_RATE' '税率(%)' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZCREN' '导入人' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZCRED' '导入日期' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE1. *--------------------------------------------------------------------* *明细表 PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZEBELN' '批发业务单号' '' '' '' '' '' '' 'X' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZEBELP' '行项目' '' '' '' '' '' '' 'X' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'MATNR' '商品编码' 'ZSDT0226_I' 'MATNR' '' '' '' '' '' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'MAKTX' '商品描述' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'MENGE' '数量' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZNETWR01' '单价1' 'ZSDT0226_I' 'ZNETWR1' '' '' 'X' '' '' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZNETWR02' '单价2' 'ZSDT0226_I' 'ZNETWR2' '' '' 'X' '' '' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZNETWR03' '单价3' 'ZSDT0226_I' 'ZNETWR3' '' '' 'X' '' '' CHANGING GT_STRUCTURE2. READ TABLE GT_ALV INTO GS_ALV WITH KEY ZBTYPE = 'B'. IF SY-SUBRC = 0. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZNETWR04' '单价4' 'ZSDT0226_I' 'ZNETWR1' '' '' 'X' '' '' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZNETWR05' '单价5' 'ZSDT0226_I' 'ZNETWR2' '' '' 'X' '' '' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZNETWR06' '单价6' 'ZSDT0226_I' 'ZNETWR3' '' '' 'X' '' '' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZNETWR07' '单价7' 'ZSDT0226_I' 'ZNETWR3' '' '' 'X' '' '' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZNETWR08' '单价8' 'ZSDT0226_I' 'ZNETWR3' '' '' 'X' '' '' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZNETWR09' '单价9' 'ZSDT0226_I' 'ZNETWR3' '' '' 'X' '' '' CHANGING GT_STRUCTURE2. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZNETWR10' '单价10' 'ZSDT0226_I' 'ZNETWR3' '' '' 'X' '' '' CHANGING GT_STRUCTURE2. ENDIF. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'CHARG' '批次' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE2. *--------------------------------------------------------------------* *日志表。 PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'STATU' '状态' 'ICON' 'NAME' '' '' '' '' 'X' CHANGING GT_STRUCTURE3. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZEBELN' '批发业务单号' '' '' '' '' '' '' 'X' CHANGING GT_STRUCTURE3. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZEBELP' '步骤' '' '' '' '' '' '' 'X' CHANGING GT_STRUCTURE3. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'MESSAGE' '消息文本' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE3. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZFROM' '从' 'ZSDT0226A_H' 'LIFNR' '' '' '' '' '' CHANGING GT_STRUCTURE3. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZTO' '到' 'ZSDT0226A_H' 'LIFNR' '' '' '' '' '' CHANGING GT_STRUCTURE3. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZPO_SO' '类型' '' '' '' '' '' '' '' CHANGING GT_STRUCTURE3. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'EBELN' '订单号' 'ZSDT0226_LOG' 'EBELN' '' '' '' '' '' CHANGING GT_STRUCTURE3. PERFORM FRM_CHANGE_L_FIELDCATALOG_LINE USING 'ZSTAT01' '收发' 'ZSDT0226_LOG' 'ZSTAT01' '' '' '' '' '' CHANGING GT_STRUCTURE3. *PERFORM INITIALIZE_FIELDCAT_HIRE USING 'ZSDT0242_DS' * CHANGING GT_STRUCTURE2. *--------------------------------------------------------------------* ****设置行格式 CLEAR WA_LAYOUT. WA_LAYOUT-CWIDTH_OPT = 'X'. WA_LAYOUT-NO_MERGING = 'X'. WA_LAYOUT-STYLEFNAME = 'CELLSTYLES'. WA_LAYOUT-ZEBRA = 'X'. WA_LAYOUT-SEL_MODE = 'A'. * wa_layout-box_fname = 'SEL'. CLEAR S_DISVARIANT. S_DISVARIANT-REPORT = SY-REPID. S_DISVARIANT-USERNAME = SY-UNAME. * s_disvariant-log_group = 'LG'. ENDFORM. "create_stru *&---------------------------------------------------------------------* *& Form DISPLAY_ALV *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* FORM DISPLAY_ALV . DATA: LT_TOOLS TYPE TABLE OF SY-UCOMM. "用于排除按钮 DATA: L_FIELDCATALOG_ITAB1 TYPE LVC_T_FCAT, L_FIELDCATALOG_ITAB2 TYPE LVC_T_FCAT, L_FIELDCATALOG_ITAB3 TYPE LVC_T_FCAT, L_FIELDCATALOG_LINE TYPE LVC_S_FCAT, L_DISVARIANT TYPE DISVARIANT, L_LAYOUT TYPE LVC_S_LAYO, L_STYL_LINE TYPE LVC_S_STYL, L_STYL_ITAB TYPE LVC_T_STYL, L_FUNCTION_ITAB TYPE UI_FUNCTIONS, L_INDEX TYPE I. IF G_CONTAINER1 IS INITIAL. CREATE OBJECT G_CONTAINER1 EXPORTING CONTAINER_NAME = 'CONTAINER1'. CREATE OBJECT G_GRID1 EXPORTING I_PARENT = G_CONTAINER1. CREATE OBJECT G_CONTAINER2 EXPORTING CONTAINER_NAME = 'CONTAINER2'. CREATE OBJECT G_GRID2 EXPORTING I_PARENT = G_CONTAINER2. CREATE OBJECT G_CONTAINER3 EXPORTING CONTAINER_NAME = 'CONTAINER3'. CREATE OBJECT G_GRID3 EXPORTING I_PARENT = G_CONTAINER3. * SET HANDLER LCL_EVENT_RECEIVER=>TOOLBAR FOR G_GRID1. SET HANDLER LCL_EVENT_RECEIVER=>AFTER_USER_COMMAND FOR G_GRID1. SET HANDLER LCL_EVENT_RECEIVER=>HANDLE_DOUBLE_CLICK FOR G_GRID1. ** * SET HANDLER LCL_EVENT_RECEIVER=>TOOLBAR FOR G_GRID2. * SET HANDLER LCL_EVENT_RECEIVER=>AFTER_USER_COMMAND FOR G_GRID2. * SET HANDLER LCL_EVENT_RECEIVER=>HANDLE_DOUBLE_CLICK FOR G_GRID2. * * SET HANDLER LCL_EVENT_RECEIVER=>TOOLBAR FOR G_GRID3. * SET HANDLER LCL_EVENT_RECEIVER=>AFTER_USER_COMMAND FOR G_GRID3. SET HANDLER LCL_EVENT_RECEIVER=>HANDLE_DOUBLE_CLICK_P FOR G_GRID3. CALL METHOD G_GRID1->REGISTER_EDIT_EVENT EXPORTING I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED. CALL METHOD G_GRID2->REGISTER_EDIT_EVENT EXPORTING I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED. CALL METHOD G_GRID3->REGISTER_EDIT_EVENT EXPORTING I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED. CLEAR LT_TOOLS[]. APPEND '&LOCAL&DELETE_ROW' TO LT_TOOLS. APPEND '&LOCAL©_ROW' TO LT_TOOLS. APPEND '&LOCAL©' TO LT_TOOLS. APPEND '&LOCAL&APPEND' TO LT_TOOLS. APPEND '&LOCAL&INSERT_ROW' TO LT_TOOLS. APPEND '&LOCAL&CUT' TO LT_TOOLS. APPEND '&LOCAL&PASTE_NEW_ROW' TO LT_TOOLS. APPEND '&LOCAL&PASTE' TO LT_TOOLS. APPEND '&LOCAL&UNDO' TO LT_TOOLS. APPEND '&PRINT' TO LT_TOOLS. APPEND '&GRAPH ' TO LT_TOOLS. APPEND '&INFO' TO LT_TOOLS. CALL METHOD G_GRID1->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING IS_LAYOUT = WA_LAYOUT I_SAVE = 'A' IS_VARIANT = S_DISVARIANT IT_TOOLBAR_EXCLUDING = LT_TOOLS CHANGING IT_FIELDCATALOG = GT_STRUCTURE1 IT_OUTTAB = GT_ALV[]. CALL METHOD G_GRID2->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING IS_LAYOUT = WA_LAYOUT I_SAVE = 'A' IS_VARIANT = S_DISVARIANT IT_TOOLBAR_EXCLUDING = LT_TOOLS CHANGING IT_FIELDCATALOG = GT_STRUCTURE2 IT_FILTER = GT_FILTER2 IT_OUTTAB = GT_ALV_I[]. CALL METHOD G_GRID3->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING IS_LAYOUT = WA_LAYOUT I_SAVE = 'A' IS_VARIANT = S_DISVARIANT IT_TOOLBAR_EXCLUDING = LT_TOOLS CHANGING IT_FIELDCATALOG = GT_STRUCTURE3 IT_FILTER = GT_FILTER3 IT_OUTTAB = GT_ALV_P[]. ENDIF. *显示第一行内容。 READ TABLE GT_ALV INTO GS_ALV INDEX 1. PERFORM PFM_SHOW_ITEM. ENDFORM. "display_alv *&---------------------------------------------------------------------* *& Form FRM_EVENT_TOOLBAR *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* FORM FRM_EVENT_TOOLBAR USING E_OBJECT TYPE REF TO CL_ALV_EVENT_TOOLBAR_SET E_INTERACTIVE TYPE C. PERFORM SET_TOOLBAR USING '&ALL' ICON_SELECT_ALL ' ' '全选' '' '' 6 E_OBJECT. PERFORM SET_TOOLBAR USING '&SAL' ICON_DESELECT_ALL ' ' '取消全选' '' '' 7 E_OBJECT. PERFORM SET_TOOLBAR USING '' '' ' ' '' '' 3 22 E_OBJECT. PERFORM SET_TOOLBAR USING '&DELE' ICON_DELETE ' ' '删除' '删除' '' 23 E_OBJECT. PERFORM SET_TOOLBAR USING '' '' ' ' '' '' 3 24 E_OBJECT. PERFORM SET_TOOLBAR USING '&PRO1' ICON_EXECUTE_OBJECT ' ' '创建订单' '创建订单' '' 25 E_OBJECT. PERFORM SET_TOOLBAR USING '&PRO2' ICON_EXECUTE_OBJECT ' ' '收货' '收货' '' 26 E_OBJECT. ENDFORM. "frm_event_toolbar *&---------------------------------------------------------------------* *& Form SET_TOOLBAR *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* FORM SET_TOOLBAR USING P_FUNCTION P_ICON P_DISABLED P_QUICKINFO P_TEXT P_TYPE P_POS E_OBJECT TYPE REF TO CL_ALV_EVENT_TOOLBAR_SET. DATA: LS_TOOLBAR TYPE STB_BUTTON. CLEAR LS_TOOLBAR. MOVE P_FUNCTION TO LS_TOOLBAR-FUNCTION. MOVE P_ICON TO LS_TOOLBAR-ICON. * move '更改'(111) to ls_toolbar-quickinfo. * move '更改' to ls_toolbar-text. MOVE P_DISABLED TO LS_TOOLBAR-DISABLED. MOVE P_QUICKINFO TO LS_TOOLBAR-QUICKINFO. MOVE P_TYPE TO LS_TOOLBAR-BUTN_TYPE. MOVE P_TEXT TO LS_TOOLBAR-TEXT. INSERT LS_TOOLBAR INTO E_OBJECT->MT_TOOLBAR INDEX P_POS. FREE: LS_TOOLBAR. ENDFORM. "set_toolbar *&---------------------------------------------------------------------* *& Form SET_ALL_SELECTED *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* FORM SET_ALL_SELECTED USING P_VALUE. DATA: L_STATU TYPE FLAG. FIELD-SYMBOLS: <F_ALV> TYPE TY_ALV. LOOP AT GT_ALV ASSIGNING <F_ALV>. PERFORM GET_ZSEL_STATU USING <F_ALV> CHANGING L_STATU. IF L_STATU EQ ''. CONTINUE. ENDIF. IF <F_ALV>-ZSEL EQ P_VALUE. CONTINUE. ENDIF. <F_ALV>-ZSEL = P_VALUE. ENDLOOP. UNASSIGN: <F_ALV>. PERFORM REFRESH_ALV. FREE: L_STATU. ENDFORM. "set_all_selected *&---------------------------------------------------------------------* *& Form GET_MARK_STATU *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* FORM GET_ZSEL_STATU USING P_ALV TYPE TY_ALV CHANGING E_STATU TYPE FLAG. DATA: LS_CELL TYPE LVC_S_STYL, IT_CELLSTYLES TYPE LVC_T_STYL. IT_CELLSTYLES = P_ALV-CELLSTYLES. E_STATU = 'X'. CLEAR LS_CELL. READ TABLE IT_CELLSTYLES INTO LS_CELL WITH KEY FIELDNAME = 'ZSEL'. CHECK SY-SUBRC EQ 0. IF LS_CELL-STYLE EQ '00100000'. E_STATU = ''. ENDIF. ENDFORM. "get_mark_statu *&---------------------------------------------------------------------* *& Form REFRESH_ALV *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* FORM REFRESH_ALV . DATA: STBL TYPE LVC_S_STBL. CHECK SY-BATCH <> 'X'. CHECK G_GRID1 IS NOT INITIAL. STBL-ROW = 'X'." 基于行的稳定刷新 STBL-COL = 'X'." 基于列的稳定刷新 CALL METHOD G_GRID1->SET_FRONTEND_LAYOUT EXPORTING IS_LAYOUT = WA_LAYOUT. CALL METHOD G_GRID1->REFRESH_TABLE_DISPLAY EXPORTING IS_STABLE = STBL. FREE: STBL. ENDFORM. " REFRESH_ALV *&---------------------------------------------------------------------* *& Form CONFIRM_DATA *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* FORM CONFIRM_DATA . PERFORM REFRESH_ALV. ENDFORM. "confirm_data *&---------------------------------------------------------------------* *& Form SET_STYLE *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* FORM SET_STYLE USING FIELDNAME STYLE TYPE STRING CHANGING IT_STYLES TYPE LVC_T_STYL. DATA: LS_STYLE TYPE LVC_S_STYL. CLEAR LS_STYLE. LS_STYLE-FIELDNAME = FIELDNAME. IF STYLE EQ 'ENABLE'. LS_STYLE-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED. ELSE. LS_STYLE-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED. ENDIF. READ TABLE IT_STYLES TRANSPORTING NO FIELDS WITH KEY FIELDNAME = FIELDNAME. IF SY-SUBRC EQ 0. MODIFY IT_STYLES FROM LS_STYLE INDEX SY-TABIX. ELSE. INSERT LS_STYLE INTO TABLE IT_STYLES. ENDIF. FREE: LS_STYLE. ENDFORM. "set_style *&---------------------------------------------------------------------* *& Form SET_ERROR_MESSAGE *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* FORM PF_SET_ERROR_MESSAGE USING P_MESSAGE P_CHANGE_ENA" '',DIS,EN CHANGING WA_ALV TYPE TY_ALV. WA_ALV-STATU = ICON_RED_LIGHT. WA_ALV-MESSAGE = P_MESSAGE. * PERFORM PF_CREATE_LOG_1 USING WA_ALV-OBJKEY WA_ALV-MESSAGE 'E'. IF P_CHANGE_ENA = 'DIS'. PERFORM SET_STYLE USING 'ZSEL' 'DISABLE' CHANGING WA_ALV-CELLSTYLES. ENDIF. ENDFORM. "set_error_message *&---------------------------------------------------------------------* *& Form CALL_BDC *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form DILL_DOUBLE_CLICK *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* FORM DILL_DOUBLE_CLICK USING P_ROW TYPE LVC_S_ROW P_COLUMN TYPE LVC_S_COL. DATA: LT_LOG TYPE TABLE OF MASSMSG , LS_LOG TYPE MASSMSG. DATA: LS_ALV TYPE TY_ALV. FIELD-SYMBOLS: <FS> TYPE ANY, <ERRID> TYPE ANY. DATA: L_OBJKEY TYPE TY_ALV-OBJKEY. CLEAR LS_ALV. READ TABLE GT_ALV INTO LS_ALV INDEX P_ROW-INDEX. CHECK SY-SUBRC EQ 0. ASSIGN COMPONENT P_COLUMN-FIELDNAME OF STRUCTURE LS_ALV TO <FS>. * IF <FS> IS INITIAL. * RETURN. * ENDIF. CASE P_COLUMN-FIELDNAME. WHEN 'EBELN'. * WHEN 'STATU' OR 'MESSAGE'. * ASSIGN COMPONENT 'OBJKEY' OF STRUCTURE LS_ALV TO <ERRID>. * CHECK SY-SUBRC = 0. * CHECK <ERRID> IS NOT INITIAL. * LT_LOG[] = GT_LOG[]. * DELETE LT_LOG WHERE OBJKEY <> <ERRID>. * CHECK LT_LOG IS NOT INITIAL. * CALL FUNCTION 'ZWINDOW_OF_LOG' * TABLES * IT_LOG = LT_LOG. * * WHEN OTHERS. * "显示明细 * PERFORM PF_SHOW_ITEM USING LS_ALV. ENDCASE. "显示明细 GS_ALV = LS_ALV. PERFORM PFM_SHOW_ITEM. ENDFORM. "dill_double_click *&---------------------------------------------------------------------* *& Form DILL_DOUBLE_CLICK_P *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_ROW text * -->P_COLUMN text *----------------------------------------------------------------------* FORM DILL_DOUBLE_CLICK_P USING P_ROW TYPE LVC_S_ROW P_COLUMN TYPE LVC_S_COL. DATA: LT_LOG TYPE TABLE OF MASSMSG , LS_LOG TYPE MASSMSG. DATA: LS_ALV_P TYPE TY_ALV_P. FIELD-SYMBOLS: <FS> TYPE ANY, <ERRID> TYPE ANY. DATA: L_OBJKEY TYPE TY_ALV-OBJKEY. CLEAR LS_ALV_P. READ TABLE GT_ALV_P INTO LS_ALV_P INDEX P_ROW-INDEX. CHECK SY-SUBRC EQ 0. ASSIGN COMPONENT P_COLUMN-FIELDNAME OF STRUCTURE LS_ALV_P TO <FS>. IF <FS> IS INITIAL. RETURN. ENDIF. CASE P_COLUMN-FIELDNAME. WHEN 'EBELN'. IF LS_ALV_P-ZPO_SO = 'PO'. CALL FUNCTION 'ME_DISPLAY_PURCHASE_DOCUMENT' EXPORTING I_EBELN = <FS> EXCEPTIONS NOT_FOUND = 1 NO_AUTHORITY = 2 INVALID_CALL = 3 PREVIEW_NOT_POSSIBLE = 4 OTHERS = 5. ELSE. SET PARAMETER ID 'AUN' FIELD <FS> . CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN . ENDIF. * WHEN 'STATU' OR 'MESSAGE'. * ASSIGN COMPONENT 'OBJKEY' OF STRUCTURE LS_ALV TO <ERRID>. * CHECK SY-SUBRC = 0. * CHECK <ERRID> IS NOT INITIAL. * LT_LOG[] = GT_LOG[]. * DELETE LT_LOG WHERE OBJKEY <> <ERRID>. * CHECK LT_LOG IS NOT INITIAL. * CALL FUNCTION 'ZWINDOW_OF_LOG' * TABLES * IT_LOG = LT_LOG. * * WHEN OTHERS. * "显示明细 * PERFORM PF_SHOW_ITEM USING LS_ALV. ENDCASE. ENDFORM. "dill_double_click *&---------------------------------------------------------------------* *& Form PF_SHOW_ITEM *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_LS_ALV text *----------------------------------------------------------------------* FORM PF_SHOW_ITEM USING P_ALV TYPE TY_ALV. DATA: LT_ALV_I TYPE TABLE OF TY_ALV_I, LS_ALV_I TYPE TY_ALV_I. DATA: ALV TYPE REF TO CL_SALV_TABLE, ALV_EXC TYPE REF TO CX_SALV_MSG. LT_ALV_I = GT_ALV_I. DELETE LT_ALV_I WHERE IDKEY = P_ALV-IDKEY. CHECK LT_ALV_I IS NOT INITIAL. TRY. CL_SALV_TABLE=>FACTORY( IMPORTING R_SALV_TABLE = ALV CHANGING T_TABLE = LT_ALV_I ). ALV->DISPLAY( ). CATCH CX_SALV_MSG INTO ALV_EXC. MESSAGE ALV_EXC TYPE 'I' DISPLAY LIKE 'E'. ENDTRY. ENDFORM. " PF_SHOW_ITEM *&---------------------------------------------------------------------* *& Form PF_SHOW_ZHTBH *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_ALV text *----------------------------------------------------------------------* * -->P_MSGV4 text *----------------------------------------------------------------------* FORM PF_CREATE_LOG TABLES PT_RETURN1 STRUCTURE BAPIRET2 PT_RETURN2 STRUCTURE BAPIRETURN1 USING P_OBJKEY TYPE CHAR79 P_MSGTY TYPE MSGTY P_MSGID TYPE ARBGB P_MSGNO TYPE SYMSGNO P_MSGV1 TYPE SYMSGV P_MSGV2 TYPE SYMSGV P_MSGV3 TYPE SYMSGV P_MSGV4 TYPE SYMSGV. IF P_MSGID IS INITIAL. P_MSGID = 'ZDX_001'. ENDIF. IF P_MSGNO IS INITIAL. P_MSGNO = '100'. ENDIF. CALL FUNCTION 'ZFM_CREATE_LOG' EXPORTING I_OBJKEY = P_OBJKEY I_MSGTY = P_MSGTY I_MSGID = P_MSGID I_MSGNO = P_MSGNO I_MSGV1 = P_MSGV1 I_MSGV2 = P_MSGV2 I_MSGV3 = P_MSGV3 I_MSGV4 = P_MSGV4 TABLES LT_LOG = GT_LOG LT_RETURN1 = PT_RETURN1 LT_RETURN2 = PT_RETURN2. ENDFORM. "PF_CREATE_LOG *&---------------------------------------------------------------------* *& Form PF_CREATE_LOG_1 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_OBJKEY text * -->P_MSGTX text * -->P_MSGTY text *----------------------------------------------------------------------* FORM PF_CREATE_LOG_1 USING P_OBJKEY TYPE CHAR79 P_MSGTX TYPE MSGTX P_MSGTY TYPE MSGTY . DATA: L_MSGTX TYPE SYMSGV. L_MSGTX = P_MSGTX. CALL FUNCTION 'ZFM_CREATE_LOG' EXPORTING I_OBJKEY = P_OBJKEY I_MSGTY = P_MSGTY I_MSGV1 = L_MSGTX TABLES LT_LOG = GT_LOG. ENDFORM. "PF_CREATE_LOG_1 *&---------------------------------------------------------------------* *& Form ADD_FUNCKEY *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM ADD_FUNCKEY . DATA: LV_FUNCTION_KEY TYPE SMP_DYNTXT. "功能按钮 CLEAR LV_FUNCTION_KEY. LV_FUNCTION_KEY-ICON_ID = ICON_READ_FILE. LV_FUNCTION_KEY-ICON_TEXT = '下载A类型模板'. LV_FUNCTION_KEY-QUICKINFO = '批发导入A类型模板下载'. SSCRFIELDS-FUNCTXT_01 = LV_FUNCTION_KEY. CLEAR LV_FUNCTION_KEY. LV_FUNCTION_KEY-ICON_ID = ICON_READ_FILE. LV_FUNCTION_KEY-ICON_TEXT = '下载B类型模板'. LV_FUNCTION_KEY-QUICKINFO = '批发导入B类型模板下载'. SSCRFIELDS-FUNCTXT_02 = LV_FUNCTION_KEY. ENDFORM. "ADD_FUNCKEY *&---------------------------------------------------------------------* *& Form FRM_GET_FILEPATH *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->L_FILE text *----------------------------------------------------------------------* FORM FRM_GET_FILEPATH CHANGING L_FILE. DATA: L_RC TYPE I. DATA: LT_FILETAB TYPE FILETABLE. CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' EXPORTING PERCENTAGE = 0 TEXT = '选择上传文件路径......'. CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG EXPORTING WINDOW_TITLE = '请选择本地文件' MULTISELECTION = SPACE CHANGING FILE_TABLE = LT_FILETAB RC = L_RC EXCEPTIONS FILE_OPEN_DIALOG_FAILED = 1 CNTL_ERROR = 2 ERROR_NO_GUI = 3 NOT_SUPPORTED_BY_GUI = 4 OTHERS = 5. IF SY-SUBRC EQ 0 AND L_RC EQ 1. READ TABLE LT_FILETAB INTO L_FILE INDEX 1. ENDIF. ENDFORM. " FRM_GET_FILEPATH *&---------------------------------------------------------------------* *& Form FRM_CHANGE_L_FIELDCATALOG_LINE *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->VALUE(P_1) text * -->VALUE(P_2) text * -->VALUE(P_3) text * -->VALUE(P_4) text * -->VALUE(P_5) text * -->P_NO_ZERO text * -->P_L_FIELDCATALOG_LINE text * -->P_L_FIELDCATALOG_ITAB1 text *----------------------------------------------------------------------* FORM FRM_CHANGE_L_FIELDCATALOG_LINE USING P_1 P_2 P_3 P_4 P_5 P_6 P_7 P_8 P_9 CHANGING P_L_FIELDCATALOG_ITAB1 TYPE LVC_T_FCAT. GS_STRUCTURE-FIELDNAME = P_1. GS_STRUCTURE-COLTEXT = P_2. GS_STRUCTURE-REF_TABLE = P_3. GS_STRUCTURE-REF_FIELD = P_4. GS_STRUCTURE-EDIT = P_5. GS_STRUCTURE-LZERO = P_6. GS_STRUCTURE-NO_ZERO = P_7. GS_STRUCTURE-JUST = P_8. GS_STRUCTURE-KEY = P_9. GS_STRUCTURE-COL_OPT = 'X'. IF P_1 EQ 'ZSEL'. GS_STRUCTURE-CHECKBOX = 'X'. ENDIF. APPEND GS_STRUCTURE TO P_L_FIELDCATALOG_ITAB1. CLEAR: GS_STRUCTURE. ENDFORM. "frm_change_l_fieldcatalog_line FORM INITIALIZE_FIELDCAT_HIRE USING P_TABNAME TYPE SLIS_TABNAME CHANGING P_STRUCTURE TYPE LVC_T_FCAT. DATA: LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, LS_FIELDCAT TYPE LINE OF SLIS_T_FIELDCAT_ALV. DATA: LS_STRUCTURE TYPE LVC_S_FCAT. CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING I_PROGRAM_NAME = SY-REPID * I_INTERNAL_TABNAME = P_TABNAME "LIKE 内表名 I_STRUCTURE_NAME = P_TABNAME"SE11定义好的结构,内表名 I_INCLNAME = SY-REPID CHANGING CT_FIELDCAT = LT_FIELDCAT EXCEPTIONS INCONSISTENT_INTERFACE = 1 PROGRAM_ERROR = 2 OTHERS = 3. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. LOOP AT LT_FIELDCAT INTO LS_FIELDCAT. MOVE-CORRESPONDING LS_FIELDCAT TO LS_STRUCTURE. LS_STRUCTURE-COLTEXT = LS_FIELDCAT-SELTEXT_L. CASE LS_FIELDCAT-fieldname. WHEN 'SRTFD'. LS_STRUCTURE-COLTEXT = 'MESSAGE ID'. ENDCASE. APPEND LS_STRUCTURE TO P_STRUCTURE. ENDLOOP. ENDFORM. " INITIALIZE_FIELDCAT |
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 |
*&---------------------------------------------------------------------* *& 包括 ZSDR0226_F01 *&---------------------------------------------------------------------* FORM GET_DATA . IF SY-BATCH <> 'X'."不是后台执行,保存选项 MOVE-CORRESPONDING MYTAB TO S_SCREEN. EXPORT S_SCREEN FROM S_SCREEN TO MEMORY ID 'S_SCREEN' . ENDIF. IF MYTAB-ACTIVETAB = 'PUSH1'. PERFORM PFM_GET_DATA_INPUT."导入 ELSEIF MYTAB-ACTIVETAB = 'PUSH2'. PERFORM PFM_GET_DATA_2. ELSEIF MYTAB-ACTIVETAB = 'PUSH3'. PERFORM PFM_GET_DATA_3. ENDIF. LOOP AT GT_ALV ASSIGNING <ALV>. <ALV>-OBJKEY = <ALV>-ZEBELN. CONDENSE <ALV>-OBJKEY NO-GAPS. <ALV>-IDKEY = <ALV>-OBJKEY. ENDLOOP. *--------------------------------------------------------------------* SORT GT_ALV BY OBJKEY DESCENDING. PERFORM SET_ALL_SELECTED USING 'X'. ENDFORM. "get_data *&---------------------------------------------------------------------* *& Form PFM_GET_DATA_1 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PFM_GET_DATA_INPUT . DATA: C_BEGIN_ROW TYPE I VALUE 6, "Beginning row of excel file C_BEGIN_COL TYPE I VALUE 1, "Beginning column of excel file C_END_ROW TYPE I VALUE 10000, "Ending row of excel file C_END_COL TYPE I VALUE 10. "Ending column of excel file DATA:L_COL TYPE I. DATA: ITAB LIKE ZALSMEX_TABLINE OCCURS 0 WITH HEADER LINE. DATA L_INDEX TYPE I. CALL FUNCTION 'ZALSM_EXCEL_TO_INTERNAL_TABLE' * 001 end EXPORTING FILENAME = P_FILE I_BEGIN_COL = C_BEGIN_COL I_BEGIN_ROW = C_BEGIN_ROW I_END_COL = C_END_COL I_END_ROW = C_END_ROW TABLES INTERN = ITAB EXCEPTIONS INCONSISTENT_PARAMETERS = 1 UPLOAD_OLE = 2 OTHERS = 3. IF SY-SUBRC <> 0 . MESSAGE '导入文件失败。' TYPE 'E'. ENDIF. IF P_CHK11 = 'X'."A模式 PERFORM PFM_GET_DATA_INPUT_A TABLES ITAB. PERFORM PFM_GET_DATA_INPUT_A_CHECK . PERFORM PFM_INPUT_SAVE_A. ELSEIF P_CHK12 = 'X'." B 模式 PERFORM PFM_GET_DATA_INPUT_B TABLES ITAB. PERFORM PFM_GET_DATA_INPUT_B_CHECK . PERFORM PFM_INPUT_SAVE_B. ENDIF. ENDFORM. " PFM_GET_DATA_1 *&---------------------------------------------------------------------* *& Form PFM_GET_DATA_INPUT_A *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->ITAB text *----------------------------------------------------------------------* FORM PFM_GET_DATA_INPUT_A TABLES ITAB STRUCTURE ZALSMEX_TABLINE. DATA: L_INDEX TYPE I , L_ZNETWR TYPE P DECIMALS 2. LOOP AT ITAB. "将EXCEL内表数据存入内表it_upload中 MOVE ITAB-COL TO L_INDEX. CONDENSE ITAB-VALUE NO-GAPS. *--------------------------------------------------------------------* IF ITAB-ROW = 1."表头行 GS_ALV-ZBTYPE = 'A'. CASE L_INDEX. WHEN 1. GS_ALV-LIFNR = ITAB-VALUE. WHEN 2. GS_ALV-ZWLGS = ITAB-VALUE. WHEN 3. GS_ALV-ZDQFB = ITAB-VALUE. WHEN 4. GS_ALV-KUNNR = ITAB-VALUE. WHEN 5."合同 GS_ALV-ZCONNO = ITAB-VALUE. WHEN 6."税率 CALL FUNCTION 'UNITS_STRING_CONVERT' EXPORTING UNITS_STRING = ITAB-VALUE DCPFM = 'X' IMPORTING UNITS = L_ZNETWR. IF L_ZNETWR = 0 . L_ZNETWR = '13'. ENDIF. IF L_ZNETWR > 100 OR L_ZNETWR < 1. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '税率只能是1~100之间的数值'. LEAVE LIST-PROCESSING. ENDIF. GS_ALV-TAX_RATE = L_ZNETWR. ENDCASE. ENDIF. *--------------------------------------------------------------------* * 明细,有效数据 从 第4行开始 IF ITAB-ROW < 4. CONTINUE. ENDIF. CASE L_INDEX. WHEN 1. GS_ALV_I-MATNR = ITAB-VALUE. IF GS_ALV_I-MATNR = '' OR GS_ALV_I-MATNR(2) = '合计'. EXIT. ENDIF. CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT' EXPORTING INPUT = GS_ALV_I-MATNR IMPORTING OUTPUT = GS_ALV_I-MATNR. WHEN 2. GS_ALV_I-MAKTX = ITAB-VALUE. WHEN 3. CALL FUNCTION 'UNITS_STRING_CONVERT' EXPORTING UNITS_STRING = ITAB-VALUE DCPFM = 'X' IMPORTING UNITS = GS_ALV_I-ZNETWR01. WHEN 4. CALL FUNCTION 'UNITS_STRING_CONVERT' EXPORTING UNITS_STRING = ITAB-VALUE DCPFM = 'X' IMPORTING UNITS = GS_ALV_I-MENGE. WHEN 6. CALL FUNCTION 'UNITS_STRING_CONVERT' EXPORTING UNITS_STRING = ITAB-VALUE DCPFM = 'X' IMPORTING UNITS = GS_ALV_I-ZNETWR02. WHEN 9. CALL FUNCTION 'UNITS_STRING_CONVERT' EXPORTING UNITS_STRING = ITAB-VALUE DCPFM = 'X' IMPORTING UNITS = GS_ALV_I-ZNETWR03. IF GS_ALV_I-MATNR = ''. EXIT. ENDIF. APPEND GS_ALV_I TO GT_ALV_I. CLEAR: GS_ALV_I. ENDCASE. ENDLOOP. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING INPUT = GS_ALV-LIFNR IMPORTING OUTPUT = GS_ALV-LIFNR. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING INPUT = GS_ALV-KUNNR IMPORTING OUTPUT = GS_ALV-KUNNR. GS_ALV-ZCREN = SY-UNAME. GS_ALV-ZCRED = SY-DATUM. APPEND GS_ALV TO GT_ALV. ENDFORM. "PFM_GET_DATA_INPUT_A *&---------------------------------------------------------------------* *& Form PFM_GET_DATA_INPUT_A_CHECK *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM PFM_GET_DATA_INPUT_A_CHECK. DATA: LT_MARA TYPE TABLE OF MATNR WITH HEADER LINE. DATA: LS_ZSDT0226A_H LIKE ZSDT0226A_H, LS_ZSDT0226B_H LIKE ZSDT0226B_H. DATA: LS_ZSDT0226_CONF LIKE ZSDT0226_CONF. DATA: L_MSGTX TYPE MSGTX, L_INDEX TYPE INT1. DATA: L_WERKS TYPE WERKS_D, L_LGORT TYPE LGORT_D. DATA: LT_ZSDT0226_I LIKE TABLE OF ZSDT0226_I, LS_ZSDT0226_I LIKE ZSDT0226_I. READ TABLE GT_ALV INTO GS_ALV INDEX 1. MOVE-CORRESPONDING GS_ALV TO LS_ZSDT0226A_H. LOOP AT GT_ALV_I INTO GS_ALV_I. MOVE-CORRESPONDING GS_ALV_I TO LS_ZSDT0226_I. APPEND LS_ZSDT0226_I TO LT_ZSDT0226_I. ENDLOOP. DO 2 TIMES. L_INDEX = L_INDEX + 1. CALL FUNCTION 'ZFM_0226_CHECK_ZMDT0107' EXPORTING IS_ZSDT0226A_H = LS_ZSDT0226A_H * IS_ZSDT0226B_H = LS_ZSDT0226B_H I_INDEX = L_INDEX IMPORTING O_ZSDT0226_CONF = LS_ZSDT0226_CONF O_MSGTX = L_MSGTX TABLES IT_ZSDT0226_I = LT_ZSDT0226_I. IF LS_ZSDT0226_CONF-WERKS IS INITIAL OR LS_ZSDT0226_CONF-LGORT IS INITIAL OR L_MSGTX IS NOT INITIAL. IF L_MSGTX IS INITIAL. L_MSGTX = '取存储地点时出错,请确认配置能正确取到地点'. ENDIF. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH L_MSGTX. LEAVE LIST-PROCESSING. ENDIF. ENDDO. IF GS_ALV-LIFNR IS INITIAL. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '导入数据的"供应商"不能为空'. LEAVE LIST-PROCESSING. ELSEIF GS_ALV-ZWLGS IS INITIAL. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '导入数据的"物流公司"不能为空'. LEAVE LIST-PROCESSING. ELSEIF GS_ALV-ZDQFB IS INITIAL. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '导入数据的"分部"不能为空'. LEAVE LIST-PROCESSING. ELSEIF GS_ALV-ZDQFB(1) = 'W'. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '导入数据的"分部"不能为W开头'. LEAVE LIST-PROCESSING. ELSEIF GS_ALV-KUNNR IS INITIAL. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '导入数据的"客户"不能为空'. LEAVE LIST-PROCESSING. ELSEIF GS_ALV-TAX_RATE <> '13'. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '当前只支持导入13%税率'. LEAVE LIST-PROCESSING. ENDIF. IF GT_ALV_I IS INITIAL. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '没有读取到明细数据'. LEAVE LIST-PROCESSING. ENDIF. SELECT MATNR INTO TABLE LT_MARA FROM MARA FOR ALL ENTRIES IN GT_ALV_I WHERE MATNR = GT_ALV_I-MATNR. SORT LT_MARA. LOOP AT GT_ALV_I INTO GS_ALV_I . READ TABLE LT_MARA WITH KEY TABLE_LINE = GS_ALV_I-MATNR. IF SY-SUBRC <> ''. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '导入的物料' GS_ALV_I-MATNR '在系统中不存在'. LEAVE LIST-PROCESSING. ENDIF. ENDLOOP. ENDFORM. "PFM_GET_DATA_INPUT_A_CHECK *&---------------------------------------------------------------------* *& Form PFM_GET_DATA_INPUT_B *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form PFM_GET_DATA_2 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form PFM_INPUT_SAVE *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PFM_INPUT_SAVE_A . * 把H,I表中的数据整理到P表中。 DATA: LS_ZSDT0226A_H LIKE ZSDT0226A_H, LT_ZSDT0226A_H LIKE TABLE OF ZSDT0226A_H, LS_ZSDT0226_I LIKE ZSDT0226_I, LT_ZSDT0226_I LIKE TABLE OF ZSDT0226_I, LS_ZSDT0226_LOG LIKE ZSDT0226_LOG, LT_ZSDT0226_LOG LIKE TABLE OF ZSDT0226_LOG. DATA: L_VBUND TYPE RASSC, L_VKORG TYPE VKORG. DATA: L_MSGTX TYPE MSGTX. READ TABLE GT_ALV INTO GS_ALV INDEX 1. CALL FUNCTION 'NUMBER_GET_NEXT' EXPORTING NR_RANGE_NR = '01' OBJECT = 'ZEBELN01' IMPORTING NUMBER = GS_ALV-ZEBELN. MODIFY GT_ALV FROM GS_ALV INDEX 1. LOOP AT GT_ALV_I ASSIGNING <ALV_I>. <ALV_I>-ZEBELP = SY-TABIX * 10. <ALV_I>-ZEBELN = GS_ALV-ZEBELN. MOVE-CORRESPONDING <ALV_I> TO LS_ZSDT0226_I. APPEND LS_ZSDT0226_I TO LT_ZSDT0226_I. ENDLOOP. GS_ALV_P-ZEBELN = GS_ALV-ZEBELN. GS_ALV_P-ZBTYPE = GS_ALV-ZBTYPE. GS_ALV_P-ZCREN = SY-UNAME. GS_ALV_P-ZCRED = SY-DATUM. GS_ALV_P-ZEBELP = 1. GS_ALV_P-ZFROM = GS_ALV-LIFNR."A GS_ALV_P-ZTO = GS_ALV-ZWLGS."B GS_ALV_P-ZCONNO = GS_ALV-ZCONNO."第一个PO,需合同, GS_ALV_P-ZPO_SO = 'PO'. GS_ALV_P-ZPRICEID1 = '1'. GS_ALV_P-ZPRICEID2 = ''. GS_ALV_P-ZISINFO = 'X'. APPEND GS_ALV_P TO GT_ALV_P. MOVE-CORRESPONDING GS_ALV_P TO LS_ZSDT0226_LOG. APPEND LS_ZSDT0226_LOG TO LT_ZSDT0226_LOG. CLEAR: GS_ALV_P-ZCONNO ,"后面单不能有合同 GS_ALV_P-ZISINFO. GS_ALV_P-ZEBELP = 2. GS_ALV_P-ZFROM = GS_ALV-ZWLGS."B * GS_ALV_P-ZTO = GS_ALV-ZDQFB."C L_VKORG = GS_ALV-ZDQFB. SELECT SINGLE KUNNR INTO GS_ALV_P-ZTO FROM TVKO WHERE VKORG = L_VKORG. GS_ALV_P-ZPO_SO = 'SO'. GS_ALV_P-ZPRICEID1 = '1'. "pb00 GS_ALV_P-ZPRICEID2 = '2'. "zp06 GS_ALV_P-ZISINFO = ''. APPEND GS_ALV_P TO GT_ALV_P. MOVE-CORRESPONDING GS_ALV_P TO LS_ZSDT0226_LOG. APPEND LS_ZSDT0226_LOG TO LT_ZSDT0226_LOG. IF GS_ALV_P-ZTO IS INITIAL . MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '公司(销售组织)' GS_ALV-ZDQFB '没有维护合作伙伴客户'. LEAVE LIST-PROCESSING. ENDIF. GS_ALV_P-ZEBELP = 3. * GS_ALV_P-ZFROM = GS_ALV-ZWLGS."b CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING INPUT = GS_ALV-ZWLGS IMPORTING OUTPUT = L_VBUND. SELECT SINGLE LIFNR INTO GS_ALV_P-ZFROM FROM LFA1 WHERE VBUND = L_VBUND . GS_ALV_P-ZTO = GS_ALV-ZDQFB."c GS_ALV_P-ZPO_SO = 'PO'. GS_ALV_P-ZPRICEID1 = '2'. GS_ALV_P-ZPRICEID2 = ''. GS_ALV_P-ZISINFO = ''. APPEND GS_ALV_P TO GT_ALV_P. MOVE-CORRESPONDING GS_ALV_P TO LS_ZSDT0226_LOG. APPEND LS_ZSDT0226_LOG TO LT_ZSDT0226_LOG. IF GS_ALV_P-ZFROM IS INITIAL . MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '公司' GS_ALV-ZWLGS '没有维护合作伙伴供应商'. LEAVE LIST-PROCESSING. ENDIF. GS_ALV_P-ZEBELP = 4. GS_ALV_P-ZFROM = GS_ALV-ZDQFB."C GS_ALV_P-ZTO = GS_ALV-KUNNR."D GS_ALV_P-ZPO_SO = 'SO'. GS_ALV_P-ZPRICEID1 = '2'. "pb00 GS_ALV_P-ZPRICEID2 = '3'. "zp06 GS_ALV_P-ZISINFO = ''. APPEND GS_ALV_P TO GT_ALV_P. MOVE-CORRESPONDING GS_ALV_P TO LS_ZSDT0226_LOG. APPEND LS_ZSDT0226_LOG TO LT_ZSDT0226_LOG. * MOVE-CORRESPONDING GS_ALV TO LS_ZSDT0226A_H. MODIFY ZSDT0226A_H FROM LS_ZSDT0226A_H. IF SY-SUBRC <> 0. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '更新表ZSDT0226A_H出错'. ROLLBACK WORK. LEAVE LIST-PROCESSING. ENDIF. MODIFY ZSDT0226_I FROM TABLE LT_ZSDT0226_I. IF SY-SUBRC <> 0. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '更新表ZSDT0226_I出错'. ROLLBACK WORK. LEAVE LIST-PROCESSING. ENDIF. MODIFY ZSDT0226_LOG FROM TABLE LT_ZSDT0226_LOG. IF SY-SUBRC <> 0. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '更新表ZSDT0226_LOG出错'. ROLLBACK WORK. LEAVE LIST-PROCESSING. ENDIF. COMMIT WORK. ENDFORM. " PFM_INPUT_SAVE *&---------------------------------------------------------------------* *& Form PFM_GET_DATA_INPUT_B *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->ITAB text *----------------------------------------------------------------------* FORM PFM_GET_DATA_INPUT_B TABLES ITAB STRUCTURE ZALSMEX_TABLINE. DATA: L_INDEX TYPE NUMC2 , L_DIV TYPE NUMC2, L_MOD TYPE INT1, L_ZNETWR TYPE P DECIMALS 2. FIELD-SYMBOLS: <FS>. DATA: L_FIELDNAME(20). CLEAR:GS_ALV_I. LOOP AT ITAB. "将EXCEL内表数据存入内表it_upload中 MOVE ITAB-COL TO L_INDEX. CONDENSE ITAB-VALUE NO-GAPS. *--------------------------------------------------------------------* IF ITAB-ROW = 1."表头行 GS_ALV-ZBTYPE = 'B'. IF ITAB-VALUE IS INITIAL. CONTINUE. ENDIF. IF L_INDEX = '01'. CALL FUNCTION 'UNITS_STRING_CONVERT' EXPORTING UNITS_STRING = ITAB-VALUE DCPFM = 'X' IMPORTING UNITS = L_ZNETWR. IF L_ZNETWR = 0 . L_ZNETWR = '13'. ENDIF. IF L_ZNETWR > 100 OR L_ZNETWR < 1. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '税率只能是1~100之间的数值'. LEAVE LIST-PROCESSING. ENDIF. GS_ALV-TAX_RATE = L_ZNETWR. CONTINUE. ENDIF. L_INDEX = L_INDEX - 1. CONCATENATE 'ZBUKRS' L_INDEX INTO L_FIELDNAME. ASSIGN COMPONENT L_FIELDNAME OF STRUCTURE GS_ALV TO <FS>. <FS> = ITAB-VALUE. ENDIF. *--------------------------------------------------------------------* * 明细,有效数据 从 第4行开始 IF ITAB-ROW < 4. CONTINUE. ENDIF. CASE L_INDEX. WHEN 1. IF ITAB-VALUE = '' OR ITAB-VALUE(2) = '合计'. APPEND GS_ALV_I TO GT_ALV_I. CLEAR:GS_ALV_I. EXIT. ENDIF. IF GS_ALV_I IS NOT INITIAL. APPEND GS_ALV_I TO GT_ALV_I. CLEAR:GS_ALV_I. ENDIF. CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT' EXPORTING INPUT = ITAB-VALUE IMPORTING OUTPUT = GS_ALV_I-MATNR. WHEN 2. GS_ALV_I-MAKTX = ITAB-VALUE. WHEN 4."数量 CALL FUNCTION 'UNITS_STRING_CONVERT' EXPORTING UNITS_STRING = ITAB-VALUE DCPFM = 'X' IMPORTING UNITS = GS_ALV_I-MENGE. WHEN OTHERS. * 3 or 6 or 9 or 12 or 15 or 18 or 21 * or 24 or 27 or 30. L_DIV = L_INDEX DIV 3. L_MOD = L_INDEX MOD 3."余数 IF L_MOD <> 0."不是单价列 CONTINUE. ENDIF. CONCATENATE 'ZNETWR' L_DIV INTO L_FIELDNAME. ASSIGN COMPONENT L_FIELDNAME OF STRUCTURE GS_ALV_I TO <FS>. CALL FUNCTION 'UNITS_STRING_CONVERT' EXPORTING UNITS_STRING = ITAB-VALUE DCPFM = 'X' IMPORTING UNITS = <FS>. ENDCASE. ENDLOOP. IF GS_ALV_I IS NOT INITIAL. APPEND GS_ALV_I TO GT_ALV_I. CLEAR:GS_ALV_I. ENDIF. GS_ALV-ZCREN = SY-UNAME. GS_ALV-ZCRED = SY-DATUM. APPEND GS_ALV TO GT_ALV. ENDFORM. "PFM_GET_DATA_INPUT_B *&---------------------------------------------------------------------* *& Form PFM_GET_DATA_INPUT_B_CHECK *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PFM_GET_DATA_INPUT_B_CHECK . DATA: LT_MARA TYPE TABLE OF MATNR WITH HEADER LINE. DATA: LS_ZSDT0226B_H LIKE ZSDT0226B_H, LT_ZSDT0226_I LIKE TABLE OF ZSDT0226_I, LS_ZSDT0226_I LIKE ZSDT0226_I. DATA: L_MSGTX TYPE MSGTX, L_INDEX TYPE INT1. DATA: LS_ZSDT0226_CONF LIKE ZSDT0226_CONF. READ TABLE GT_ALV INTO GS_ALV INDEX 1. MOVE-CORRESPONDING GS_ALV TO LS_ZSDT0226B_H. LOOP AT GT_ALV_I INTO GS_ALV_I. MOVE-CORRESPONDING GS_ALV_I TO LS_ZSDT0226_I. APPEND LS_ZSDT0226_I TO LT_ZSDT0226_I. ENDLOOP. DO 9 TIMES. L_INDEX = L_INDEX + 1. CALL FUNCTION 'ZFM_0226_CHECK_ZMDT0107' EXPORTING * IS_ZSDT0226A_H = LS_ZSDT0226A_H IS_ZSDT0226B_H = LS_ZSDT0226B_H I_INDEX = L_INDEX IMPORTING O_ZSDT0226_CONF = LS_ZSDT0226_CONF O_MSGTX = L_MSGTX TABLES IT_ZSDT0226_I = LT_ZSDT0226_I. IF LS_ZSDT0226_CONF-WERKS IS INITIAL OR LS_ZSDT0226_CONF-LGORT IS INITIAL OR L_MSGTX IS NOT INITIAL. IF L_MSGTX IS INITIAL. L_MSGTX = '取存储地点时出错,请确认配置能正确取到地点'. ENDIF. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH L_MSGTX. LEAVE LIST-PROCESSING. ENDIF. ENDDO. IF GS_ALV-ZBUKRS01 IS INITIAL OR GS_ALV-ZBUKRS02 IS INITIAL OR GS_ALV-ZBUKRS03 IS INITIAL . MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '导入数据至少得有三个公司主体'. LEAVE LIST-PROCESSING. ELSEIF GS_ALV-TAX_RATE <> '13'. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '当前只支持导入13%税率'. LEAVE LIST-PROCESSING. ENDIF. IF GT_ALV_I IS INITIAL. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '没有读取到明细数据'. LEAVE LIST-PROCESSING. ENDIF. SELECT MATNR INTO TABLE LT_MARA FROM MARA FOR ALL ENTRIES IN GT_ALV_I WHERE MATNR = GT_ALV_I-MATNR. SORT LT_MARA. LOOP AT GT_ALV_I INTO GS_ALV_I . READ TABLE LT_MARA WITH KEY TABLE_LINE = GS_ALV_I-MATNR. IF SY-SUBRC <> ''. MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '导入的物料' GS_ALV_I-MATNR '在系统中不存在'. LEAVE LIST-PROCESSING. ENDIF. ENDLOOP. ENDFORM. " PFM_GET_DATA_INPUT_B_CHECK *&---------------------------------------------------------------------* *& Form PFM_INPUT_SAVE_B *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PFM_INPUT_SAVE_B . * 把H,I表中的数据整理到P表中。 DATA: LS_ZSDT0226B_H LIKE ZSDT0226B_H, LT_ZSDT0226B_H LIKE TABLE OF ZSDT0226B_H, LS_ZSDT0226_I LIKE ZSDT0226_I, LT_ZSDT0226_I LIKE TABLE OF ZSDT0226_I, LS_ZSDT0226_LOG LIKE ZSDT0226_LOG, LT_ZSDT0226_LOG LIKE TABLE OF ZSDT0226_LOG. DATA: L_VBUND TYPE RASSC, L_VKORG TYPE VKORG. DATA: L_INDEX1 TYPE NUMC2,"A L_INDEX2 TYPE NUMC2,"B L_INDEX3 TYPE NUMC2,"C L_ZEBELP TYPE ZEBELP. FIELD-SYMBOLS: <A> TYPE BUKRS, <B> TYPE BUKRS, <C> TYPE BUKRS. DATA: L_FIELDNAME1(20), L_FIELDNAME2(20), L_FIELDNAME3(20), L_FIELDNAME(20). DATA: L_MSGTX TYPE MSGTX. FIELD-SYMBOLS: <PB00> TYPE ZNETWR1, <ZP06> TYPE ZNETWR1. DATA: L_OVER TYPE FLAG. READ TABLE GT_ALV INTO GS_ALV INDEX 1. CALL FUNCTION 'NUMBER_GET_NEXT' EXPORTING NR_RANGE_NR = '01' OBJECT = 'ZEBELN01' IMPORTING NUMBER = GS_ALV-ZEBELN. MODIFY GT_ALV FROM GS_ALV INDEX 1. LOOP AT GT_ALV_I ASSIGNING <ALV_I>. <ALV_I>-ZEBELP = SY-TABIX * 10. <ALV_I>-ZEBELN = GS_ALV-ZEBELN. MOVE-CORRESPONDING <ALV_I> TO LS_ZSDT0226_I. APPEND LS_ZSDT0226_I TO LT_ZSDT0226_I. ENDLOOP. READ TABLE LT_ZSDT0226_I INTO LS_ZSDT0226_I INDEX 1. L_ZEBELP = 0. DO 9 TIMES. IF L_OVER = 'X'. EXIT. ENDIF. L_INDEX1 = L_INDEX1 + 1. L_INDEX2 = L_INDEX1 + 1. L_INDEX3 = L_INDEX2 + 1. L_ZEBELP = L_ZEBELP + 1. CLEAR:GS_ALV_P. IF L_INDEX1 = 1. GS_ALV_P-ZISINFO = 'X'. ENDIF. GS_ALV_P-ZEBELN = GS_ALV-ZEBELN. GS_ALV_P-ZBTYPE = GS_ALV-ZBTYPE. GS_ALV_P-ZCREN = SY-UNAME. GS_ALV_P-ZCRED = SY-DATUM. GS_ALV_P-ZPRICEID1 = L_INDEX1. GS_ALV_P-ZPRICEID2 = ''. CONCATENATE 'ZBUKRS' L_INDEX1 INTO L_FIELDNAME1."A ASSIGN COMPONENT L_FIELDNAME1 OF STRUCTURE GS_ALV TO <A>. CONCATENATE 'ZBUKRS' L_INDEX2 INTO L_FIELDNAME2."B ASSIGN COMPONENT L_FIELDNAME2 OF STRUCTURE GS_ALV TO <B>. CONCATENATE 'ZBUKRS' L_INDEX3 INTO L_FIELDNAME3."C ASSIGN COMPONENT L_FIELDNAME3 OF STRUCTURE GS_ALV TO <C>. IF <C> IS INITIAL."最后PO,SO "第一个公司与最后一个公司必须相同。 IF <B> <> GS_ALV-ZBUKRS01 . MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '公司模板的第一个公司必须与最后一个公司相同'. LEAVE LIST-PROCESSING. ENDIF. * L_INDEX3 = 2."第一个公司与最后一个公司必须相同。 * CONCATENATE 'ZBUKRS' L_INDEX3 INTO L_FIELDNAME3."C * ASSIGN COMPONENT L_FIELDNAME3 OF STRUCTURE GS_ALV TO <C>. <C> = GS_ALV-ZBUKRS02 . L_INDEX2 = 1. L_OVER = 'X'. ENDIF. *--------------------------------------------------------------------* *PO GS_ALV_P-ZEBELP = L_ZEBELP. L_VBUND = <A>. CLEAR: GS_ALV_P-ZFROM. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING INPUT = <A> IMPORTING OUTPUT = L_VBUND. SELECT SINGLE LIFNR INTO GS_ALV_P-ZFROM FROM LFA1 WHERE VBUND = L_VBUND . * GS_ALV_P-ZFROM = <FROM>."A GS_ALV_P-ZTO = <B>."B GS_ALV_P-ZPO_SO = 'PO'. APPEND GS_ALV_P TO GT_ALV_P. MOVE-CORRESPONDING GS_ALV_P TO LS_ZSDT0226_LOG. APPEND LS_ZSDT0226_LOG TO LT_ZSDT0226_LOG. IF GS_ALV_P-ZFROM IS INITIAL . MESSAGE S100(ZSD) DISPLAY LIKE 'E' WITH '公司' |