二维码

[fmalv] alv list 实现alv多表头或自定义表头(二)

Twilight发表于 2014-08-14 09:56Twilight 最后回复于 2014-08-14 09:56 [复制链接] 5426 0

在表头中增加指定行数数据需要调用其"TOP_OF_PAGE"事件,"AFTER_LINE_OUTPUT"事件用于控制其报表输出后所处理事件

程序代码:
  1. TABLES:afko,afru,afpo,pbim,pbed,makt,mard .
  2. *************ALV
  3. TYPE-POOLS slis.
  4. DATA:l_events TYPE slis_t_event,
  5.      gs_layout TYPE slis_layout_alv,
  6.      fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
  7.      eventcat TYPE slis_t_event WITH HEADER LINE.
  8. DATA:l_variant TYPE TABLE OF disvariant WITH HEADER LINE,
  9.      prg LIKE sy-repid.
  10. **************
  11. DATA:bedat LIKE pbed-pdatu,"当月月初
  12.      eddat LIKE pbed-pdatu."当月月末
  13. DATA yesterday LIKE sy-datum.
  14. DATA:   lcm LIKE makt-matnr, " 冷藏门
  15.         ldm LIKE makt-matnr, " 冷冻门
  16.         bwm LIKE makt-matnr, "变温门
  17.         czhxt LIKE makt-matnr," 初装后箱体
  18.         zzhxt LIKE makt-matnr." 总装后箱体
  19. DATA:gmnga_buf LIKE afru-gmnga. "计算当月计划
  20. DATA:BEGIN OF itb_list_fert OCCURS 0, "当天有生产的整机清单
  21.         stlbez LIKE afko-stlbez,      "物料号
  22.         stlal LIKE afko-stlal,        "可选BOM
  23.         stlan LIKE afko-stlan,        "BOM 用途
  24.      END OF itb_list_fert.
  25. DATA: maktx LIKE makt-maktx ,
  26.       maktx1 LIKE makt-maktx ,
  27.       f1 LIKE makt-maktx ,
  28.       f2 LIKE makt-maktx ,
  29.       f3 LIKE makt-maktx ,
  30.       dot VALUE '.',
  31.       dot1 VALUE ','.
  32. DATA:BEGIN OF itb_output OCCURS 0,"输出表格
  33.         maktx LIKE makt-maktx,    "产品型号
  34.         plnmg_f_m LIKE pbed-plnmg, "当月计划
  35.         czhxt LIKE makt-matnr," 初装后箱体
  36.         gmnga_lcm LIKE afru-gmnga,   "冷藏门 当日完成
  37.         gmnga_lcm_lj LIKE afru-gmnga,"冷藏门 累计完成
  38.         labst_lcm LIKE mard-labst,   "冷藏门 结存
  39.         gmnga_ldm LIKE afru-gmnga,   "冷冻门 当日完成
  40.         gmnga_ldm_lj LIKE afru-gmnga,"冷冻门 累计完成
  41.         labst_ldm LIKE mard-labst,   "冷冻门 结存
  42.         gmnga_bwm LIKE afru-gmnga,   "变温门 当日完成
  43.         gmnga_bwm_lj LIKE afru-gmnga,"变温门 累计完成
  44.         labst_bwm LIKE mard-labst,   "变温门 结存
  45.         gmnga_czhxt LIKE afru-gmnga,   "初装上楼 当日完成
  46.         gmnga_czhxt_lj LIKE afru-gmnga,"初装上楼 累计完成
  47.         labst_czhxt LIKE mard-labst,   "初装上楼 结存
  48.         gmnga_zzhxt LIKE afru-gmnga,   "总装完成 当日完成
  49.         gmnga_zzhxt_lj LIKE afru-gmnga,"总装完成 累计完成
  50.         labst_zzhxt LIKE mard-labst,   "总装完成 结存
  51.         gmnga_zj LIKE afru-gmnga,   "成品入库 当日完成 "生产计划已完成数
  52.         gmnga_zj_lj LIKE afru-gmnga,"成品入库 累计完成
  53.         labst_zj LIKE mard-labst,   "成品入库 结存
  54.         sljhc LIKE afru-gmnga ,      "上楼冰箱与计划差
  55.         bzjhc LIKE afru-gmnga ,      "包装入库冰箱与计划差
  56.         gmnga_zj1 LIKE afru-gmnga,    "生产计划已完成数
  57.         END OF itb_output.
  58. DATA itb_stpox LIKE STANDARD TABLE OF  stpox WITH HEADER LINE.
  59. DATA:BEGIN OF itb_bom_maktx OCCURS 0,"BOM展开后的物料描述
  60.      idnrk LIKE stpox-idnrk,
  61.      maktx LIKE makt-maktx,
  62.      END OF itb_bom_maktx.
  63. INITIALIZATION.
  64.   l_variant-report = sy-repid.
  65. *******************************************START-OF-SELECTION
  66. START-OF-SELECTION.
  67.   PERFORM  eventtab_build CHANGING l_events.
  68.   PERFORM input_data.
  69.   PERFORM write_data.

  70. *&---------------------------------------------------------------------*
  71. *&      Form  write_data
  72. *&---------------------------------------------------------------------*
  73. *       text
  74. *----------------------------------------------------------------------*
  75. *  -->  p1        text
  76. *  <--  p2        text
  77. *----------------------------------------------------------------------*
  78. FORM write_data .
  79.   PERFORM get_fieldcat.

  80.   gs_layout-zebra = 'X' .
  81.   prg = sy-repid.
  82.   CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  83.     EXPORTING
  84.       i_callback_program = prg
  85.       is_layout          = gs_layout
  86.       is_variant         = l_variant
  87.       it_fieldcat        = fieldcat[]
  88.       it_events          = eventcat[]
  89.     TABLES
  90.       t_outtab           = itb_output[]
  91.     EXCEPTIONS
  92.       program_error      = 1
  93.       OTHERS             = 2.
  94. ENDFORM.                    " write_data
  95. *&---------------------------------------------------------------------*
  96. *&      Form  GET_FIELDCAT
  97. *&---------------------------------------------------------------------*
  98. *    因为ALV表头是手工调整输出的,所以必须在这里输入每个列的宽度
  99. *    fieldcat-outputlen .
  100. *----------------------------------------------------------------------*
  101. *  -->  p1        text
  102. *  <--  p2        text
  103. *----------------------------------------------------------------------*
  104. FORM get_fieldcat.
  105.   CLEAR fieldcat.
  106.   fieldcat-tabname = 'ITAB_OUTPUT'.
  107.   fieldcat-fieldname = 'MAKTX'.
  108.   fieldcat-col_pos   = 1.               " Position on screen
  109.   fieldcat-seltext_l = '产品型号'.
  110.   fieldcat-key = 'X'.
  111.   fieldcat-outputlen = 11.
  112.   APPEND fieldcat.

  113.   CLEAR fieldcat.
  114.   fieldcat-tabname = 'ITAB_OUTPUT'.
  115.   fieldcat-fieldname = 'PLNMG_F_M'.
  116.   fieldcat-col_pos   = 2.               " Position on screen
  117.   fieldcat-seltext_l = '月计划合计'.
  118.   fieldcat-key = 'X'.
  119.   fieldcat-outputlen = 10.
  120.   APPEND fieldcat.

  121.   CLEAR fieldcat.
  122.   fieldcat-tabname = 'ITAB_OUTPUT'.
  123.   fieldcat-fieldname = 'GMNGA_LCM'.
  124.   fieldcat-col_pos   = 3.               " Position on screen
  125.   fieldcat-seltext_l = '冷藏门当日完成'.
  126.   fieldcat-outputlen = 10.
  127.   APPEND fieldcat.

  128.   CLEAR fieldcat.
  129.   fieldcat-tabname = 'ITAB_OUTPUT'.
  130.   fieldcat-fieldname = 'GMNGA_LCM_LJ'.
  131.   fieldcat-col_pos   = 4.               " Position on screen
  132.   fieldcat-seltext_l = '冷藏门累计完成'.
  133.   fieldcat-outputlen = 10.
  134.   APPEND fieldcat.

  135.   CLEAR fieldcat.
  136.   fieldcat-tabname = 'ITAB_OUTPUT'.
  137.   fieldcat-fieldname = 'LABST_LCM'.
  138.   fieldcat-col_pos   = 5.               " Position on screen
  139.   fieldcat-seltext_l = '冷藏门结存'.
  140.   fieldcat-outputlen = 10.
  141.   APPEND fieldcat.

  142.   CLEAR fieldcat.
  143.   fieldcat-tabname = 'ITAB_OUTPUT'.
  144.   fieldcat-fieldname = 'GMNGA_LDM'.
  145.   fieldcat-col_pos   = 6.               " Position on screen
  146.   fieldcat-seltext_l = '冷冻门当日完成'.
  147.   fieldcat-outputlen = 10.
  148.   APPEND fieldcat.

  149.   CLEAR fieldcat.
  150.   fieldcat-tabname = 'ITAB_OUTPUT'.
  151.   fieldcat-fieldname = 'GMNGA_LDM_LJ'.
  152.   fieldcat-col_pos   = 7.               " Position on screen
  153.   fieldcat-seltext_l = '冷冻门累计完成'.
  154.   fieldcat-outputlen = 10.
  155.   APPEND fieldcat.

  156.   CLEAR fieldcat.
  157.   fieldcat-tabname = 'ITAB_OUTPUT'.
  158.   fieldcat-fieldname = 'LABST_LDM'.
  159.   fieldcat-col_pos   = 8.               " Position on screen
  160.   fieldcat-seltext_l = '冷冻门结存'.
  161.   fieldcat-outputlen = 10.
  162.   APPEND fieldcat.
  163.   CLEAR fieldcat.
  164.   fieldcat-tabname = 'ITAB_OUTPUT'.
  165.   fieldcat-fieldname = 'GMNGA_BWM'.
  166.   fieldcat-col_pos   = 9.               " Position on screen
  167.   fieldcat-seltext_l = '变温室当日完成'.
  168.   fieldcat-outputlen = 10.
  169.   APPEND fieldcat.
  170.   CLEAR fieldcat.
  171.   fieldcat-tabname = 'ITAB_OUTPUT'.
  172.   fieldcat-fieldname = 'GMNGA_BWM_LJ'.
  173.   fieldcat-col_pos   = 10.               " Position on screen
  174.   fieldcat-seltext_l = '变温室累计完成'.
  175.   fieldcat-outputlen = 10.
  176.   APPEND fieldcat.

  177.   CLEAR fieldcat.
  178.   fieldcat-tabname = 'ITAB_OUTPUT'.
  179.   fieldcat-fieldname = 'LABST_BWM'.
  180.   fieldcat-col_pos   = 11.               " Position on screen
  181.   fieldcat-seltext_l = '变温室结存'.
  182.   fieldcat-outputlen = 10.
  183.   APPEND fieldcat.

  184.   CLEAR fieldcat.
  185.   fieldcat-tabname = 'ITAB_OUTPUT'.
  186.   fieldcat-fieldname = 'GMNGA_CZHXT'.
  187.   fieldcat-col_pos   = 12.               " Position on screen
  188.   fieldcat-seltext_l = '初装上楼当日完成'.
  189.   fieldcat-outputlen = 10.
  190.   APPEND fieldcat.

  191.   CLEAR fieldcat.
  192.   fieldcat-tabname = 'ITAB_OUTPUT'.
  193.   fieldcat-fieldname = 'GMNGA_CZHXT_LJ'.
  194.   fieldcat-col_pos   = 13.               " Position on screen
  195.   fieldcat-seltext_l = '初装上楼累计完成'.
  196.   fieldcat-outputlen = 10.
  197.   APPEND fieldcat.

  198.   CLEAR fieldcat.
  199.   fieldcat-tabname = 'ITAB_OUTPUT'.
  200.   fieldcat-fieldname = 'LABST_CZHXT'.
  201.   fieldcat-col_pos   = 14.               " Position on screen
  202.   fieldcat-seltext_l = '初装上楼结存'.
  203.   fieldcat-outputlen = 10.
  204.   APPEND fieldcat.

  205.   CLEAR fieldcat.
  206.   fieldcat-tabname = 'ITAB_OUTPUT'.
  207.   fieldcat-fieldname = 'GMNGA_ZZHXT'.
  208.   fieldcat-col_pos   = 15.               " Position on screen
  209.   fieldcat-seltext_l = '总装当日完成'.
  210.   fieldcat-outputlen = 10.
  211.   APPEND fieldcat.

  212.   CLEAR fieldcat.
  213.   fieldcat-tabname = 'ITAB_OUTPUT'.
  214.   fieldcat-fieldname = 'GMNGA_ZZHXT_LJ'.
  215.   fieldcat-col_pos   = 16.               " Position on screen
  216.   fieldcat-seltext_l = '总装累计完成'.
  217.   fieldcat-outputlen = 10.
  218.   APPEND fieldcat.

  219.   CLEAR fieldcat.
  220.   fieldcat-tabname = 'ITAB_OUTPUT'.
  221.   fieldcat-fieldname = 'LABST_ZZHXT'.
  222.   fieldcat-col_pos   = 17.               " Position on screen
  223.   fieldcat-seltext_l = '总装结存'.
  224.   fieldcat-outputlen = 10.
  225.   APPEND fieldcat.

  226.   CLEAR fieldcat.
  227.   fieldcat-tabname = 'ITAB_OUTPUT'.
  228.   fieldcat-fieldname = 'GMNGA_ZJ'.
  229.   fieldcat-col_pos   = 18.               " Position on screen
  230.   fieldcat-seltext_l = '成品入库当日完成'.
  231.   fieldcat-outputlen = 10.
  232.   APPEND fieldcat.

  233.   CLEAR fieldcat.
  234.   fieldcat-tabname = 'ITAB_OUTPUT'.
  235.   fieldcat-fieldname = 'GMNGA_ZJ_LJ'.
  236.   fieldcat-col_pos   = 19.               " Position on screen
  237.   fieldcat-seltext_l = '成品入库累计完成'.
  238.   fieldcat-outputlen = 10.
  239.   APPEND fieldcat.

  240.   CLEAR fieldcat.
  241.   fieldcat-tabname = 'ITAB_OUTPUT'.
  242.   fieldcat-fieldname = 'LABST_ZJ'.
  243.   fieldcat-col_pos   = 20.               " Position on screen
  244.   fieldcat-seltext_l = '成品入库结存'.
  245.   fieldcat-outputlen = 10.
  246.   APPEND fieldcat.

  247.   CLEAR fieldcat.
  248.   fieldcat-tabname = 'ITAB_OUTPUT'.
  249.   fieldcat-fieldname = 'SLJHC'.
  250.   fieldcat-col_pos   = 21.               " Position on screen
  251.   fieldcat-seltext_l = '上楼冰箱与计划差'.
  252.   fieldcat-outputlen = 10.
  253.   APPEND fieldcat.

  254.   CLEAR fieldcat.
  255.   fieldcat-tabname = 'ITAB_OUTPUT'.
  256.   fieldcat-fieldname = 'BZJHC'.
  257.   fieldcat-col_pos   = 22.               " Position on screen
  258.   fieldcat-seltext_l = '包装入库冰箱与计划差'.
  259.   fieldcat-outputlen = 10.
  260.   APPEND fieldcat.

  261.   CLEAR fieldcat.
  262.   fieldcat-tabname = 'ITAB_OUTPUT'.
  263.   fieldcat-col_pos   = 23.               " Position on screen
  264.   fieldcat-fieldname = 'GMNGA_ZJ1'.
  265.   fieldcat-seltext_l = '生产计划已完成数'.
  266.   fieldcat-outputlen = 10.
  267.   APPEND fieldcat.
  268.   ENDFORM.                    " GET_FIELDCAT

  269. *&---------------------------------------------------------------------*
  270. *&      Form  EVENTTAB_BUILD
  271. *&---------------------------------------------------------------------*
  272. *       text
  273. *----------------------------------------------------------------------*
  274. *      <--P_GT_EVENTS  text
  275. *----------------------------------------------------------------------*
  276. FORM eventtab_build CHANGING p_events TYPE slis_t_event.
  277.   DATA l_event TYPE LINE OF  slis_t_event.
  278.   CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
  279.     EXPORTING
  280.       i_list_type     = 0
  281.     IMPORTING
  282.       et_events       = p_events
  283.     EXCEPTIONS
  284.       list_type_wrong = 1
  285.       OTHERS          = 2.
  286.   IF sy-subrc <> 0.
  287. *    message id sy-msgid type sy-msgty number sy-msgno
  288. *            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  289.   ENDIF.
  290.   READ TABLE p_events INTO l_event WITH KEY name = 'AFTER_LINE_OUTPUT'.
  291.   eventcat-name  = l_event-name.
  292.   eventcat-form = 'AFTER_LINE_OUTPUT'.
  293.   APPEND eventcat.
  294.   READ TABLE p_events INTO l_event WITH KEY name = 'TOP_OF_PAGE'.
  295.   eventcat-name  = l_event-name.
  296.   eventcat-form = 'F_TOP_OF_PAGE'.
  297.   APPEND eventcat.
  298. ENDFORM.                    " EVENTTAB_BUILD
  299. *&--------------------------------------------------------------------*
  300. *&      Form  AFTER_LINE_OUTPUT
  301. *&--------------------------------------------------------------------*
  302. *   输出ALV的表头,手动配置这些
  303. *---------------------------------------------------------------------*
  304. FORM after_line_output USING gs_lineinfo TYPE slis_lineinfo.
  305.   DATA i TYPE i.
  306.   DATA: d(394) TYPE c .
  307.   DATA: l_line(398) TYPE c.
  308.   DATA: tmp_size TYPE i.
  309.   DESCRIBE FIELD d OUTPUT-LENGTH i.
  310.   IF  gs_lineinfo-tabindex = 1.
  311.     MODIFY LINE 1 LINE VALUE FROM  sy-uline(gs_lineinfo-linsz).
  312.     CLEAR l_line.
  313.     WRITE sy-vline TO l_line+0.
  314.     WRITE sy-vline TO l_line+12.
  315.     WRITE sy-vline  TO l_line+23.
  316.     WRITE '门体发泡完成' TO l_line+33.
  317.     WRITE sy-vline  TO l_line+122.
  318.     WRITE '初装上楼完成'  TO l_line+123.
  319.     WRITE sy-vline  TO l_line+155.
  320.     WRITE '总装完成'  TO l_line+156.
  321.     WRITE sy-vline TO l_line+188.
  322.     WRITE '成品入库'  TO l_line+189.
  323.     WRITE sy-vline TO l_line+221.
  324.     WRITE sy-vline TO l_line+232.
  325.     WRITE sy-vline TO l_line+243.
  326.     WRITE sy-vline TO l_line+254.
  327.     MODIFY LINE 2 LINE VALUE FROM l_line(gs_lineinfo-linsz).
  328.     CLEAR l_line.
  329.     WRITE sy-vline     TO l_line+0.
  330.     WRITE sy-vline TO l_line+12.
  331.     WRITE sy-vline  TO l_line+23.
  332.     tmp_size = gs_lineinfo-linsz - 24.
  333.     WRITE sy-uline TO l_line+24(tmp_size).
  334.     WRITE '上楼冰箱'  TO l_line+222.
  335.     WRITE sy-vline TO l_line+232.
  336.     WRITE '包装入库'  TO l_line+233.
  337.     WRITE sy-vline TO l_line+243.
  338.     WRITE '生产计划'  TO l_line+244.
  339.     WRITE sy-vline TO l_line+254.
  340.     MODIFY LINE 3 LINE VALUE FROM l_line(gs_lineinfo-linsz).
  341.     CLEAR l_line.
  342.     WRITE sy-vline TO l_line+0.
  343.     WRITE '产品型号' TO l_line+1.
  344.     WRITE sy-vline TO l_line+12.
  345.     WRITE '月计划合计' TO l_line+13.
  346.     WRITE sy-vline  TO l_line+23.
  347.     WRITE '冷藏门' TO l_line+24.
  348.     WRITE sy-vline TO l_line+56.
  349.     WRITE '冷冻门' TO l_line+57.
  350.     WRITE sy-vline  TO l_line+89.
  351.     WRITE '变温室'  TO l_line+90.
  352.     WRITE sy-vline  TO l_line+122.
  353.     WRITE sy-vline  TO l_line+133.
  354.     WRITE sy-vline  TO l_line+144.
  355.     WRITE sy-vline  TO l_line+155.
  356.     WRITE sy-vline  TO l_line+166.
  357.     WRITE sy-vline  TO l_line+177.
  358.     WRITE sy-vline TO l_line+188.
  359.     WRITE sy-vline TO l_line+199.
  360.     WRITE sy-vline TO l_line+210.
  361.     WRITE sy-vline TO l_line+221.
  362.     WRITE '与计划差'  TO l_line+222.
  363.     WRITE sy-vline TO l_line+232.
  364.     WRITE '冰箱与'  TO l_line+233.
  365.     WRITE sy-vline TO l_line+243.
  366.     WRITE '已完成数'  TO l_line+244.
  367.     WRITE sy-vline TO l_line+254.
  368.     MODIFY LINE 4 LINE VALUE FROM l_line(gs_lineinfo-linsz).
  369.     CLEAR l_line.
  370.     WRITE sy-vline     TO l_line+0.
  371.     WRITE sy-vline TO l_line+12.
  372.     WRITE sy-vline  TO l_line+23.
  373.     tmp_size = gs_lineinfo-linsz - 24.
  374.     WRITE sy-uline TO l_line+24(tmp_size).
  375.     WRITE '当日完成'  TO l_line+123.
  376.     WRITE sy-vline  TO l_line+133.
  377.     WRITE  '累计完成' TO l_line+134.
  378.     WRITE sy-vline  TO l_line+144.
  379.     WRITE  '结存' TO l_line+145.
  380.     WRITE sy-vline  TO l_line+155.
  381.     WRITE  '当日完成' TO l_line+156.
  382.     WRITE sy-vline  TO l_line+166.
  383.     WRITE  '累计完成' TO l_line+167.
  384.     WRITE sy-vline  TO l_line+177.
  385.     WRITE  '结存' TO l_line+178.
  386.     WRITE sy-vline TO l_line+188.
  387.     WRITE  '当日完成' TO l_line+189.
  388.     WRITE sy-vline TO l_line+199.
  389.     WRITE  '累计完成' TO l_line+200.
  390.     WRITE sy-vline TO l_line+210.
  391.     WRITE  '结存' TO l_line+211.
  392.     WRITE sy-vline TO l_line+221.
  393.     WRITE sy-vline TO l_line+232.
  394.     WRITE '计划差'  TO l_line+233.
  395.     WRITE sy-vline TO l_line+243.
  396.     WRITE sy-vline TO l_line+254.
  397.     MODIFY LINE 5 LINE VALUE FROM l_line(gs_lineinfo-linsz).
  398.     CLEAR l_line.
  399.     WRITE sy-vline     TO l_line+0.
  400.     WRITE sy-vline TO l_line+12.
  401.     WRITE sy-vline  TO l_line+23.
  402.     WRITE  '当日完成' TO l_line+24.
  403.     WRITE sy-vline  TO l_line+34.
  404.     WRITE  '累计完成' TO l_line+35.
  405.     WRITE sy-vline  TO l_line+45.
  406.     WRITE  '结存' TO l_line+46.
  407.     WRITE sy-vline  TO l_line+56.
  408.     WRITE  '当日完成' TO l_line+57.
  409.     WRITE sy-vline  TO l_line+67.
  410.     WRITE  '累计完成' TO l_line+68.
  411.     WRITE sy-vline  TO l_line+78.
  412.     WRITE  '结存' TO l_line+79.
  413.     WRITE sy-vline  TO l_line+89.
  414.     WRITE  '当日完成' TO l_line+90.
  415.     WRITE sy-vline  TO l_line+100.
  416.     WRITE  '累计完成' TO l_line+101.
  417.     WRITE sy-vline  TO l_line+111.
  418.     WRITE  '结存' TO l_line+112.
  419.     WRITE sy-vline  TO l_line+122.
  420. *    tmp_size = gs_lineinfo-linsz - 24.
  421. *    write sy-uline to l_line+24(tmp_size).
  422.     WRITE sy-vline  TO l_line+133.
  423.     WRITE sy-vline  TO l_line+144.
  424.     WRITE sy-vline  TO l_line+155.
  425.     WRITE sy-vline  TO l_line+166.
  426.     WRITE sy-vline  TO l_line+177.
  427.     WRITE sy-vline TO l_line+188.
  428.     WRITE sy-vline TO l_line+199.
  429.     WRITE sy-vline TO l_line+210.
  430.     WRITE sy-vline TO l_line+221.
  431.     WRITE sy-vline TO l_line+232.
  432.     WRITE sy-vline TO l_line+243.
  433.     WRITE sy-vline TO l_line+254.
  434.     MODIFY LINE 6 LINE VALUE FROM l_line LINE FORMAT COLOR OFF.
  435.   ENDIF.
  436. ENDFORM.                    "AFTER_LINE_OUTPUT
  437. *&--------------------------------------------------------------------*
  438. *&      Form  F_TOP_OF_PAGE
  439. *&--------------------------------------------------------------------*
  440. *     给ALV表头输出预留行空间
  441. *---------------------------------------------------------------------*
  442. FORM f_top_of_page.
  443.   WRITE : / sy-uline,
  444.           / sy-uline,
  445.           / sy-uline,
  446.           / sy-uline.
  447. ENDFORM.                    "F_TOP_OF_PAGE
  448. *&---------------------------------------------------------------------*
  449. *&      Form  input_data
  450. *&---------------------------------------------------------------------*
  451. *       text
  452. *----------------------------------------------------------------------*
  453. *  测试用
  454. *----------------------------------------------------------------------*
  455. FORM input_data .
  456.   itb_output-maktx = 'BCD-108A' .
  457.   itb_output-plnmg_f_m = 1000 .
  458.   itb_output-gmnga_czhxt = 380 .
  459.   itb_output-gmnga_zj = 200 .
  460.   itb_output-bzjhc = '10'.
  461.   itb_output-gmnga_zj1 = '100'.
  462.   APPEND itb_output .
  463. ENDFORM.                    " input_data
复制代码


执行效果
alv list 实现alv多表头.png
回复

使用道具 举报

快速回帖

本版积分规则
您需要登录后才可以回帖 登录 | 注册有礼

快速回复 返回顶部 返回列表