码迷,mamicode.com
首页 > 其他好文 > 详细

[代码]如何在ALV头中显示Logo图片-[REUSE_ALV_GRID_DISPLAY]

时间:2019-08-30 11:27:59      阅读:68      评论:0      收藏:0      [点我收藏+]

标签:amp   art   span   max   nat   tab   指定   screen   slide   

下面介绍如何在ALV头中显示Logo图片的方法,其中ALV是调用函数REUSE_ALV_GRID_DISPLAY创建的。详细步骤如下:

Tcode: OAER上载需要显示的LOGO图片,

输入Class name  ’PICTURERS‘,Class type以及Object key ‘ZLOGO‘,这个ZLOGO就是logo的标识,会在ALV程序中用到。

技术图片

运行后,双击screen上载logo

技术图片

输入描述,

技术图片

上载成功后会有如下提示信息:

技术图片

2, 例子代码

代码逻辑:

1,从SPFLI中抽取数据

2,调用REUSE_ALV_GRID_DISPLAY创建ALV,需要指定 i_callback_top_of_page参数

3,在回调函数top_of_page中,调用 REUSE_ALV_COMMENTARY_WRITE指定显示logo的object ID ‘ZLOGO‘.

完整代码如下:

REPORT ztest_alv_logo.
TYPE-POOLS: slis.
*----------------------------------------------------------------------*
*     Data Decalaration
*----------------------------------------------------------------------*
DATA: git_spfli TYPE TABLE OF spfli.
DATA: g_repid TYPE sy-repid.
DATA: git_listheader TYPE slis_t_listheader,
      gwa_listheader TYPE slis_listheader.
*----------------------------------------------------------------------*
*     START-OF-SELECTION
*----------------------------------------------------------------------*
START-OF-SELECTION.
  g_repid = sy-repid.

  SELECT * FROM spfli INTO TABLE git_spfli.

  PERFORM build_alv_header.

  CALL FUNCTION REUSE_ALV_GRID_DISPLAY
    EXPORTING
      i_callback_program     = g_repid
      i_callback_top_of_page = TOP_OF_PAGE
      i_structure_name       = SPFLI
    TABLES
      t_outtab               = git_spfli.

*&---------------------------------------------------------------------*
*&      Form  BUILD_ALV_HEADER
*&---------------------------------------------------------------------*
FORM build_alv_header .

*  Type H is used to display headers i.e. big font
  gwa_listheader-typ  = H.
  gwa_listheader-info =Flight Details.
  APPEND gwa_listheader TO git_listheader.
  CLEAR gwa_listheader.

*  Type S is used to display key and value pairs
  gwa_listheader-typ = S.
  gwa_listheader-key = Date : .
  CONCATENATE  sy-datum+6(2)
               sy-datum+4(2)
               sy-datum(4)
               INTO gwa_listheader-info
               SEPARATED BY /.
  APPEND gwa_listheader TO git_listheader.
  CLEAR gwa_listheader.

*  Type A is used to display italic font
  gwa_listheader-typ = A.
  gwa_listheader-key = Date    : .
  gwa_listheader-info =SAP ALV Report.
  APPEND gwa_listheader TO git_listheader.
  CLEAR gwa_listheader.

ENDFORM.                    " BUILD_ALV_HEADER
*&---------------------------------------------------------------------*
*&      Form  top_of_page
*&---------------------------------------------------------------------*
FORM top_of_page.

  CALL FUNCTION REUSE_ALV_COMMENTARY_WRITE
    EXPORTING
      it_list_commentary = git_listheader
      i_logo             = ZLOGO.  "LOGO object key 大写

ENDFORM.                    "top_of_page

3, 运行结果

技术图片

以上。

[代码]如何在ALV头中显示Logo图片-[REUSE_ALV_GRID_DISPLAY]

标签:amp   art   span   max   nat   tab   指定   screen   slide   

原文地址:https://www.cnblogs.com/datie/p/11433848.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!