精华内容
下载资源
问答
  • ALV

    2019-03-01 16:34:23
    2008/01/13 砍刀于热百赛软件讲课文档 博文链接:https://jgtang82.iteye.com/blog/150827
  • [SAP ABAP开发技术总结]ALV详解(Fuction ALV 和OO ALV) 图文并茂,详细介绍了Fuction ALV 和OO ALV的相关开发 [SAP ABAP开发技术总结]ALV详解:Function ALV(一) [SAP ABAP开发技术总结]ALV详解:Function ALV...
  • SAP ALV 教程

    2018-09-06 23:29:47
    SAP系统ABAP开发 ALV 表格教程,包括LIST,DISPLAY显示方式,列宽调整。
  • OOALV常用功能完整简例,OO ALV常用功能完整简例 - OO ALV 常用功能完整简例(热键单击,双击,帮助,编辑,自定义工具条等)
  • NULL 博文链接:https://klg.iteye.com/blog/277008
  • SAP 标准屏幕ALV增强

    2018-02-05 13:44:58
    SAP 屏幕开发增强,标准屏幕中ALV增强的全过程,与其屏幕增强有区别
  • NULL 博文链接:https://klg.iteye.com/blog/277183
  • ABAP OOALV报表开发

    2018-06-30 20:20:31
    ABAP OOALV报表开发,定义变量,选择屏幕定义,创建类,调用函数
  • SAP OOALV

    2017-08-29 09:09:00
    SAP OOALV
  • "要显示alv内容的内表 DATA: BEGIN OF wa_out, matnr LIKE zewmt026-matnr, zbtype LIKE zewmt026-zbtype, zqty LIKE zewmt026-zqty, meins LIKE zewmt026-meins, zcdate LIKE zewmt026-zcdate, zctime LIKE ...
  • FALV-快速ALV网格 变更V 740.1.0.19 为create / create_by_copy方法和其他一些方法完成了重构。 尽可能为链接方法添加了返回参数。 解决了使用ZDEMO_FALV13时不出现网格的错误。 变更V 740.1.0.18 现在可以在...
  • 标准的ALVTREE下没有完全展开和完全合并数的标准功能按钮,需要自己添加自定义的完全展开和合并的功能。
  • MM_SAP中如何开启ME1M的ALV显示MM_SAP中如何开启ME1M的ALV显示MM_SAP中如何开启ME1M的ALV显示MM_SAP中如何开启ME1M的ALV显示
  • ALV导出excel时窜行

    2016-06-22 11:39:58
    ALV导出excel时窜行
  • ABAP OOALV

    2018-05-29 14:27:02
    SAP ABAP OOALV自学记录,适合刚接触ABAP的同学进行自学。
  • 多屏幕ALV ZCL_ALV_MULTI

    2021-12-10 02:05:18
    对于SAP的开发者来说,ALV大家并不陌生,这也可能是在开发的过程中接触最多的东西,到目前为止,本人用过的用于实现Alv的方式有以下几种:1. Function的alv:REUSE_A...

    对于SAP的开发者来说,ALV大家并不陌生,这也可能是在开发的过程中接触最多的东西,

    到目前为止,本人用过的用于实现Alv的方式有以下几种:

    1. Function的alv:  REUSE_ALV_GRID_DISPLAY

                                  REUSE_ALV_GRID_DISPLAY_LVC( 升级版 ) 增加了对于单元格的处理

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

        EXPORTING

          i_callback_program       = lv_repid

          is_variant               = ls_variant

          i_callback_pf_status_set = 'ALV_STATUS'

          i_callback_user_command  = 'USER_COMMAND'

          is_layout_lvc            = gs_layout

          it_fieldcat_lvc          = gt_field

        TABLES

          t_outtab                 = gt_data

        EXCEPTIONS

          program_error            = 1

          OTHERS                   = 2.

      IF sy-subrc <> 0.

    * Implement suitable error handling here

      ENDIF.     

    缺点:alv的事件处理相对麻烦一点,无法满足同时显示多个ALV的需求

    2. ooalv: cl_gui_alv_grid

           gcl_alv->set_table_for_first_display(

                EXPORTING

                  is_layout       = ls_layout

                  i_save          = 'A'

                  is_variant      = ls_variant

                CHANGING

                  it_outtab       = gt_head

                  it_fieldcatalog = lt_fcat ).

    3. salv  cl_salv_table

          TRY.

            cl_salv_table=>factory( IMPORTING r_salv_table = cl_salv

            CHANGING t_table = gt_data ).

          CATCH cx_salv_msg.

        ENDTRY.

    SALV可以像使用函数方式那样生成alv,不需要创建屏幕,而且可以在后台运行

    感觉更像是 ooalv的 的升级版

    4. Falv zcl_falv

    lcl_falv=>create( CHANGING ct_table = gt_data )-display( ).

    一个开源的ALV类,能够更加方便的实现一个ALV

    目前来说Falv是个人使用最多的一个是实现ALV的方式,更便捷,更快速

    但是以上的ALV都没有办法快速的实现一个多ALV的展示方法

    通常如果我们要展示一个上下屏,或者左右屏的alv都需要先创建一个屏幕

    在屏幕的PBO里使用类 cl_gui_custom_container 屏(需要在屏幕绘制控制区域)按需绘制好,然后跟alv做绑定

    或者cl_gui_docking_container来跟屏幕做关联生成一个存放alv的容器,再调用splliter的类来分割容器

    那有没有办法能够像上面的Falv一样能够快速的来生成多个ALV呢,经过一段时间的构思,它来了

          TRY.

              NEW zcl_alv_multi(

                it_mapping = VALUE #( ( objid = '1' tabname = 'GT_VBAK' )

                                                       ( objid = '2' tabname = 'GT_VBAP' ) )

                                                         iv_mode = '21' )->call_screen( ).

            CATCH zcx_alv_error INTO lcx.

          ENDTRY.

    像Falv一样能够快捷的实现一个多屏幕的ALV,通过 it_mapping 来构建 alv 跟内表的关联,通过iv_mode来实现alv的展示效果

    11 单屏

    12 横向两个alv 

    13 横向三个  

    21 纵向两个 

    31 纵向三个 依次类推

    而且,已经将alv的事件类继承进去,只需要在代码中创建一个cl_alv_event(必须要是这个名字,因为后边会从堆栈中查找该子类)的事件子类即可,通过类的属性objid来控制区分是第几个alv

    大部分的alv事件 F1 F4 双击 按钮 点击按钮后 修改单元格等事件都已涵盖,按需重定义方法即可,下面是demo程序的相关代码

    "事件类,只能使用cl_alv_event 来命名

    CLASS cl_alv_event DEFINITION INHERITING FROM zcl_alv_event_receiver.

      PUBLIC SECTION.

        METHODS double_click REDEFINITION."双击

        METHODS user_command REDEFINITION."点击按钮后

        METHODS toolbar REDEFINITION."按钮

        METHODS hotspot_click REDEFINITION."单击

        METHODS change_fieldcat REDEFINITION."更改fieldcat

    ENDCLASS.

    CLASS cl_alv_event IMPLEMENTATION.

    按钮事件在第一个alv中增加保存按钮 

      METHOD toolbar.

        DATA:ls_toolbar TYPE stb_button.

        DEFINE mar_toolbar.

          ls_toolbar-function   = &1.

          ls_toolbar-text       = &2.

          ls_toolbar-quickinfo  = &3.

          ls_toolbar-icon       = &4.

          APPEND ls_toolbar TO e_object->mt_toolbar .

          CLEAR ls_toolbar.

        END-OF-DEFINITION.

        CASE objid.

          WHEN '1'.

            mar_toolbar 'SAVE' '' '保存' icon_system_save.

          WHEN '2'.

          WHEN OTHERS.

        ENDCASE.

      ENDMETHOD.

      METHOD user_command.

        CASE e_ucomm.

          WHEN 'SAVE'. 

            MESSAGE '保存成功' TYPE 'I' DISPLAY LIKE 'S'.

            "如果是刷新当前的alv,只需要使用get_alv_grid即可

            TRY.

                refresh( get_alv_grid( ) ).

              CATCH zcx_alv_error INTO DATA(cx).

            ENDTRY.

        ENDCASE.

      ENDMETHOD.

    双击第一个alv的销售订单来过滤出第二个alv的销售订单行项目,double_click方法也已经进行代码封装,e_data就是当前双击行的内容

      METHOD double_click.

        CASE objid.

          WHEN '1'.

            "按照销售订单来过滤第二个alv

            ASSIGN e_data->* TO FIELD-SYMBOL(<ls_data>).

           这里使用filter的方式来过滤alv,调用set_filter即可按照字段来生成相关参数

            DATA(lt_filter) = set_filter( EXPORTING i_fields = VALUE #( ( name = 'VBELN' ) )

                                                    i_data   = e_data ).

          这里要刷新第二个alv,首先使用ge_alv_grid的方法获取到第二个alv,然后刷新即可

            TRY.

                get_alv_grid( '2' )->set_filter_criteria( lt_filter ).

                refresh( get_alv_grid( '2' ) ).

              CATCH zcx_alv_error INTO DATA(cx).

            ENDTRY.

        ENDCASE.

      ENDMETHOD.

    单击事件,单击第一个alv的vbeln 来跳转到va03 ,同doubleclick一样,直接使用e_data即可 

      METHOD hotspot_click.

        CASE objid.

          WHEN '1'.

            "单击vbeln来跳转到va03

            ASSIGN e_data->* TO FIELD-SYMBOL(<ls_data>).

            ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE <ls_data> TO FIELD-SYMBOL(<value>).

            CASE e_column_id-fieldname.

              WHEN 'VBELN'.

                SET PARAMETER ID 'AUN' FIELD <value>.

                CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

            ENDCASE.

        ENDCASE.

      ENDMETHOD.

     这里是设置alv的fieldcat,系统会自动根据内表生成fieldcat,这里只需要对ct_fcat的字段进行增删改即可

      METHOD change_fieldcat.

        LOOP AT ct_fcat ASSIGNING FIELD-SYMBOL(<ls_fcat>).

          CASE <ls_fcat>-fieldname.

            WHEN 'VBELN'.

              <ls_fcat>-hotspot = abap_true.

          ENDCASE.

        ENDLOOP.

      ENDMETHOD.

    layout由于基本上每个alv的使用方法一样,这里就没有重定义,使用的父类的,如果有需要也可以重定义

    ENDCLASS.

    START-OF-SELECTION.

      gt_vbak = VALUE #( ( vbeln = '1' erdat = sy-datum )

      ( vbeln = '2' erdat = sy-datum )

      ( vbeln = '3' erdat = sy-datum ) ).

      gt_vbap = VALUE #(

      ( vbeln = '1' posnr = '1' )

      ( vbeln = '1' posnr = '2' )

      ( vbeln = '1' posnr = '3' )

      ( vbeln = '2' posnr = '1' )

      ( vbeln = '2' posnr = '2' )

      ( vbeln = '3' posnr = '1' )

      ( vbeln = '3' posnr = '2' )

      ( vbeln = '3' posnr = '3' )

      ( vbeln = '3' posnr = '4' ) ).

      "调用alv展示

      " iv_mode  12  13代表 竖向 2/3 个alv, 21  31代表横向 2/3 个alv

      "系统会根据tcode自动获取tcode的描述作为标题,如果想指定,iv_title 给值即可

      CASE abap_true.

        WHEN p_1."单个屏幕

          TRY.

              NEW zcl_alv_multi(

                it_mapping = VALUE #( ( objid = '1' tabname = 'GT_VBAK' ) ) )->call_screen( ).

            CATCH zcx_alv_error INTO DATA(lcx).

          ENDTRY.

          "单个屏幕的也推荐使用falv

        WHEN p_2."多个屏幕

          TRY.

              NEW zcl_alv_multi(

                it_mapping = VALUE #( ( objid = '1' tabname = 'GT_VBAK' )

                ( objid = '2' tabname = 'GT_VBAP' ) )

                iv_mode = '21' )->call_screen( ).

            CATCH zcx_alv_error INTO lcx.

          ENDTRY.

        WHEN OTHERS.

      ENDCASE.

    实现效果如下

    278f5b7d2428cf55125f439b973b3ba8.png

    ALV事件类以及构建类

    7cf8055e21d084ba3f673dc324f8feba.png

    24226ba4509717808329984f23c6d6a7.png

    第一次发表公众号文章,排版不好,请见谅,话不多说,直接上安装包

    链接:https://pan.baidu.com/s/1lo1VV2ImsI06Hg0x0YPVRQ

    提取码,请关注后发送信息  我想要 进行获取,感谢!!!!

    如果你在使用中觉得好,请帮忙多多分享,如有使用BUG请公众号联系本人解决

    请使用abapgit进行安装,对于abapgit的介绍以及相关安装方法请参照下图连接博主氢氦的文章

    https://www.cnblogs.com/hhelibeb/p/7735421.html

    展开全文
  • ABAP OOALV学习文档

    2019-02-27 08:56:10
    ABAP OOALV报表开发,定义变量,选择屏幕定义,创建类,调用函数,是学习OOALV很不错的学习资料
  • ALV LIST列头合并实例

    2016-06-22 11:38:51
    ALV LIST列头合并实例
  • 公司项目中总结ALV,经过公司50多位新干班验证,小白一看就明白
  • SAP ABAP技术培训ALV.docx

    2020-09-09 20:27:09
    SAP abap技术培训文档,包括创建表,表的锁机制讲解,定义变量到ALV显示,包括调用函数显示和OO ALV,已经报表常用的语法
  • ALV & SMARTFORMS 并分页

    2019-03-20 01:15:53
    NULL 博文链接:https://sapabap.iteye.com/blog/764173
  • SAP: ALV WITH IDA 实例

    2021-05-14 14:29:56
    ALV WITH IDA 是一个可以调用外部视图展示的ALV,其功能也比ALV强大很多,复杂很多。 数据准备:创建一个外部视图 至于创建外部视图的方法,需要参考一些其它材料,这里就不再详细介绍了,主要还是看一下ALV WITH ...

    ALV WITH IDA 是一个可以调用外部视图展示的ALV,其功能也比ALV强大很多,复杂很多。
    数据准备:创建一个外部视图
    在这里插入图片描述
    至于创建外部视图的方法,需要参考一些其它材料,这里就不再详细介绍了,主要还是看一下ALV WITH IDA的实例

    *&---------------------------------------------------------------------*
    *& Report Z_ZHANGM_010
    *&---------------------------------------------------------------------*
    *&描述:ALV WITH IDA
    *&---------------------------------------------------------------------*
    REPORT z_zhangm_010.
    
    
    DATA: lo_alv_ida TYPE REF TO if_salv_gui_table_ida.
    DATA: lt_excluding_fcode TYPE if_salv_gui_types_ida=>yt_excluding_fcode.
    DATA: lt_para TYPE if_salv_gui_types_ida=>yt_parameter,
          ls_para LIKE LINE OF lt_para.
    
    DATA: lt_range             TYPE if_salv_service_types=>yt_named_ranges,
          ls_range             LIKE LINE OF lt_range,
          lo_cond              TYPE REF TO if_salv_ida_condition,
          lo_condition_factory TYPE REF TO if_salv_ida_condition_factory.
    *
    *PARAMETERS: P_PERIOD(6).
    
    INITIALIZATION.
    CLASS lcl_alv_fullscreen DEFINITION.
      PUBLIC SECTION.
        INTERFACES if_salv_ida_calc_field_handler .   "增加字段接口
        METHODS status_function_selected  "--------------------------------------------按钮响应
                      FOR EVENT function_selected OF if_salv_gui_fullscreen_ida
          IMPORTING ev_fcode.
        METHODS cell_action              "--------------------------------------------字段响应
                      FOR EVENT cell_action OF if_salv_gui_field_display_opt
          IMPORTING ev_field_name eo_row_data.
        METHODS double_click            "---------------------------------------------双击响应
                      FOR EVENT double_click OF if_salv_gui_table_display_opt
          IMPORTING ev_field_name eo_row_data.
      PRIVATE SECTION.
        TYPES:
          BEGIN OF ys_calc_field,     "附加字段
            add_field TYPE char10,
            icon      TYPE c LENGTH 4,
            button    TYPE lvc_value, "c length 4,
          END OF ys_calc_field .
        CONSTANTS mc_flag_fcode TYPE ui_func VALUE 'DO_NOTHING'.
    ENDCLASS.
    CLASS lcl_alv_fullscreen IMPLEMENTATION.
      METHOD cell_action.
    *   display field name of clicked field and line content for all fields
    
    *   get clicked line line
        TYPES: BEGIN OF lty_line.
            INCLUDE TYPE zv_calcu_08.
            INCLUDE TYPE ys_calc_field.
        TYPES: END   OF lty_line.
    
        DATA: ls_wa  TYPE lty_line.
        eo_row_data->get_row_data( EXPORTING iv_request_type = if_salv_gui_selection_ida=>cs_request_type-all_fields
                                   IMPORTING es_row =  ls_wa ).
    
        cl_salv_ida_show_data_row=>display( iv_text = 'CellActionEvent for field:'(001) && `    ` && ev_field_name
                                            is_data = ls_wa ).
      ENDMETHOD.
      METHOD double_click.
    *   display field name of double-clicked field and line content for all fields
    
    *   get double-clicked line and put into output
        DATA: ls_wa  TYPE zv_calcu_08.
        eo_row_data->get_row_data( EXPORTING iv_request_type = if_salv_gui_selection_ida=>cs_request_type-all_fields
                                   IMPORTING es_row =  ls_wa ).
    
        cl_salv_ida_show_data_row=>display( iv_text = 'DoubleClickEvent for field'(002) && `  ` && ev_field_name
                                            is_data = ls_wa ).
    
      ENDMETHOD.
      METHOD status_function_selected.
        CASE ev_fcode.
          WHEN mc_flag_fcode.
            MESSAGE i000(0k) WITH 'Own Status Item selected:'(003) ev_fcode.
          WHEN 'F03' OR 'F12' OR 'F15'.
            lo_alv_ida->fullscreen( )->exit( ).
        ENDCASE.
      ENDMETHOD.
      METHOD if_salv_ida_calc_field_handler~calculate_line.
    
        DATA ls_calc_field TYPE ys_calc_field.
        DATA ls_calcu    TYPE zv_calcu_08.
    
        ls_calcu = is_data_base_line.
    
        IF ls_calcu-zyar = '2016'.
          ls_calc_field-add_field = 'XX'.
        ENDIF.
    
        ls_calc_field-icon  = icon_yellow_light.
        ls_calc_field-button = '@02@'.
        es_calculated_fields = ls_calc_field.
    
      ENDMETHOD.
      METHOD if_salv_ida_calc_field_handler~get_calc_field_structure.
    *   define additional fields by returning the structure description
        DATA ls_calc_field TYPE ys_calc_field.
        ro_calc_field_structure ?= cl_abap_structdescr=>describe_by_data( ls_calc_field ).
      ENDMETHOD.
      METHOD if_salv_ida_calc_field_handler~get_requested_fields.
    
      ENDMETHOD.
      METHOD if_salv_ida_calc_field_handler~start_page.
    *   buffer which of the calculated fields are displayed
    *   --> later calculate values only for these fields to save performance
    *    mt_calc_field_name = its_calc_field_name.
      ENDMETHOD.
      METHOD if_salv_ida_calc_field_handler~end_page.
        "   do nothing.
      ENDMETHOD.
    ENDCLASS.
    
    START-OF-SELECTION.
      DATA: lo_calc_field_handler TYPE REF TO lcl_alv_fullscreen.
      CREATE OBJECT lo_calc_field_handler.
      lo_alv_ida = cl_salv_gui_table_ida=>create( iv_table_name         = 'ZV_CALCU_08'
                                                  io_calc_field_handler = lo_calc_field_handler ).
    
      "条纹
      lo_alv_ida->display_options( )->enable_alternating_row_pattern( ).
    
    ***--------------------------------GUI 状态-------------------------------------begin
      lo_alv_ida->fullscreen( )->set_pf_status(
              iv_pf_status_name        = 'STATUS_010'
              iv_program_name          = 'Z_ZHANGM_010'
              it_excluding_fcode       = lt_excluding_fcode
          ).
      SET HANDLER lo_calc_field_handler->status_function_selected FOR lo_alv_ida->fullscreen( ).
    ***--------------------------------GUI 状态-------------------------------------end
    
      TRY.
          CALL METHOD lo_alv_ida->set_select_options
            EXPORTING
              it_ranges    = lt_range
              io_condition = lo_cond.
        CATCH cx_salv_ida_associate_invalid .
        CATCH cx_salv_db_connection .
        CATCH cx_salv_ida_condition_invalid .
        CATCH cx_salv_ida_unknown_name .
      ENDTRY.
    ***------------------混合的条件-------------------------end
    
    ***------------------抬头标题---------------------------begin
      lo_alv_ida->field_catalog( )->set_field_header_texts(
      iv_field_name = 'ZQCKC'
      iv_header_text = '期初库存'
      iv_tooltip_text = '期初库存'
      iv_tooltip_text_long = 'Goods Receive Quanity'
    ) .
    
      lo_alv_ida->field_catalog( )->set_field_header_texts(
      iv_field_name = 'ZQMKC'
      iv_header_text = '期末库存'
      iv_tooltip_text = '期末库存'
      iv_tooltip_text_long = ''
    ) .
      lo_alv_ida->field_catalog( )->set_field_header_texts(
      iv_field_name = 'ZBUDAT'
      iv_header_text = '日期'
      iv_tooltip_text = '日期'
      iv_tooltip_text_long = ''
    ) .
      lo_alv_ida->field_catalog( )->set_data_element( iv_field_name        = 'MATNR'
                                                      iv_data_element_name = 'MATNR' ).
    ***------------------抬头标题---------------------------end
    
    ***---------------------------------------------排除字段------------------------------------------begin
    *  LO_ALV_IDA->FIELD_CATALOG( )->GET_ALL_FIELDS( IMPORTING ETS_FIELD_NAMES = DATA(LTS_FIELD_NAMES) ).
    *  DELETE LTS_FIELD_NAMES WHERE TABLE_LINE = 'WERKS'.
    *  LO_ALV_IDA->FIELD_CATALOG( )->SET_AVAILABLE_FIELDS( LTS_FIELD_NAMES ).
    ***---------------------------------------------排除字段------------------------------------------end
    
    
       LO_ALV_IDA->SET_MAXIMUM_NUMBER_OF_ROWS(  100 ).  "限制行数
    ***------------------------------------------------------------权限检查-----------------------------------------------------------begin
    *  DATA(LO_AUTHORIZATION_PROVIDER) = CL_SADL_COND_PROV_FACTORY_PUB=>CREATE_FOR_AUTHORIZATION( ).
    *  LO_AUTHORIZATION_PROVIDER->ADD_AUTHORIZATION_FOR_OBJECT( IV_AUTHORIZATION_OBJECT = 'M_BEST_WRK'
    *                                                           IT_ACTIVITIES           = VALUE #( ( AUTH_FIELD = 'ACTVT' VALUE = '03' ) )
    *                                                           IT_FIELD_MAPPING        = VALUE #( ( AUTH_FIELD = 'WERKS' VIEW_FIELD = 'WERKS' ) ) ).
    ****------------------------------------------------------------权限检查-----------------------------------------------------------end
    
      TRY.
          DATA: lts_icon_tooltip TYPE if_salv_gui_types_ida=>yts_icon_tooltip.
          INSERT VALUE #( icon    = icon_yellow_light
                          tooltip = 'Less than 10 seats free!'(004) ) INTO TABLE lts_icon_tooltip. "#EC NOTEXT
          INSERT VALUE #( icon    = icon_green_light
                          tooltip = 'Enough seats free...'(005) ) INTO TABLE lts_icon_tooltip. "#EC NOTEXT
          INSERT VALUE #( icon    = icon_red_light
                          tooltip = 'Sorry, no seats free anymore...'(006) ) INTO TABLE lts_icon_tooltip.
          lo_alv_ida->field_catalog( )->display_options( )->set_tooltip_for_icons( iv_field_name = 'ICON'
                                                                                         its_tooltips  = lts_icon_tooltip ).
          lo_alv_ida->field_catalog( )->set_field_header_texts( iv_field_name    = 'ICON'
                                                                iv_header_text   = 'Icon' ).
          lo_alv_ida->field_catalog( )->display_options( )->display_as_link_to_action( iv_field_name = 'ICON' ).
    
          lo_alv_ida->field_catalog( )->display_options( )->set_tooltip_for_icons( iv_field_name = 'BUTTON'
                                                                                     iv_use_standard_tooltip = abap_true ).
          lo_alv_ida->field_catalog( )->display_options( )->display_as_button( iv_field_name = 'BUTTON'
                                                                               iv_hide_if_value_is_initial = abap_true ).
          lo_alv_ida->field_catalog( )->set_field_header_texts( iv_field_name    = 'BUTTON'
                                                                iv_header_text   = 'Button' ).
    
          lo_alv_ida->field_catalog( )->set_field_header_texts( iv_field_name    = 'ADD_FIELD'
                                                                iv_header_text   = 'ADD_FIELD' ).
    
          SET HANDLER lo_calc_field_handler->cell_action FOR lo_alv_ida->field_catalog( )->display_options( ).
        CATCH cx_salv_ida_unknown_name INTO DATA(lr_ex).
          MESSAGE e000(salv_ida) WITH lr_ex->field_name.
      ENDTRY.
    
    ***------------------------------------双击事件----------------------------------begin
      lo_alv_ida->display_options( )->enable_double_click( ).
      SET HANDLER lo_calc_field_handler->double_click FOR lo_alv_ida->display_options( ).
    ***------------------------------------双击事件----------------------------------end
    
    
    ***--------------------------排序---------------------------------------------------------begin
      lo_alv_ida->default_layout(
                     )->set_sort_order( VALUE #( ( field_name = 'MATNR'  descending = abap_true ) ) ).
    ***--------------------------排序---------------------------------------------------------end
    
    
      lo_alv_ida->standard_functions( )->set_text_search_active( abap_true ).  "文本搜索
      lo_alv_ida->standard_functions( )->set_export_active( abap_false ).  "导出
    
      lo_alv_ida->fullscreen( )->display( ).
    

    展示结果:
    在这里插入图片描述

    展开全文
  • ALV导出数据到EXCEL时数据丢失位数的解决方法.doc
  • ALV程序模板

    2018-12-01 02:10:01
    ALV程序模板 
  • alvtree实现库存控制报表,主节点是成本物料,展开节点为组件物料,要求添加完全展开和合并功能源代码,方便查询库存明细
  • ALV包含:选择屏幕下拉框、选择屏幕禁止输入,红绿灯,ALV分页,跳转,打印,访问百度等等,这些功能会在多数场景中都会运用到。(文末附代码) 1、选择屏幕下拉框 2、分页显示(可现实上下页以及显示全部)...

    此ALV包含:选择屏幕下拉框、选择屏幕禁止输入,红绿灯,ALV分页,跳转,打印,访问百度等等,这些功能会在多数场景中都会运用到。(文末附代码)

    1、选择屏幕下拉框

     

     2、分页显示(可现实上下页以及显示全部)

     当前首页点击“上一页”

    当前尾页点击“下一页”

     显示全部:

     3、访问百度

    点击“访问百度”即会打开系统默认浏览器,此功能不便截图

    4、左键双击跳转

     5、点击打印(横向、纵向)

    纵向打印样式:

     横向打印样式:

     ——————————————————————————————————————————

    代码如下:

    *&---------------------------------------------------------------------*
    *& REPORT ZPX005
    *&---------------------------------------------------------------------*
    *& By QiRIC
    *&---------------------------------------------------------------------*
    REPORT ZPX005.
    
    TYPE-POOLS:SLIS,ICON.
    
    TABLES:MARA,MAKT,MARC,YTSCHOOL.
    
    DATA:GS_LAYOUT    TYPE LVC_S_LAYO,
         GT_FIELDCAT  TYPE TABLE OF LVC_S_FCAT,
         GS_FIELDCAT  TYPE LVC_S_FCAT,
         GT_FIELDCAT1 TYPE TABLE OF LVC_S_FCAT,
         GS_FIELDCAT1 TYPE LVC_S_FCAT.
    
    *DATA:GT_EVENTS TYPE SLIS_T_EVENT,
    *     GW_EVENTS TYPE SLIS_ALV_EVENT,
    *     GT_DDVAL  TYPE LVC_T_DROP,
    *     GW_DDVAL  TYPE LVC_S_DROP.
    
    TYPES:BEGIN OF TY_TAB,
            ZXH   TYPE INT4,       "序号
            MATNR TYPE MARA-MATNR, "物料号
            MAKTX TYPE MAKT-MAKTX, "物料描述
            MEINS TYPE MARA-MEINS, "计量单位
            MTART TYPE MARA-MTART, "物料类型
            MATKL TYPE MARA-MATKL, "物料组
            BISMT TYPE MARA-BISMT, "旧物料号
            MMSTA TYPE MARC-MMSTA, "特定工厂的物料状态
            SEL   TYPE C,          "选择
            STATU TYPE CHAR10,     "红绿灯
          END OF TY_TAB.
    
    "下拉框定义
    DATA:VID   TYPE VRM_ID,
         LIST  TYPE VRM_VALUES,
         VALUE LIKE LINE OF LIST.
    DATA:VID1   TYPE VRM_ID,
         LIST1  TYPE VRM_VALUES,
         VALUE1 LIKE LINE OF LIST.
    
    "红绿灯
    *DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
    
    DATA:GT_TAB TYPE TABLE OF TY_TAB,
            GS_TAB TYPE TY_TAB.
    DATA:GT_OUT TYPE TABLE OF TY_TAB WITH HEADER LINE.
    DATA:GT_MAKT TYPE TABLE OF MAKT,
             GS_MAKT TYPE MAKT.
    
    DATA:ZNUM TYPE INT4 VALUE 0. "循环变量
    DATA:ZSY TYPE INT4 VALUE 0,"每页最小号
             ZXY TYPE INT4 VALUE 1000. "每页最大号
    DATA:ZYS TYPE INT4 VALUE 1, "页数
            ZMSG TYPE CHAR8 . "页数信息
    
    "Baidu链接
    DATA:BEGIN OF URL_TABLE OCCURS 10,
      URL(200),
    END OF URL_TABLE.
    DATA:P_STR(200).
    
    "动态时钟
    DATA:GV_TEXT TYPE SMP_DYNTXT.
    
    DEFINE FILL_FIELD.
      CLEAR GS_FIELDCAT.
      GS_FIELDCAT-FIELDNAME     = &1.  "字段的名字(内表中定义的字段名)
      GS_FIELDCAT-SCRTEXT_L     = &2.  "字段的文本描述,输出时候显示。长描述
      GS_FIELDCAT-QFIELDNAME    = &3.  "计量单位字段名,例如如值EA对应的字段名
      GS_FIELDCAT-NO_ZERO       = &4.  "如果取值为零,则为空,既不输出零。
      GS_FIELDCAT-EDIT          = &5.  "当前列可编辑
      GS_FIELDCAT-REF_TABLE     = &6.  "该字段的参考表
      GS_FIELDCAT-REF_FIELD     = &7.  "该字段的参考字段
      GS_FIELDCAT-CHECKBOX      = &8.  "选择框
      GS_FIELDCAT-ICON          = 'X'.  "图标功能
      APPEND GS_FIELDCAT TO GT_FIELDCAT.
    END-OF-DEFINITION.
    DEFINE FILL_FIELD1.
      CLEAR GS_FIELDCAT1.
      GS_FIELDCAT1-FIELDNAME     = &1.  "字段的名字(内表中定义的字段名)
      GS_FIELDCAT1-SCRTEXT_L     = &2.  "字段的文本描述,输出时候显示。长描述
      GS_FIELDCAT1-QFIELDNAME    = &3.  "计量单位字段名,例如如值EA对应的字段名
      GS_FIELDCAT1-NO_ZERO       = &4.  "如果取值为零,则为空,既不输出零。
      GS_FIELDCAT1-EDIT          = &5.  "当前列可编辑
      GS_FIELDCAT1-REF_TABLE     = &6.  "该字段的参考表
      GS_FIELDCAT1-REF_FIELD     = &7.  "该字段的参考字段
      GS_FIELDCAT1-CHECKBOX      = &8.
      APPEND GS_FIELDCAT1 TO GT_FIELDCAT1.
    END-OF-DEFINITION.
    
    SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS:P_WERKS TYPE MARC-WERKS AS LISTBOX VISIBLE LENGTH 10 OBLIGATORY DEFAULT '1101', "工厂
               P_DAYIN TYPE CHAR2 AS LISTBOX VISIBLE LENGTH 8 OBLIGATORY DEFAULT '纵向'.
    SELECT-OPTIONS:
                    S_MTART FOR MARA-MTART,         "物料类型
                    S_MATKL FOR MARA-MATKL,         "物料组
                    S_MATNR FOR MARA-MATNR.       "物料号
    SELECTION-SCREEN:END OF BLOCK B1.
    
    INITIALIZATION.
    
    AT SELECTION-SCREEN OUTPUT.
    
    "输入框变灰,无法输入。仅适用于单选框
    *  LOOP AT SCREEN.
    *     IF SCREEN-NAME EQ 'P_WERKS'.
    *        SCREEN-INPUT = 0.
    *     ENDIF.
    *   MODIFY SCREEN.
    *  ENDLOOP.
    
      REFRESH LIST.
    
      VALUE-KEY = '横向' . "这个就是变量P_LIST的值
      VALUE-TEXT = '横向' . "这个是TEXT
      APPEND VALUE-TEXT TO LIST .
    
      VALUE-KEY = '纵向' .
      VALUE-TEXT = '纵向' .
      APPEND VALUE-TEXT TO LIST .
    
    **调用下拉框赋值函数
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          ID     = 'P_DAYIN'
          VALUES = LIST.
    
    
      REFRESH LIST1.
    
      VALUE1-KEY = '1101' . "这个就是变量P_LIST的值
      VALUE1-TEXT = '振华工厂' . "这个是TEXT
      APPEND VALUE1 TO LIST1.
    
      VALUE1-KEY = '1102' .
      VALUE1-TEXT = '楚藩工厂' .
      APPEND VALUE1 TO LIST1.
    
      VALUE1-KEY = '1103' .
      VALUE1-TEXT = '塑料管工厂' .
      APPEND VALUE1 TO LIST1.
    
    **调用下拉框赋值函数
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          ID     = 'P_WERKS'
          VALUES = LIST1.
    
    START-OF-SELECTION.
      PERFORM FRM_GET_DATA.
      IF GT_TAB IS INITIAL.
         MESSAGE '无搜索数据!' TYPE 'S' DISPLAY LIKE 'E'.
         EXIT.
      ENDIF.
      PERFORM FRM_DIS_DATA.
    
    END-OF-SELECTION.
    
    FORM FRM_GET_DATA.
      SELECT MARA~MATNR MARA~MEINS MARA~MTART MARA~MATKL MARA~BISMT
             MAKT~MAKTX
             MARC~MMSTA
        INTO CORRESPONDING FIELDS OF TABLE GT_TAB
        FROM MARC INNER JOIN MAKT ON MARC~MATNR = MAKT~MATNR
                  INNER JOIN MARA ON MAKT~MATNR = MARA~MATNR
          WHERE MARC~WERKS = P_WERKS
            AND MTART IN S_MTART
            AND MARA~MATNR IN S_MATNR
            AND MATKL IN S_MATKL.
    
      LOOP AT GT_TAB INTO GS_TAB.
        ZNUM = ZNUM + 1.
        GS_TAB-ZXH = ZNUM.
    
        "红绿灯判断赋值
        IF GS_TAB-MMSTA = 'OK'.
            GS_TAB-STATU = ICON_LED_GREEN.
          ELSEIF GS_TAB-MMSTA = 'Z1'.
            GS_TAB-STATU = ICON_LED_RED.
           ELSE.
            GS_TAB-STATU = ICON_LED_YELLOW.
        ENDIF.
    
        MODIFY GT_TAB FROM GS_TAB.
      ENDLOOP.
    
      GT_OUT[] = GT_TAB.
      DELETE GT_OUT[] WHERE ZXH > 1000.
    ENDFORM.
    
    FORM FRM_DIS_DATA.
      CLEAR:GS_LAYOUT.
      GS_LAYOUT-CWIDTH_OPT = 'X'. "自动优化列宽
    *  GS_LAYOUT-BOX_FNAME  = 'SEL'.
      GS_LAYOUT-ZEBRA = 'X'. "斑马线
      GS_FIELDCAT-FIELDNAME = 'SEL'.
      GS_FIELDCAT-CHECKBOX = 'X'.
      GS_FIELDCAT-EDIT     = 'X'.
    
      REFRESH GT_FIELDCAT.
      FILL_FIELD:'SEL'     '选择'          '' '' 'X' '' '' 'X'.
      FILL_FIELD:'ZXH'     '序号'          '' '' '' '' '' ''.
      FILL_FIELD:'MATNR'   '物料号'        '' '' '' 'MARA' 'MATNR' ''.
      FILL_FIELD:'MAKTX'   '物料描述'      '' '' 'X' '' '' ''.
      FILL_FIELD:'MEINS'   '计量单位'      '' '' '' '' '' ''.
      FILL_FIELD:'MTART'   '物料类型'      '' '' '' '' '' ''.
      FILL_FIELD:'MATKL'   '物料组'        '' '' '' '' '' ''.
      FILL_FIELD:'BISMT'   '旧物料号'      '' '' '' '' '' ''.
      FILL_FIELD:'MMSTA'   '物料状态' '' '' '' '' '' ''.
      FILL_FIELD:'STATU'   '红绿灯' '' '' '' '' '' ''.
    
           ZMSG = '第' && ZYS && '页'.
           MESSAGE ZMSG TYPE 'S'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-REPID
          I_CALLBACK_PF_STATUS_SET = 'FRM_STATUS'  "调用GUI状态
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'  "调用屏幕点击事件
          IS_LAYOUT_LVC            = GS_LAYOUT
          IT_FIELDCAT_LVC          = GT_FIELDCAT[]
          I_DEFAULT                = 'X'
          I_SAVE                   = 'A'
        TABLES
          T_OUTTAB                 = GT_OUT[]
        EXCEPTIONS
          PROGRAM_ERROR            = 1
          OTHERS                   = 2.
    ENDFORM.
    
    FORM FRM_DIS_DATA2.
      CLEAR:GS_LAYOUT.
      GS_LAYOUT-CWIDTH_OPT = 'X'. "自动优化列宽
    *  GS_LAYOUT-BOX_FNAME  = 'SEL'.
      GS_LAYOUT-ZEBRA = 'X'. "斑马线
      GS_FIELDCAT-FIELDNAME = 'SEL'.
      GS_FIELDCAT-CHECKBOX = 'X'.
      GS_FIELDCAT-EDIT     = 'X'.
    
      REFRESH GT_FIELDCAT.
      FILL_FIELD:'SEL'     '选择'          '' '' 'X' '' '' 'X'.
      FILL_FIELD:'ZXH'     '序号'          '' '' '' '' '' ''.
      FILL_FIELD:'MATNR'   '物料号'        '' '' '' 'MARA' 'MATNR' ''.
      FILL_FIELD:'MAKTX'   '物料描述'      '' '' 'X' '' '' ''.
      FILL_FIELD:'MEINS'   '计量单位'      '' '' '' '' '' ''.
      FILL_FIELD:'MTART'   '物料类型'      '' '' '' '' '' ''.
      FILL_FIELD:'MATKL'   '物料组'        '' '' '' '' '' ''.
      FILL_FIELD:'BISMT'   '旧物料号'      '' '' '' '' '' ''.
      FILL_FIELD:'MMSTA'   '物料状态' '' '' '' '' '' ''.
      FILL_FIELD:'STATU'   '红绿灯' '' '' '' '' '' ''.
    
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-REPID
          I_CALLBACK_PF_STATUS_SET = 'FRM_STATUS'  "调用GUI状态
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'  "调用屏幕点击事件
          IS_LAYOUT_LVC            = GS_LAYOUT
          IT_FIELDCAT_LVC          = GT_FIELDCAT[]
          I_DEFAULT                = 'X'
          I_SAVE                   = 'A'
        TABLES
          T_OUTTAB                 = GT_TAB[]
        EXCEPTIONS
          PROGRAM_ERROR            = 1
          OTHERS                   = 2.
    ENDFORM.
    
    FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
                            P_RS_SELFIELD TYPE SLIS_SELFIELD.
      DATA:LV_NAME1 TYPE RS38L_FNAM.
      DATA:LV_NAME TYPE TDSFNAME.
    
      IF P_DAYIN = '横向'.
        LV_NAME = 'ZPXSF001'.
      ELSEIF P_DAYIN = '纵向'.
        LV_NAME = 'ZPXSF002'.
      ELSE.
        MESSAGE '打印类型请选择‘横向’或‘纵向’!' TYPE 'E'.
      ENDIF.
    
      DATA:LT_TAB TYPE TABLE OF ZPXTEST WITH HEADER LINE.
    
      CASE P_UCOMM.
        WHEN 'PRINT'.
    
          PERFORM FRM_SAVE.
          LOOP AT GT_OUT WHERE SEL = 'X'.
             MOVE-CORRESPONDING GT_OUT TO LT_TAB.
             APPEND LT_TAB.
          ENDLOOP.
    
    "对需要打印的数据队列排序。
          CLEAR ZNUM.
          LOOP AT LT_TAB.
             ZNUM = ZNUM + 1.
             LT_TAB-ZXH = ZNUM.
            MODIFY LT_TAB.
          ENDLOOP.
          CLEAR ZNUM.
    
          IF LT_TAB IS NOT INITIAL.
            CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
              EXPORTING
                FORMNAME           = LV_NAME
              IMPORTING
                FM_NAME            = LV_NAME1
              EXCEPTIONS
                NO_FORM            = 1
                NO_FUNCTION_MODULE = 2
                OTHERS             = 3.
    
            CALL FUNCTION LV_NAME1
              TABLES
                GT_TAB           = LT_TAB[]
              EXCEPTIONS
                FORMATTING_ERROR = 1
                INTERNAL_ERROR   = 2
                SEND_ERROR       = 3
                USER_CANCELED    = 4
                OTHERS           = 5.
          ELSE.
            MESSAGE '请至少选择一行进行打印!' TYPE 'E'.
          ENDIF.
    
    *      "新增ALV空行
    *      DO 100 TIMES.
    *       APPEND INITIAL LINE TO GT_TAB.
    *      ENDDO.
    *      LOOP AT GT_TAB INTO GS_TAB.
    *       IF GS_TAB-ZXH IS INITIAL.
    *          ZNUM = ZNUM + 1.
    *          GS_TAB-ZXH = ZNUM.
    *       ENDIF.
    *      MODIFY GT_TAB FROM GS_TAB.
    *      ENDLOOP.
    *      PERFORM FRM_SAVE.
    *      PERFORM FRM_DIS_DATA.
    *      LEAVE TO SCREEN 0.
    *      STOP.
    
        WHEN 'XYY'.
          ZSY = ZSY + 1000.
          ZXY = ZXY + 1000.
          ZYS = ZYS + 1.
          PERFORM FRM_SETOUT.
          IF GT_OUT[] IS INITIAL.
              ZSY = ZSY - 1000.
              ZXY = ZXY - 1000.
              ZYS = ZYS - 1.
              MESSAGE '当前页已是尾页!' TYPE 'E'.
    *          STOP.
    *         ELSE.
    *           MESSAGE ZMSG TYPE 'S'.
          ENDIF.
          PERFORM FRM_DIS_DATA.
          LEAVE TO SCREEN 0.  "点击标准返回按钮可一步退到选择屏幕。
          STOP.
    
        WHEN 'SYY'.
          ZSY = ZSY - 1000.
          ZXY = ZXY - 1000.
          ZYS = ZYS - 1.
          PERFORM FRM_SETOUT.
          IF GT_OUT[] IS INITIAL.
              ZSY = ZSY + 1000.
              ZXY = ZXY + 1000.
              ZYS = ZYS + 1.
              MESSAGE '当前页已是首页!' TYPE 'E'.
    *          STOP.
    *        ELSE.
    *          MESSAGE ZMSG TYPE 'S'.
          ENDIF.
          PERFORM FRM_DIS_DATA.
          LEAVE TO SCREEN 0.  "点击标准返回按钮可一步退到选择屏幕。
          STOP.
    
       WHEN 'ALL'.
    *      PERFORM FRM_GET_DATA.
          CLEAR GT_OUT[].
          GT_OUT[] = GT_TAB[].
          SORT GT_OUT BY MATNR.
          CLEAR ZNUM.
    *      LOOP AT GT_OUT INTO GS_TAB.
    *          ZNUM = ZNUM + 1.
    *          GS_TAB-ZXH = ZNUM.
    *        MODIFY GT_OUT FROM GS_TAB.
    *      ENDLOOP.
          PERFORM FRM_DIS_DATA.
    
     "访问 Baidu。
       WHEN 'BAIDU'.
          CONCATENATE 'HTTP://10.183.200.120:8010/HELPDATA/EN/49/'
                          '2DFE88088B11D396A9006094B9867B/'
                          INTO P_STR.
    
           URL_TABLE-URL = 'WWW.BAIDU.COM'.
           APPEND URL_TABLE.
    
           IF NOT URL_TABLE IS INITIAL.
               CALL FUNCTION 'WS_EXECUTE'
                 EXPORTING
                   PROGRAM =  'C:\PROGRAM FILES\INTERNET EXPLORER\IEXPLORE.EXE'
                   COMMANDLINE = URL_TABLE
                   INFORM = ' '
                 EXCEPTIONS
                    PROG_NOT_FOUND = 1.
    
              IF SY-SUBRC <> 0.
                  MESSAGE 'Sorry! No browser found on your computer.' TYPE 'E'.
              ENDIF.
           ENDIF.
    
          "点击跳转
        WHEN '&IC1'.
    *      PERFORM FRM_REFRESH .
          PERFORM FRM_SAVE.
          IF P_RS_SELFIELD-FIELDNAME = 'MATNR' OR P_RS_SELFIELD-FIELDNAME = 'MAKTX'.
            READ TABLE GT_OUT[] INTO GT_OUT INDEX P_RS_SELFIELD-TABINDEX.
            IF SY-SUBRC = 0.
              PERFORM FRM_GETINFO1 USING GT_OUT-MATNR.
    *          PERFORM FRM_LAYOUT.
              PERFORM FRM_FIELDCAT1.
              PERFORM FRM_OUTPUT1.
            ENDIF.
          ELSE.
            EXIT.
          ENDIF.
    
        WHEN 'GV_TIME'.
    
        WHEN OTHERS.
      ENDCASE.
    
    ENDFORM.
    
    FORM FRM_SETOUT.
      CLEAR GT_OUT[].
      LOOP AT GT_TAB INTO GS_TAB.
         IF GS_TAB-ZXH > ZSY AND GS_TAB-ZXH <= ZXY.
             APPEND GS_TAB TO GT_OUT.
         ENDIF.
      ENDLOOP.
    ENDFORM.
    
    "将ALV上手填的数据保存到内表
    FORM FRM_SAVE.
      DATA: LR_GRID TYPE REF TO CL_GUI_ALV_GRID.
      DATA: L_VALID TYPE C.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          E_GRID = LR_GRID.
    
      CALL METHOD LR_GRID->CHECK_CHANGED_DATA
        IMPORTING
          E_VALID = L_VALID.
    ENDFORM.
    
    *"跳转  调用
    *FORM FRM_REFRESH .
    *  DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
    *  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    *    IMPORTING
    *      E_GRID = G_GRID.
    *
    *  CALL METHOD G_GRID->CHECK_CHANGED_DATA.
    *  CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY.
    *ENDFORM.
    FORM FRM_GETINFO1  USING  P_GS_TAB_MATNR.
      CLEAR:GT_MAKT[].
      SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_MAKT
      FROM MAKT WHERE MATNR = P_GS_TAB_MATNR.
    ENDFORM.
    FORM FRM_FIELDCAT1.
      CLEAR:GT_FIELDCAT1.
      FILL_FIELD1:'MATNR'   '物料号'         '' '' '' 'MAKT' 'MATNR' ''.
      FILL_FIELD1:'SPRAS'   '语言代码'         '' '' '' '' '' ''.
      FILL_FIELD1:'MAKTX'   '物料描述'         '' '' '' '' '' ''.
      FILL_FIELD1:'MAKTG'   '长文本描述'         '' '' '' '' '' ''.
    ENDFORM.
    FORM FRM_OUTPUT1 .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          I_CALLBACK_PROGRAM = SY-REPID
          IS_LAYOUT_LVC      = GS_LAYOUT
          IT_FIELDCAT_LVC    = GT_FIELDCAT1[]
        TABLES
          T_OUTTAB           = GT_MAKT[]
        EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.
    ENDFORM.
    
    "GUI状态
    FORM FRM_STATUS USING LT_EXTAB.
      SET PF-STATUS 'STANDARD'.
    ENDFORM.

    展开全文

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 8,866
精华内容 3,546
关键字:

alv

友情链接: rtc-dm355evm.rar