自己的一个ALV隐藏列例子
1 *&---------------------------------------------------------------------* 2 *& Report ZR_FI_01 3 *& 4 *&---------------------------------------------------------------------* 5 *&----------狼 6 *& 7 *&---------------------------------------------------------------------* 8 9 REPORT zr_fi_ma. 10 11 12 TABLES: bseg,t001,bkpf ,skat. 13 14 *定义ALV相关变量 15 16 TYPE-POOLS : slis. 17 DATA: afield TYPE slis_fieldcat_alv. 18 DATA: i_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE. 19 DATA: fieldcat TYPE slis_t_fieldcat_alv. 20 DATA: gs_layout TYPE slis_layout_alv. 21 DATA: g_repid TYPE sy-repid. 22 DATA: i_layout TYPE slis_layout_alv. 23 DATA gridlsl TYPE lvc_s_glay. 24 DATA itab1 LIKE zstr_pz OCCURS 0 WITH HEADER LINE. 25 *DATA itab2 LIKE zstr_pz OCCURS 0 WITH HEADER LINE. 26 DATA itab LIKE zstr_pz OCCURS 0 WITH HEADER LINE. 27 DATA: c1(2) TYPE c VALUE '年',c2(2) TYPE c VALUE '月',c3(2) TYPE c VALUE '日', 28 c4(4) TYPE c ,c5(2) TYPE c ,c6(2) TYPE c ,c7(20) TYPE c . 29 *DATA LEN TYPE I. 30 *定义内表字段 31 32 DATA:BEGIN OF itab_skat OCCURS 0, 33 txt50 LIKE skat-txt50, 34 saknr LIKE skat-saknr, 35 END OF itab_skat. 36 37 DATA:BEGIN OF itab_bkpf OCCURS 0, 38 bktxt LIKE bkpf-bktxt, "凭证抬头文本 39 usnam LIKE bkpf-usnam, "用户名 40 budat LIKE bkpf-budat, "过账日期 41 belnr LIKE bkpf-belnr, "会计凭证 42 gjahr LIKE bkpf-gjahr, "会计年度 43 bukrs LIKE bkpf-bukrs, "代码公司 44 monat LIKE bkpf-monat, "会计期间 45 blart LIKE bkpf-blart, "凭证类型 46 bldat LIKE bkpf-bldat, "凭证日期 47 numpg LIKE bkpf-numpg, "页数 48 STBLG LIKE BKPF-STBLG, "冲销凭证号 49 WAERS LIKE BKPF-WAERS, "货币 50 KURSF LIKE BKPF-KURSF, "汇率 51 BSTAT LIKE BKPF-BSTAT, "凭证状态 52 END OF itab_bkpf. 53 54 55 DATA:BEGIN OF itab_t001 OCCURS 0, 56 butxt LIKE t001-butxt, "公司代码 57 bukrs LIKE t001-bukrs, "代码公司 58 END OF itab_t001. 59 60 DATA: BEGIN OF wa_alv OCCURS 0, 61 flag(1) , 62 augdt01 LIKE zstr_pz-augdt01, 63 bukrs LIKE bseg-bukrs,"代码公司 64 belnr LIKE bseg-belnr,"会计凭证 65 gjahr LIKE bseg-gjahr,"会计年度 66 butxt LIKE t001-butxt,"公司代码 67 augdt LIKE bseg-augdt,"清帐日期 68 hkont LIKE bseg-hkont,"总分类帐帐目 69 bktxt LIKE bkpf-bktxt,"凭证抬头文本 70 buzei LIKE bseg-buzei,"会计凭证中的行项目数 71 txt50 LIKE skat-txt50,"总账科目成文本 72 wrbtr LIKE bseg-wrbtr,"凭证货币金额 73 shkzg LIKE bseg-shkzg,"借方/贷方标识 74 wrbtr01 LIKE bseg-wrbtr,"凭证货币金额 75 shkzg01 LIKE bseg-shkzg,"借方/贷方标识 76 usnam LIKE bkpf-usnam, "用户名 77 budat LIKE bkpf-budat, "过账日期 78 blart LIKE bkpf-blart, "凭证类型 79 bldat LIKE bkpf-bldat, "凭证日期 80 numpg LIKE bkpf-numpg, "页数 81 stblg LIKE bkpf-stblg, "冲销凭证号 82 waers LIKE bkpf-waers, "货币 83 kursf LIKE bkpf-kursf, "汇率 84 bstat LIKE bkpf-bstat. "凭证状态 85 DATA END OF wa_alv. 86 87 DATA wa_alv01 LIKE TABLE OF wa_alv WITH HEADER LINE. 88 89 DATA:BEGIN OF sum_itab OCCURS 0, 90 belnr TYPE bseg-belnr, 91 count01 TYPE bseg-wrbtr, 92 count02 TYPE bseg-wrbtr. 93 DATA END OF sum_itab. 94 *选择屏幕 95 SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text. 96 97 SELECT-OPTIONS: p_bukrs FOR bkpf-bukrs no INTERVALS OBLIGATORY DEFAULT 1000, 98 p_belnr FOR bkpf-belnr , 99 p_gjahr FOR bkpf-gjahr no INTERVALS OBLIGATORY DEFAULT SY-DATUM, 100 p_monat FOR bkpf-monat, 101 p_usnam FOR bkpf-usnam NO INTERVALS. 102 103 SELECTION-SCREEN END OF BLOCK blk. 104 105 INITIALIZATION. 106 g_repid = sy-repid. 107 text = '凭证信息'. 108 109 START-OF-SELECTION. 110 PERFORM getdata. 111 PERFORM layout_build. 112 PERFORM sub_init_fieldcat. 113 PERFORM sub_init_layout. 114 PERFORM sub_listado. 115 116 END-OF-SELECTION. 117 118 *&--------------------------------------------------------------------* 119 *& Form getdata 120 *&--------------------------------------------------------------------* 121 * 获取数据 从数据库表中选择相应字段 122 *---------------------------------------------------------------------* 123 *&---------------------------------------------------------------------* 124 125 FORM getdata ."从数据库里取数到ALV 126 127 ****************************************从BKPF中取数据 128 SELECT bktxt usnam budat belnr gjahr bukrs monat blart bldat numpg stblg waers kursf bstat 129 INTO CORRESPONDING FIELDS OF TABLE itab_bkpf 130 FROM bkpf 131 WHERE usnam in p_usnam AND belnr IN p_belnr AND bukrs in p_bukrs AND monat IN p_monat AND gjahr in p_gjahr. 132 IF SY-SUBRC <> 0. 133 MESSAGE '所找数据不存在,请纠正' TYPE 'I'. 134 stop. 135 RETURN."跳出 136 ENDIF. 137 **********************************从BSEG中取数据 138 IF itab_bkpf[] IS NOT INITIAL. 139 SELECT bukrs belnr gjahr augdt hkont wrbtr shkzg buzei 140 INTO CORRESPONDING FIELDS OF TABLE wa_alv 141 * UP TO 100 ROWSC 142 FROM bseg 143 FOR ALL ENTRIES IN itab_bkpf 144 WHERE belnr = itab_bkpf-belnr ."AND gjahr IN p_gjahr and belnr = itab_bkpf-belnr. 145 146 ENDIF. 147 148 ***********************把指在BKPF里有的凭证编号取出来 149 LOOP AT ITAB_BKPF. 150 SELECT SINGLE bukrs belnr gjahr augdt hkont wrbtr shkzg buzei 151 INTO CORRESPONDING FIELDS OF wa_alv 152 FROM bseg 153 WHERE belnr = itab_bkpf-belnr. 154 IF SY-SUBRC <> 0. 155 MOVE-CORRESPONDING itab_bkpf to wa_alv01. 156 APPEND WA_ALV01. 157 ENDIF. 158 ENDLOOP. 159 *************************************从T001中取数据 160 SELECT * 161 INTO CORRESPONDING FIELDS OF TABLE itab_t001 162 FROM t001 "把数直接放到工作区间里面去,不会放在表头! 163 WHERE bukrs in p_bukrs. 164 165 ************从SKAT里取数 166 IF wa_alv[] IS NOT INITIAL. 167 SELECT txt50 saknr 168 INTO CORRESPONDING FIELDS OF TABLE itab_skat 169 FROM skat 170 FOR ALL ENTRIES IN wa_alv 171 WHERE saknr = wa_alv-hkont." AND SPRAS = '1' AND KTOPL = 'INT'. 172 ENDIF. 173 174 *********************整理alv上要显示的数据 175 LOOP AT wa_alv. 176 *********** 把借和贷分开 177 CASE wa_alv-shkzg. 178 WHEN 'S'. 179 wa_alv-wrbtr = wa_alv-wrbtr. 180 WHEN 'H'. 181 wa_alv-wrbtr01 = wa_alv-wrbtr. 182 CLEAR wa_alv-wrbtr. 183 WHEN OTHERS. 184 ENDCASE. 185 ************************把BUTXT整理到ALV内表里面 186 READ TABLE itab_t001 WITH KEY bukrs = wa_alv-bukrs. 187 IF sy-subrc EQ 0. 188 MOVE itab_t001-butxt TO wa_alv-butxt. 189 ENDIF. 190 **********************把BKTXT USNAM BUDAT NUMPG整理到ALV内表去 191 READ TABLE itab_bkpf WITH KEY bukrs = wa_alv-bukrs gjahr = wa_alv-gjahr belnr = wa_alv-belnr . 192 IF sy-subrc EQ 0. 193 MOVE itab_bkpf-bktxt TO wa_alv-bktxt. 194 MOVE itab_bkpf-usnam TO wa_alv-usnam. 195 MOVE itab_bkpf-budat TO wa_alv-budat. 196 MOVE itab_bkpf-numpg TO wa_alv-numpg. 197 198 MOVE itab_bkpf-blart TO wa_alv-blart. 199 MOVE itab_bkpf-bldat TO wa_alv-bldat. 200 MOVE itab_bkpf-stblg TO wa_alv-stblg. 201 MOVE itab_bkpf-waers TO wa_alv-waers. 202 203 MOVE itab_bkpf-kursf TO wa_alv-kursf. 204 MOVE itab_bkpf-bstat TO wa_alv-bstat. 205 MOVE itab_bkpf-numpg TO wa_alv-numpg. 206 ENDIF. 207 ************************************* 把TXT50整理到内表去, 208 READ TABLE itab_skat WITH KEY saknr = wa_alv-hkont. 209 IF sy-subrc EQ 0. 210 MOVE itab_skat-txt50 TO wa_alv-txt50. 211 ENDIF. 212 213 MODIFY wa_alv. 214 ENDLOOP. 215 216 **********************把数据转移到要显示的ALV屏幕上的内表WA_ALV01上 217 LOOP AT wa_alv. 218 MOVE-CORRESPONDING wa_alv TO wa_alv01. 219 APPEND wa_alv01. 220 ENDLOOP. 221 222 *******************根据物料编号排序,把相同的物料编号删除 223 SORT wa_alv01 BY belnr. 224 DELETE ADJACENT DUPLICATES FROM wa_alv01 COMPARING belnr. 225 DELETE WA_ALV01 WHERE BELNR = ''. 226 ENDFORM. " GETDATA 227 *&---------------------------------------------------------------------* 228 *& Form SUB_INIT_FIELDCAT 229 *&---------------------------------------------------------------------* 230 * text 231 *----------------------------------------------------------------------* 232 * --> p1 text 233 * <-- p2 text 234 *----------------------------------------------------------------------* 235 FORM layout_build . 236 i_layout-box_fieldname = 'FLAG'. 237 i_layout-colwidth_optimize = 'X'. "优化列宽选项是否设置 238 i_layout-zebra = 'X'. 239 i_layout-detail_initial_lines = 'X'. 240 i_layout-no_vline = 'X'." layout_build 241 242 ENDFORM. " LAYOUT_BUILD 243 244 *&---------------------------------------------------------------------* 245 *& Form SUB_INIT_FIELDCAT 246 *&---------------------------------------------------------------------* 247 * text 248 *----------------------------------------------------------------------* 249 FORM sub_init_fieldcat . 250 251 i_fieldcat-fieldname = 'BUKRS'. "公司代码 252 i_fieldcat-tabname = 'ITEM'. 253 i_fieldcat-reptext_ddic = '公司代码'. 254 i_fieldcat-outputlen = 10. 255 i_fieldcat-key = 'X'. 256 i_fieldcat-just = 'C'. 257 APPEND i_fieldcat. 258 CLEAR i_fieldcat. 259 260 i_fieldcat-fieldname = 'BUTXT'. "公司代码 261 i_fieldcat-tabname = 'ITEM'. 262 i_fieldcat-reptext_ddic = '核算单位'. 263 i_fieldcat-outputlen = 10. 264 i_fieldcat-key = 'X'. 265 * i_fieldcat-no_out ='X'. 266 i_fieldcat-just = 'C'. 267 APPEND i_fieldcat. 268 CLEAR i_fieldcat. 269 270 i_fieldcat-fieldname = 'BELNR'. "会计凭证 271 i_fieldcat-tabname = 'ITEM'. 272 i_fieldcat-reptext_ddic = '凭证编号'. 273 i_fieldcat-outputlen = 12. 274 i_fieldcat-key = 'X'. 275 i_fieldcat-just = 'C'. 276 APPEND i_fieldcat. 277 CLEAR i_fieldcat. 278 279 i_fieldcat-fieldname = 'GJAHR'. 280 i_fieldcat-tabname = 'ITEM'. 281 i_fieldcat-reptext_ddic = '会计年度'. 282 i_fieldcat-outputlen = 4. 283 i_fieldcat-key = 'X'. 284 i_fieldcat-just = 'C'. 285 APPEND i_fieldcat. 286 CLEAR i_fieldcat. 287 288 i_fieldcat-fieldname = 'BLART'. "会计凭证 289 i_fieldcat-tabname = 'ITEM'. 290 i_fieldcat-reptext_ddic = '凭证类型'. 291 i_fieldcat-outputlen = 2. 292 i_fieldcat-just = 'C'. 293 APPEND i_fieldcat. 294 CLEAR i_fieldcat. 295 296 i_fieldcat-fieldname = 'BLDAT'. "会计凭证 297 i_fieldcat-tabname = 'ITEM'. 298 i_fieldcat-reptext_ddic = '凭证日期'. 299 i_fieldcat-outputlen = 8. 300 i_fieldcat-just = 'C'. 301 APPEND i_fieldcat. 302 CLEAR i_fieldcat. 303 304 i_fieldcat-fieldname = 'BUDAT'. "清单日期 305 i_fieldcat-tabname = 'ITEM'. 306 i_fieldcat-reptext_ddic = '过账日期'. 307 i_fieldcat-outputlen = 10. 308 i_fieldcat-just = 'C'. 309 APPEND i_fieldcat. 310 CLEAR i_fieldcat. 311 312 i_fieldcat-fieldname = 'USNAM'. "用户名 313 i_fieldcat-tabname = 'ITEM'. 314 i_fieldcat-reptext_ddic = ' 制 单'. 315 i_fieldcat-outputlen = 18. 316 i_fieldcat-just = 'C'. 317 APPEND i_fieldcat. 318 CLEAR i_fieldcat. 319 320 i_fieldcat-fieldname = 'STBLG'. 321 i_fieldcat-tabname = 'ITEM'. 322 i_fieldcat-reptext_ddic = '冲销凭证号'. 323 i_fieldcat-outputlen = 10. 324 i_fieldcat-just = 'C'. 325 APPEND i_fieldcat. 326 CLEAR i_fieldcat. 327 328 i_fieldcat-fieldname = 'BKTXT'. 329 i_fieldcat-tabname = 'ITEM'. 330 i_fieldcat-reptext_ddic = '凭证抬头文本'. 331 i_fieldcat-outputlen = 10. 332 i_fieldcat-just = 'C'. 333 APPEND i_fieldcat. 334 CLEAR i_fieldcat. 335 336 i_fieldcat-fieldname = 'WAERS'. 337 i_fieldcat-tabname = 'ITEM'. 338 i_fieldcat-reptext_ddic = '货币'. 339 i_fieldcat-outputlen = 14. 340 i_fieldcat-just = 'C'. 341 APPEND i_fieldcat. 342 CLEAR i_fieldcat. 343 344 i_fieldcat-fieldname = 'KURSF'. "用户名 345 i_fieldcat-tabname = 'ITEM'. 346 i_fieldcat-reptext_ddic = ' 汇率'. 347 i_fieldcat-outputlen = 9. 348 i_fieldcat-just = 'C'. 349 APPEND i_fieldcat. 350 CLEAR i_fieldcat. 351 352 i_fieldcat-fieldname = 'BSTAT'. 353 i_fieldcat-tabname = 'ITEM'. 354 i_fieldcat-reptext_ddic = '凭证状态'. 355 i_fieldcat-outputlen = 2. 356 i_fieldcat-just = 'C'. 357 APPEND i_fieldcat. 358 CLEAR i_fieldcat. 359 360 i_fieldcat-fieldname = 'NUMPG'. 361 i_fieldcat-tabname = 'ITEM'. 362 i_fieldcat-reptext_ddic = '页数'. 363 i_fieldcat-outputlen = 3. 364 i_fieldcat-just = 'C'. 365 APPEND i_fieldcat. 366 CLEAR i_fieldcat. 367 368 ENDFORM. " SUB_INIT_FIELDCAT 369 *&---------------------------------------------------------------------* 370 *& Form SUB_INIT_LAYOUT 371 *&---------------------------------------------------------------------* 372 * text 373 *----------------------------------------------------------------------* 374 * --> p1 text 375 * <-- p2 text 376 *----------------------------------------------------------------------* 377 FORM sub_init_layout . 378 DATA:num TYPE i VALUE 0. 379 * DATA: l_output(50). 380 * i_layout-zebra = 'X'. 381 * l_output = '会计凭证'. 382 * i_layout-window_titlebar = l_output. 383 * i_layout-colwidth_optimize = 'X'. 384 * sort wa_alv by NUMPG. 385 * 386 *read table wa_alv with key NUMPG = '' BINARY SEARCH. 387 388 LOOP AT wa_alv WHERE NUMPG <> ''. 389 num = 1. 390 ENDLOOP. 391 IF num = 0. 392 LOOP AT i_fieldcat. 393 i_fieldcat-no_out = ''. 394 IF i_fieldcat-fieldname = 'NUMPG' . 395 i_fieldcat-no_out = 'X'. 396 ENDIF. 397 MODIFY i_fieldcat . 398 ENDLOOP. 399 400 ENDIF. 401 * CALL METHOD go_grid->set_frontend_fieldcatalog 402 * EXPORTING 403 * it_fieldcatalog = gt_fieldcat. 404 * CALL METHOD go_grid->refresh_table_display . 405 406 ENDFORM. " SUB_INIT_LAYOUT 407 *&---------------------------------------------------------------------* 408 *& Form SUB_LISTADO 409 *&---------------------------------------------------------------------* 410 * text 411 *----------------------------------------------------------------------* 412 * --> p1 text 413 * <-- p2 text 414 *----------------------------------------------------------------------* 415 FORM sub_listado . 416 g_repid = sy-repid. 417 CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 418 EXPORTING 419 i_callback_user_command = 'USER_COMMAND' 420 i_callback_pf_status_set = 'USER_STATUS' 421 i_callback_program = g_repid 422 is_layout = i_layout 423 it_fieldcat = i_fieldcat[] 424 * it_events = i_events[] 425 TABLES 426 t_outtab = wa_alv01 427 EXCEPTIONS 428 program_error = 1 429 OTHERS = 2. 430 ENDFORM. " SUB_LISTADO 431 432 *&---------------------------------------------------------------------* 433 *& Form user_command 434 *&---------------------------------------------------------------------* 435 * text 436 *----------------------------------------------------------------------* 437 * -->R_UCOMM text 438 * -->RS_SELFIELD text 439 *----------------------------------------------------------------------* 440 FORM user_command USING r_ucomm LIKE sy-ucomm 441 rs_selfield TYPE slis_selfield. 442 443 DATA: ok_code TYPE sy-ucomm. 444 ok_code = sy-ucomm. 445 CLEAR sy-ucomm. 446 447 CASE ok_code. 448 WHEN 'BACK'. 449 LEAVE TO SCREEN 0. 450 WHEN 'EXIT'. 451 EXIT. 452 WHEN 'COPY'. 453 * LEAVE TO SCREEN 0. 454 PERFORM dayin. 455 WHEN 'SAVE'. 456 LEAVE TO SCREEN 0. 457 WHEN OTHERS. 458 EXIT. 459 ENDCASE. 460 461 462 ENDFORM. " USER_COMMAND 463 *&---------------------------------------------------------------------* 464 *& Form USER_STATUS 465 *&---------------------------------------------------------------------* 466 * text 467 *----------------------------------------------------------------------* 468 * --> p1 text 469 * <-- p2 text 470 *----------------------------------------------------------------------* 471 FORM user_status USING extab TYPE slis_t_extab. 472 SET PF-STATUS 'FIPZ_STU01'. 473 SET TITLEBAR 'FIPZ_TIT'. 474 ENDFORM. "user_status 475 *&---------------------------------------------------------------------* 476 *& Form DAYIN 477 *&---------------------------------------------------------------------* 478 * text 479 *----------------------------------------------------------------------* 480 * --> p1 text 481 * <-- p2 text 482 *----------------------------------------------------------------------* 483 FORM dayin . 484 485 PERFORM get_data. 486 DATA fm_name TYPE rs38l_fnam. 487 CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' 488 EXPORTING 489 formname = 'ZFI_PZ002'"写自己设计的smartforms名字.自动返回对应的function module函数代码 490 IMPORTING 491 fm_name = fm_name "这里系统返回的是函数代码(/1BCDWB/SF00000003) 492 EXCEPTIONS 493 no_form = 1 494 no_function_module = 2 495 OTHERS = 3. 496 IF sy-subrc <> 0. 497 MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno 498 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. 499 ENDIF. 500 501 CALL FUNCTION fm_name "调用SMARTFORM,很显然这里是以FUNCTION MOUDULE的方式和SMARTFORM交互. 502 EXPORTING 503 user_settings = 'X' 504 TABLES "填写SF调用的表和程序的表对应 505 itab1 = itab1 "前一个是sf 后面是程序的. 506 itab = itab "把ITAB内表的内容传递到SMARTFORM中去 507 EXCEPTIONS 508 formatting_error = 1 509 internal_error = 2 510 send_error = 3 511 user_canceled = 4 512 OTHERS = 5. 513 514 ENDFORM. " DAYIN 515 *&---------------------------------------------------------------------* 516 *& Form GET_DATA 517 *&---------------------------------------------------------------------* 518 * text 519 *----------------------------------------------------------------------* 520 * --> p1 text 521 * <-- p2 text 522 *----------------------------------------------------------------------* 523 FORM get_data . 524 CLEAR: itab[],itab. 525 CLEAR:itab1[],itab1. 526 * 定义了上面的这两行,就可以实现多次打印! 527 528 LOOP AT wa_alv01 WHERE flag = 'X'. 529 530 *******************************检验是否能打印 531 IF wa_alv01-butxt is INITIAL. 532 DATA:ME01(10) TYPE C, 533 ME02(25) TYPE C. 534 ME01 = wa_alv01-BELNR. 535 CONCATENATE '凭证' ME01 '没有行项目,无法打印' INTO ME02. 536 MESSAGE ME02 TYPE 'I'. 537 ENDIF. 538 539 *************************把需要的数据传到与SF相连额桥梁表 540 LOOP AT wa_alv WHERE belnr = wa_alv01-belnr. 541 542 ******************* 时间格式转换 543 PERFORM time_data. 544 545 MOVE-CORRESPONDING wa_alv TO itab1. 546 APPEND itab1. 547 SORT itab1 BY bktxt belnr wrbtr wrbtr01 . 548 549 ENDLOOP. 550 551 ENDLOOP. 552 553 DELETE ADJACENT DUPLICATES FROM itab1 COMPARING ALL FIELDS."删除重复行。 554 555 LOOP AT itab1. 556 MOVE itab1-butxt TO itab-butxt. 557 * MOVE ITAB-AUGDT+0(4) TO ITAB1-YYYY. 558 * MOVE ITAB-AUGDT+4(2) TO ITAB1-MM. 559 * MOVE ITAB-AUGDT+6(2) TO ITAB1-DD. 560 MOVE itab1-belnr TO itab-belnr. 561 MOVE itab1-usnam TO itab-usnam. 562 APPEND itab. 563 DELETE ADJACENT DUPLICATES FROM itab COMPARING ALL FIELDS."* = COLLECT ITAB1. 564 MOVE itab1-belnr TO sum_itab-belnr. 565 sum_itab-count01 = itab1-wrbtr. 566 sum_itab-count02 = itab1-wrbtr01 . 567 COLLECT sum_itab. 568 CLEAR sum_itab. 569 570 ENDLOOP. 571 572 LOOP AT itab. 573 READ TABLE sum_itab WITH KEY belnr = itab-belnr. 574 IF sy-subrc = 0 . 575 itab-count01 = sum_itab-count01 . 576 itab-count02 = sum_itab-count02. 577 578 ENDIF. 579 LOOP AT itab1 WHERE belnr = itab1-belnr AND butxt = itab1-butxt AND usnam = itab1-usnam . 580 IF itab1-augdt01 <> ''. 581 MOVE itab1-augdt01 TO itab-augdt01. 582 ENDIF. 583 ENDLOOP. 584 MODIFY itab[] FROM itab. 585 ENDLOOP. 586 SORT itab1 BY wrbtr01. 587 588 589 590 591 ENDFORM. " GET_DATA 592 *&---------------------------------------------------------------------* 593 *& Form TIME_DATA 594 *&---------------------------------------------------------------------* 595 * text改为需求的日期 596 *----------------------------------------------------------------------* 597 * --> p1 text 598 * <-- p2 text 599 *----------------------------------------------------------------------* 600 FORM time_data . 601 IF wa_alv-budat NE 0. 602 MOVE wa_alv-budat+0(4) TO c4. 603 MOVE wa_alv-budat+4(2) TO c5. 604 MOVE wa_alv-budat+6(2) TO c6. 605 CONCATENATE c4 c1 c5 c2 c6 c3 INTO wa_alv-augdt01. 606 MODIFY wa_alv[] FROM wa_alv. 607 ENDIF. 608 ENDFORM. " TIME_DATA