SAP_ALV讲解

                                ALV知识

                                                Xiaogangh 

一、ALV相关概念

ALV――ABAP LISTVIEWER,这里我姑且称之为ABAP表单浏览器,用它可以标准化,简单化R/3系统中的表单,它可以提供给用户一个统一的表单格式以及用户接口。

ALV即能显示简单表单(SIMPLELIST)又能显示有序表单(SEQUENTIAL LIST):

●  简单表单(SIMPLE LIST)包含一系列不分层次的(NON-HIERARCHICAL),用户自定义的列。

●  层次表(即有序表SEQUENTIAL LIST)包含列表头以及它的子行,一个列表头的关键行能带出它下面的一些列项目(我们自己理解的时候可以想到BOM表的层次结构)。

●  我们还可以在简单表单以及关联表单中显示小计和总计

 

二、结合一个具体的实例来看ALV的功能

   首先我们看下图中的这个ALV的布局(这是一般ALV程序表单的典型布局):

根据上面对ALV的直观形象,下面将屏幕上的区域划分成几块,分别来解释它的作用:

1.快捷工具栏(如下图)

   细节按钮,你首先必须选中列表中的一行,然后点击它的话,就会弹出一个窗口,显示选中行的细节内容。(另外:你双击你要选择的行,也可以显示细节)

   按升序排列,首先选中一列,然后再点击它,就可以看到该列是按照升序重新排列。

   按降序排列,首先选中一列,然后再点击它,就可以看到该列是按照降序重新排列。

   设置过滤器,通过设置它可以达到筛选的目的,以列名称作为筛选的筛选标准,填入过滤器相应的标准值,然后就可以筛选出满足自己条件的记录。

   打印预览,点击它之后,就可以预览一下将要打印内容的布局情况。

   Microsoft Excel,调用MS的Excel到当前ALV的列表显示区域。(前提:必须安装了MS的Excel)

   字处理,字处理的相关设置。

   本地文件,将当前表单存储到本地机器上,有几种供选择的存储格式。

   邮件收件人,给系统内用户发邮件

   图形,点击它可以根据表单情况绘制相关图表。

   更改布局,点击它可以对表单中的列项目排列次序的互换,删减等。

   选择布局,从已经保存的布局中选择自己满意的布局。

   保存布局,对于自己满意的布局,可以通过点击它来将布局保存起来。

2.表单标题区

这个区域主要是用来显示一些抬头信息(总揽信息),类似于WORD中的页眉。我们在使用的时候根据需要来进行相关填写。

3.表单显示区

  这个区域主要是用来显示我们通过代码筛选出来的数据,相关的操作在下面的程序编写部分详细介绍。

三、程序的编写

1.在我们写ALV程序的时候,有一个类型组是肯定要用到的:

   TYPE-POOLSSLIS

   在这个类型组中有很多ALV的自定义数据类型以及结构化数据类型(通过TYPE来定义的),我们在写ALV表单的时候需要调用的。我们常用的几个有(蓝色部分):

 

I.对一个最简单的ALV表单(无标题区和页脚区),我们只需要定义下面几个

data: i_fieldcat_alvtype slis_t_fieldcat_alv with header line,

          i_layout type slis_layout_alv,   "alv的格式

          i_fieldcat type slis_fieldcat_alv

w_repid likesy-repid.

    它对应的start-of-selection中定义子函数如下:

    start-of-selection.

      perform getdata.      “从数据库中取数据到相应内表中

  perform layout_build.  “用于定义ALV表单的相关格式、属性

      perform fields. “用来定义表单中的各个列的相关信息,比如列名等

      perform display_data. “用来显示ALV表单

 

子函数定义如下:

      formlayout_build.

        i_layout-zebra = 'X'.

        i_layout-detail_popup = 'X'. “是否弹出详细信息窗口

        w_repid = sy-repid.    “程序为当前程序

        i_layout-f2code = '&ETA'.“设置触发弹出详细信息窗口的功能码,这里是双击

i_layout-no_vline             = 'X'.“这个用来设置列间隔线

        i_layout-colwidth_optimize    = 'X'. “优化列宽选项是否设置

        i_layout-detail_initial_lines = 'X'.

        i_layout-detail_titlebar      = '详细内容'. “设置弹出窗口的标题栏

endform.

 

     formfields.

        refresh i_fieldcat_alv.

        pos = 1.

        clear i_fieldcat.

 

        i_fieldcat-col_pos = pos.      “第几列

        i_fieldcat-fieldname = 'NUM'.

        i_fieldcat-seltext_l = '序号'.  “列名

        append i_fieldcat to i_fieldcat_alv.

 

        pos = pos + 1.

        i_fieldcat-col_pos       = pos.

        i_fieldcat-fieldname     = 'AUFNR'.

        i_fieldcat-seltext_l     = '生产订单'.

        append i_fieldcat to  i_fieldcat_alv.

  clear i_fieldcat.

        …………

      Endform.

    

     formdisplay_data.

       call function 'REUSE_ALV_GRID_DISPLAY'

         exporting

           i_callback_program  = w_repid   “当前程序

           i_save              = ''

           is_layout           = i_layout  “子函数layout_build填充的格式定义

           it_fieldcat         =i_fieldcat_alv[] “子函数fields填充的各列

         tables

           t_outtab            = head1.  “假设数据都在head1内表中

endform.

 

 

II.对一个稍微复杂一点的ALV表单(有标题区和页脚区),我们需要定义下面几个

 

data:  i_fieldcat_alv type slis_t_fieldcat_alv,

“用来存储我们将要在表单显示区域显示出来的表单的列名,每个列名对应的字段名以及列表头其他相关属性信息的数据类型

        i_fieldcat typeslis_fieldcat_alv,

        i_layout type slis_layout_alv.    “ALV的格式

data: i_events        type slis_t_event,

     i_event_exit    type slis_t_event_exit,

     i_list_comments type slis_t_listheader, “用来填充表单标题区域的数据类型

     i_excluding     type slis_t_extab.

data:

 w_variant          like disvariant,  "显示变式结构

 wx_variant         likedisvariant,

 w_variant_save(1)  type c,

 w_exit(1)          type c,

 w_user_specific(1) type c,

 w_callback_ucomm   type slis_formname,   "字符型

 w_print            type slis_print_alv,  "类型组

 w_layout           type slis_layout_alv, "类型组

 w_html_top_of_page type  slis_formname,  "字符型

 w_fieldcat_alv     like line ofi_fieldcat_alv,

 w_excluding        like line ofi_excluding,

 w_events           like line ofi_events,

 w_event_exit       like line ofi_event_exit,

  w_list_comments    like line of i_list_comments.

*===========================================================================*

initialization.

  performinit_variant.  “这个子函数很重要,没有它会出错

*-----------------------------------------*

它对应的start-of-selection中定义子函数如下:

start-of-selection.

 perform getdata.  “从数据库中取数据到相应内表中

 perform event_build.

 perform layout_build. “用于定义ALV表单的相关格式、属性

 perform fields.   “用来定义表单中的各个列的相关信息,比如列名等

 perform display_data.  “用来显示ALV表单

*-----------------------------------------*

子函数定义如下:(这里只定义前面文档没有提到的子函数,其他同名的请参考前面)

form init_variant.

 clear: w_variant.

 w_repid              = sy-repid.   “当前程序

 w_variant-report     = w_repid.

 w_variant-username   = sy-uname.

 w_variant_save       = 'A'. "All types

endform.

 

form event_build.

  callfunction 'REUSE_ALV_EVENTS_GET'

       exporting

            i_list_type = 0

      importing

           et_events   = i_events.

 

  readtable i_events

      with key name = slis_ev_top_of_page

      into w_events.

  ifsy-subrc = 0.

   move 'ALV_TOP_OF_PAGE' tow_events-form.  “将标题区数据赋值给W_EVENTS

   modify i_events from w_events index sy-tabix.

 endif.

 

  readtable i_events

      with key name = slis_ev_end_of_list

      into w_events.

  ifsy-subrc = 0.

   move 'ALV_END_OF_LIST' tow_events-form.“将页尾数据赋值给W_EVENTS

 

    modifyi_events from w_events index sy-tabix.

 endif.

 

  readtable i_events

      with key name = slis_ev_end_of_page

      into w_events.

  ifsy-subrc = 0.

   move 'ALV_END_OF_PAGE' tow_events-form. “将页脚区数据赋值给W_EVENTS

   modify i_events from w_events index sy-tabix.

 endif.

endform.

*-----------------------------------------*

form event_build子函数中黑体字部分对应的几个子函数,我们需要定义如下:

formalv_top_of_page.

 clear: i_list_comments[].

 

 w_list_comments-typ  = 'H'."H=Header, S=Selection, A=Action供选择

 w_list_comments-key  = ''.

 w_list_comments-info = 'XX汽车有限公司变速箱废品率报表'.

 append w_list_comments to i_list_comments.

 

 w_list_comments-typ  = 'S'. "H = Header, S = Selection, A = Action

 w_list_comments-key  = ''.

 concatenate '库位:' werks-low intowerks_t.

 w_list_comments-info = werks_t.

 append w_list_comments to i_list_comments.

 

 w_list_comments-typ  = 'S'. "H = Header, S = Selection, A = Action

 w_list_comments-key  = ''.

 concatenate '库位:' werks-low intowerks_t.

 w_list_comments-info = werks_t.

  appendw_list_comments to i_list_comments.

 

  callfunction 'REUSE_ALV_COMMENTARY_WRITE'

      exporting

           i_logo             ='ENJOYSAP_LOGO'

           it_list_commentary = i_list_comments.

endform.

 

formalv_end_of_list.

 clear: i_list_comments[].

 

 w_list_comments-typ = 'A'. "H = Header, S = Selection, A = Action

 w_list_comments-key = ''.

 w_list_comments-info = '页脚显示'.

 append w_list_comments to i_list_comments.

 

  callfunction 'REUSE_ALV_COMMENTARY_WRITE'

      exporting

           it_list_commentary = i_list_comments

           i_logo             = 'ENJOYSAP_LOGO'

            i_end_of_list_grid ='X'.

endform.

 

formalv_end_of_page.

  它的定义类似上面两个子函数的内容,这里不再赘述

endform.

*-----------------------------------------*

form display_data.

      call function 'REUSE_ALV_GRID_DISPLAY'

          exporting

*              i_background_id             ='SIWB_WALLPAPER'

                i_background_id             = 'SIWB_WALLPAPER'

                i_callback_program          = w_repid

                i_callback_html_top_of_page =w_html_top_of_page

*              i_structure_name            ='TRDIR'

                i_default                   = 'X'

                i_save                      = 'A'

                is_variant                  = w_variant

                is_layout                   = w_layout

*                i_callback_user_command     = w_callback_ucomm

                it_fieldcat                 = i_fieldcat_alv

                it_events                   = i_events

              it_event_exit               = i_event_exit

                it_excluding                = i_excluding

                is_print                    = w_print

*              i_screen_start_column       = 1

*              i_screen_start_line         = 1

*              i_screen_end_column         = 70

*              i_screen_end_line           = 30

          tables

                t_outtab                    = head1.

endform.

 

 

 

 

 

 

2.写一个ALV程序的基本流程(主要包括ALV相关的那部分,后面会附上一个ALV源程序的代码):

   第一步:定义将要用到的表,即TALBES定义部分,然后定义TYPE-POOLS: SLIS.

   第二步:定义“1”中提到的这些数据类型或者内表的实体对象      

   第三步:定义一些需要用到的变量

   第四步: 定义自己的选择屏幕

   第五步: 定义INITIALIZATION部分,在这个部分往往要指定w_repid的值,

            w_repid = sy-repid。

   第六步:start-of-selection部分

            1用一个子函数完成对ALV表单标题区域的赋值(i_list_comments)。

            2用一个子函数完成自己所需要数据的抓取

            3用一个子函数完成要显示列表的列名行(第一行)的相关赋值(i_fieldcat_alv)以及设置

            4用一个子函数完成输出格式的设置(i_layout),比如双击一条记录是否弹出对话框啊?是用哪个功能键触发等等

            5用一个子函数FORM DISPLAY_DATA来显示上面我们已经分别封装好的数据,需要调用两个常用的FUNCTION MODULE:

               FUNCTION'REUSE_ALV_GRID_DISPLAY'    “用来显示表单数据

               FUNCTION'REUSE_ALV_COMMENTARY_WRITE'  “用来显示表单标题

      

 

附件: 示例程序源代码(注:下面这个程序调用的ALV功能应该讲是比较完全的了,大家可以通过上面的学习之后,再看这个程序,应该会有所收获)

*----------------------------------------------------------------------

* Program: ZZ_ALV_REPORT_STUB

* Author : Clayton Mergen

* Date  :

*

* Purpose: Report using ALV function

*

* Notes:

* 1) Logos & wallpapers can be found intable BDS_CONN05

*   with class = PICTURES

*

* 2) Transaction OAER can be used to createPICTURES.

*    Runtransaction OAER with class name = PICTURES, Class type = OT,

*    andObject key with whatever name you want to create.  In the

*   next screen, right clicking on screen and import

*

*----------------------------------------------------------------------

*                              Revisions

*----------------------------------------------------------------------

* Name   :

* Date   :

* Comments:

*----------------------------------------------------------------------

report zflex004

      no standard page heading

      line-size 200

      line-count 65

      message-id zz.

 

*--------------------------------

* Tables

*--------------------------------

tables:

  ekpo,

  mara,

 trdir.

*--------------------------------

* Global Types

*--------------------------------

type-pools: slis.

*--------------------------------

* Global Internal Tables

*--------------------------------

data:

 i_fieldcat_alv  typeslis_t_fieldcat_alv,

 i_events        type slis_t_event,

 i_event_exit    typeslis_t_event_exit,

 i_list_comments type slis_t_listheader,

 i_excluding     type slis_t_extab.

 

* Display data

data: begin of i_data occurs 0,

         matnr like mara-matnr,

         mtart like mara-mtart,

     end of i_data.

 

*--------------------------------

* Global Variables

*--------------------------------

data:

 w_variant          likedisvariant,  "显示变式结构

 wx_variant         likedisvariant,

 w_variant_save(1)  type c,

 w_exit(1)          type c,

 w_repid            likesy-repid,  "abap程序,当前主程序

 w_user_specific(1) type c,

 w_callback_ucomm   typeslis_formname,   "字符型

 w_print            typeslis_print_alv,  "类型组

 w_layout           typeslis_layout_alv, "类型组

 w_html_top_of_page type slis_formname,  "字符型

 w_fieldcat_alv     like line ofi_fieldcat_alv,

 w_excluding        like line ofi_excluding,

 w_events           like line ofi_events,

 w_event_exit       like line ofi_event_exit,

 w_list_comments    like line ofi_list_comments.

 

*--------------------------------

* Global Constants

*--------------------------------

*constants:

 

*--------------------------------

* Selection Screen

*--------------------------------

selection-screen begin of block blk_criteriawith frame title text-f01.

select-options:

 s_name for trdir-name.                "程序名

selection-screen end of block blk_criteria.

 

selection-screen begin of block blk_paramswith frame title text-f02.

parameters:

 p_vari like disvariant-variant.   "格式

selection-screen skip 1.

parameters:

 p_grid radiobutton group rb01 default 'X',

  p_htmlas checkbox.

selection-screen skip 1.

parameters:

 p_list radiobutton group rb01.

selection-screen end of block blk_params.

 

*--------------------------------

* Initialization

*--------------------------------

initialization.

 perform init_variant.   "初始化

 perform variant_default using p_vari.

 

 clear: s_name[].

 s_name-sign   = 'I'.

 s_name-option = 'CP'.

 s_name-low    = 'Z*'.

 append s_name.

 

*--------------------------------

* At Selection Screen PBO

*--------------------------------

at selection-screen output.

 

*----------------------------------

* At Selection Screen Value Request

*----------------------------------

at selection-screen on value-request forp_vari.

 perform variant_f4 using p_vari. "不管

 

*--------------------------------

* At Selection Screen

*--------------------------------

at selection-screen.

 perform variant_fill.   "不管

 

*--------------------------------

* Start of Selection

*--------------------------------

start-of-selection.

 perform get_data.  "从表mara中取相应字段到i_data

 

end-of-selection.

 perform fieldcat_build.

 perform event_build.

 perform event_exit_build.

 perform exclude_build.

 perform print_build.

 perform layout_build.

 perform display_data.

 

*--------------------------------

* Top of Page

*--------------------------------

top-of-page.

 

*--------------------------------

* Top of Page During Line Sel

*--------------------------------

top-of-page during line-selection.

 

*--------------------------------

* At User Command

*--------------------------------

at user-command.

*--------------------------------

* At Line Selection

*--------------------------------

at line-selection.

 

*--------------------------------

* Macros

*--------------------------------

 define skip_1.

   write: /001 sy-vline,

               at sy-linsz sy-vline.

 end-of-definition.

 

*----------------------------------------------------------------------

*                                 Forms

*----------------------------------------------------------------------

*&---------------------------------------------------------------------*

*&     Form  variant_f4

*&---------------------------------------------------------------------*

form variant_f4 using p_variant.

 

  callfunction 'LVC_VARIANT_F4'

      exporting

           is_variant    = w_variant

           i_save        = w_variant_save

      importing

           e_exit        = w_exit

           es_variant    = wx_variant

      exceptions

           not_found     = 1

           program_error = 2

           others        = 3.

 

  ifsy-subrc <> 0.

   message i000(zz) with text-g01.

 endif.

 

  ifw_exit is initial.

   w_variant-variant = wx_variant-variant.

   p_variant         =wx_variant-variant.

 endif.

 

endform.

*&---------------------------------------------------------------------*

*&     Form  init_variant

*&---------------------------------------------------------------------*

form init_variant.

 

 clear: w_variant.

 w_repid              = sy-repid.

 w_variant-report     = w_repid.

 w_variant-username   = sy-uname.

 w_variant_save       = 'A'."All types

 

endform.

*&---------------------------------------------------------------------*

*&     Form  variant_default

*&---------------------------------------------------------------------*

form variant_default using p_variant.

 

 wx_variant = w_variant.

 

  ifnot p_variant is initial.

   wx_variant-variant = p_variant.

 endif.

 

  callfunction 'LVC_VARIANT_DEFAULT_GET'

      exporting

           i_save        = w_variant_save

      changing

           cs_variant    = wx_variant

      exceptions

           wrong_input   = 1

           not_found     = 2

           program_error = 3

           others        = 4.

 

  casesy-subrc.

   when 0.

     p_variant = wx_variant-variant.

   when 2.

     clear: p_variant.

 endcase.

 

endform.

*&---------------------------------------------------------------------*

*&     Form  variant_fill

*&---------------------------------------------------------------------*

form variant_fill.

 

 clear: w_variant.

 

  ifp_vari is initial.

   w_variant-variant = 'STANDARD'.

   w_variant-report  = w_repid.

  else.

 

   w_variant-variant = p_vari.

   w_variant-report  = w_repid.

 

   call function 'LVC_VARIANT_EXISTENCE_CHECK'

        exporting

             i_save     = w_variant_save

        changing

             cs_variant = w_variant

        exceptions

             others     = 01.

    ifsy-subrc ne 0.

     message i000(zz) with text-g02.

   endif.

 endif.

 

endform.

*&---------------------------------------------------------------------*

*&     Form  fieldcat_build

*&---------------------------------------------------------------------*

form fieldcat_build.

 

  callfunction 'REUSE_ALV_FIELDCATALOG_MERGE'

      exporting

           i_program_name     = w_repid

*          i_structure_name   = 'TRDIR'

           i_internal_tabname = 'I_DATA'

           i_inclname         = w_repid

      changing

           ct_fieldcat        =i_fieldcat_alv.

 

* Modify displayed fields

  loopat i_fieldcat_alv into w_fieldcat_alv.

    casew_fieldcat_alv-fieldname.

     when 'NAME'.

       w_fieldcat_alv-hotspot   = 'X'.

     when 'MYFIELD'.

       w_fieldcat_alv-checkbox  = 'X'.

       w_fieldcat_alv-seltext_s = 'MyChkBox'.

     when others.

   endcase.

 

   modify i_fieldcat_alv from w_fieldcat_alv.

 endloop.

 

endform.

*&---------------------------------------------------------------------*

*&     Form  display_data

*&---------------------------------------------------------------------*

form display_data.

 

 w_callback_ucomm   ='CALLBACK_UCOMM'.

 

  case'X'.

   when p_grid.

     if p_html = 'X'.

       w_html_top_of_page = 'HTML_TOP_OF_PAGE'.

     endif.

 

     call function 'REUSE_ALV_GRID_DISPLAY'

          exporting

*              i_background_id             ='SIWB_WALLPAPER'

                i_background_id             = 'SIWB_WALLPAPER'

                i_callback_program          = w_repid

                i_callback_html_top_of_page =w_html_top_of_page

*              i_structure_name            ='TRDIR'

               i_default                   = 'X'

                i_save                      = 'A'

                is_variant                  = w_variant

                is_layout                   = w_layout

                i_callback_user_command     = w_callback_ucomm

                it_fieldcat                 = i_fieldcat_alv

                it_events                   = i_events

                it_event_exit               = i_event_exit

                it_excluding                = i_excluding

                is_print                    = w_print

*              i_screen_start_column       = 1

*              i_screen_start_line         = 1

*              i_screen_end_column         = 70

*              i_screen_end_line           = 30

          tables

                t_outtab                    = i_data.

 

   when p_list.

     call function 'REUSE_ALV_LIST_DISPLAY'

          exporting

                i_background_id         = 'ALV_BACKGROUND'

                i_callback_program      = w_repid

               i_default               = 'X'

                i_save                  = 'A'

                is_variant              = w_variant

                is_layout               = w_layout

                i_callback_user_command =w_callback_ucomm

                it_fieldcat             = i_fieldcat_alv

                it_events               = i_events

                it_event_exit           = i_event_exit

                is_print                = w_print

          tables

                t_outtab                = i_data.

 endcase.

 

endform.

*---------------------------------------------------------------------*

*      FORM user_command                                             *

*---------------------------------------------------------------------*

form callback_ucomm  using r_ucomm like sy-ucomm

                           rs_selfield typeslis_selfield.

 

 message i000(zz) with r_ucomm.

 

  caser_ucomm.

   when '&IC1'.

     set parameter id 'RID' field rs_selfield-value.

     call transaction 'SE38'.

    whenothers.

 endcase.

 

endform.

*&---------------------------------------------------------------------*

*&     Form  get_data

*&---------------------------------------------------------------------*

form get_data.

 

 select *  from mara

        into corresponding fields of table i_data.

 

endform.

*---------------------------------------------------------------------*

*      FORM ALV_TOP_OF_PAGE                                          *

*---------------------------------------------------------------------*

form alv_top_of_page.

 

 clear: i_list_comments[].

 

 w_list_comments-typ  = 'H'."H=Header, S=Selection, A=Action

 w_list_comments-key  = ''.

 w_list_comments-info = 'Info 1'.

 append w_list_comments to i_list_comments.

 

 w_list_comments-typ  = 'A'. "H = Header, S = Selection, A = Action

 w_list_comments-key  = ''.

 w_list_comments-info = 'Begin of list'.

 append w_list_comments to i_list_comments.

 

  callfunction 'REUSE_ALV_COMMENTARY_WRITE'

      exporting

           i_logo             = 'ENJOYSAP_LOGO'

           it_list_commentary = i_list_comments.

 

endform.

*&---------------------------------------------------------------------*

*&     Form  event_build

*&---------------------------------------------------------------------*

form event_build.

 

  callfunction 'REUSE_ALV_EVENTS_GET'

      exporting

           i_list_type = 0

      importing

           et_events   = i_events.

 

  readtable i_events

      with key name = slis_ev_top_of_page

      into w_events.

  ifsy-subrc = 0.

    move 'ALV_TOP_OF_PAGE' to w_events-form.

   modify i_events from w_events index sy-tabix.

 endif.

 

  readtable i_events

      with key name = slis_ev_end_of_list

      into w_events.

  ifsy-subrc = 0.

   move 'ALV_END_OF_LIST' to w_events-form.

    modify i_events from w_events indexsy-tabix.

 endif.

 

  readtable i_events

      with key name = slis_ev_end_of_page

      into w_events.

  ifsy-subrc = 0.

   move 'ALV_END_OF_PAGE' to w_events-form.

   modify i_events from w_events index sy-tabix.

 endif.

 

endform.

*---------------------------------------------------------------------*

*      FORM alv_end_of_list                                          *

*---------------------------------------------------------------------*

form alv_end_of_list.

 

 clear: i_list_comments[].

 

 w_list_comments-typ = 'A'. "H = Header, S = Selection, A = Action

 w_list_comments-key = ''.

 w_list_comments-info = 'End of list'.

 append w_list_comments to i_list_comments.

 

  callfunction 'REUSE_ALV_COMMENTARY_WRITE'

      exporting

           it_list_commentary = i_list_comments

           i_logo             ='ZMYOBJECTKEY'

           i_end_of_list_grid = 'X'.

 

endform.

*---------------------------------------------------------------------*

*      FORM alv_end_of_page                                          *

*---------------------------------------------------------------------*

form alv_end_of_page.

 

endform.

*&---------------------------------------------------------------------*

*&     Form  print_build

*&---------------------------------------------------------------------*

form print_build.

 

 w_print-no_print_listinfos = 'X'.

 

endform.

*&---------------------------------------------------------------------*

*&     Form  layout_build

*&---------------------------------------------------------------------*

form layout_build.

 

 w_layout-zebra                ='X'.

 w_layout-no_vline             ='X'.

 w_layout-colwidth_optimize    ='X'.

 w_layout-detail_popup         ='X'.

 w_layout-detail_initial_lines = 'X'.

 w_layout-detail_titlebar      ='Detail Title Bar'.

 

endform.

*&---------------------------------------------------------------------*

*&     Form  event_exit_build

*&---------------------------------------------------------------------*

form event_exit_build.

 

 clear: i_event_exit[].

 

* Pick

 w_event_exit-ucomm  = '&ETA'.

 w_event_exit-before = ' '.

 w_event_exit-after  = 'X'.

 append w_event_exit to i_event_exit.

 

endform.

*---------------------------------------------------------------------*

*      FORM HTML_TOP_OF_PAGE                                         *

*---------------------------------------------------------------------*

form html_top_of_page using r_top type ref tocl_dd_document.

 

  data:

   text     type sdydo_text_element,

   s_table  type ref tocl_dd_table_element,

   col_key  type ref to cl_dd_area,

   col_info type ref to cl_dd_area,

   a_logo   type ref to cl_dd_area.

 

* Split TOP-Document

  callmethod r_top->vertical_split

           exporting split_area  = r_top

                      split_width = '30%'

           importing right_area  = a_logo.

 

* Fill TOP-Document

  callmethod r_top->add_text

           exporting text  = 'Example of aHeading'

           sap_style       = 'HEADING'.

 

  callmethod r_top->new_line.

  callmethod r_top->new_line.

  callmethod r_top->add_table

           exporting no_of_columns = 2

                      with_heading  = ' '

                      border        = '1'

           importing table         = s_table.

 

  callmethod s_table->add_column importing column = col_key.

  callmethod s_table->add_column importing column = col_info.

 

  text= 'A key value marked'.

  callmethod col_key->add_text

           exporting text         = text

                      sap_emphasis = 'Strong'.

 

  callmethod col_info->add_gap exporting width = 6.

 

  text= '600' .

  callmethod col_info->add_text

           exporting text      = text

                      sap_style = 'Key'.

 

  callmethod col_info->add_gap  exportingwidth = 3.

 

  text= 'Block brick units'.

  callmethod col_info->add_text exporting text = text.

 

  callmethod s_table->new_row.

 

  text= 'Storage Bin'.

  callmethod col_key->add_text

           exporting text         = text

                      sap_emphasis = 'Strong'.

 

  callmethod col_info->add_gap exporting width = 7.

 

  text= 'C-A-004'.

  callmethod col_info->add_text exporting text = text.

 

  callmethod s_table->new_row.

 

  text= 'Warehouse number' .

  callmethod col_key->add_text

           exporting text         = text

                      sap_emphasis = 'Strong'.

 

  callmethod col_info->add_gap  exportingwidth = 6.

 

  text= '200' .

  callmethod col_info->add_text

           exporting text      = text

                      sap_style = 'Success'.

 

  callmethod col_info->add_gap  exportingwidth = 3.

 

  text= 'marked success'.

  callmethod col_info->add_text exporting text = text.

 

  callmethod s_table->new_row.

 

  callmethod r_top->new_line.

  text= 'This last line is a comment in italics.'.

  callmethod r_top->add_text

           exporting text         = text

                      sap_emphasis ='EMPHASIS'.

 

  callmethod r_top->new_line.

  callmethod a_logo->add_picture

*          exporting picture_id = 'ZZTESTBMP'.

           exporting picture_id = 'ENJOYSAP_LOGO'.

 

endform.

*&---------------------------------------------------------------------*

*&     Form  exclude_build

*&---------------------------------------------------------------------*

form exclude_build.

 

 w_excluding = '&GRAPH'. "Graphic

 append w_excluding to i_excluding.

 

endform.                    " exclude_build

  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值