之前写过一个利用 I_CALLBACK_HTML_TOP_OF_PAGE 实现的



(http://blog.sina.com.cn/s/blog_c0978c9b0101mg0j.html)



那个可以使用css进行布局等。



简单的可以直接使用 I_CALLBACK_TOP_OF_PAGE 这个参数





效果:



ALV—TOP_OF_PAGE:I_CALLBACK_TOP_OF_PAGE_java

​​



主要代码:



DATA: G_GRID_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.



DATA: GT_FIELDCAT  TYPE  SLIS_T_FIELDCAT_ALV .



DATA: G_FIELDCAT   LIKE  LINE OF GT_FIELDCAT.





  "调用函数
   CALL  FUNCTION  'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
      I_DEFAULT               =  'X'
      I_SAVE                  =  'X'
      I_CALLBACK_PROGRAM      = SY -REPID  “当前程序
      I_CALLBACK_TOP_OF_PAGE  =  'FRM_COMMENT_BUILD'
      IS_LAYOUT               = L_LAYOUT
      IT_FIELDCAT             = GT_FIELDCAT[]
     TABLES
      T_OUTTAB                = GT_DATA[]
     EXCEPTIONS
      PROGRAM_ERROR           =  1
       OTHERS                  =  2 .





*&---------------------------------------------------------------------*
*&      Form  COMMENT_BUILD
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM FRM_COMMENT_BUILD .

  DATA: LS_LINE TYPE SLIS_LISTHEADER.
  CLEAR G_GRID_TOP_OF_PAGE[].
  CLEAR LS_LINE.
  LS_LINE-TYP  = 'H'.
  LS_LINE-INFO  = TEXT-T10."金陵分公司销售发票汇总表
  APPEND LS_LINE TO G_GRID_TOP_OF_PAGE.

* STATUS LINE: TYPE S
  CLEAR LS_LINE.
  LS_LINE-TYP  = 'S'.
  LS_LINE-KEY  = TEXT-T11."发票日期
  IF S_FKDAT-HIGH <> '00000000' .
    CONCATENATE TEXT-T16
                S_FKDAT-LOW+0(4) TEXT-T12 S_FKDAT-LOW+4(2) TEXT-T13
                S_FKDAT-LOW+6(2)  TEXT-T14
                 TEXT-T15
                S_FKDAT-HIGH(4) TEXT-T12 S_FKDAT-HIGH+4(2)  TEXT-T13
                S_FKDAT-HIGH+6(2)  TEXT-T14
                INTO LS_LINE-INFO  .
  ENDIF .
  IF S_FKDAT-HIGH = '00000000' .
    CONCATENATE S_FKDAT-LOW+0(4) TEXT-T12 S_FKDAT-LOW+4(2)  TEXT-T13
                S_FKDAT-LOW+6(2)  TEXT-T14
                INTO LS_LINE-INFO  .
  ENDIF .
  APPEND LS_LINE TO G_GRID_TOP_OF_PAGE.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      IT_LIST_COMMENTARY = G_GRID_TOP_OF_PAGE.
ENDFORM.                    " COMMENT_BUILD







比较简单



OO  alv的抬头加起来稍微麻烦点儿







欢迎关注订阅号:SAP学习记录 (SAPlearning )

PO <wbr><wbr>text <wbr><wbr>copy <wbr><wbr>rules <wbr><wbr>:copy <wbr><wbr>PR <wbr><wbr>item <wbr><wbr>text <wbr><wbr>to <wbr><wbr>PO