本文主要是介绍SAP SALV11 给SALV设置字段筛选条件,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.效果:
2.代码:
- SE24->CL_SALV_FILTERS
CLASS lcl_salv_model DEFINITION INHERITING FROM cl_salv_model.PUBLIC SECTION.DATA: o_control TYPE REF TO cl_salv_controller_model,o_adapter TYPE REF TO cl_salv_adapter.METHODS: save_modelIMPORTING io_model TYPE REF TO cl_salv_model.METHODS: save_controller.METHODS: save_adapter.PRIVATE SECTION.DATA: lo_model TYPE REF TO cl_salv_model. ENDCLASS.CLASS lcl_report DEFINITION.PUBLIC SECTION.TYPES: BEGIN OF ty_sflight,carrid TYPE sflight-carrid,connid TYPE sflight-connid,fldate TYPE sflight-fldate,price TYPE sflight-price,currency TYPE sflight-currency,t_color TYPE lvc_t_scol,END OF ty_sflight.TYPES: ty_t_sflight TYPE TABLE OF ty_sflight WITH DEFAULT KEY.DATA: lt_sflight TYPE TABLE OF ty_sflight.DATA: o_salv TYPE REF TO cl_salv_table.DATA: o_salv_model TYPE REF TO lcl_salv_model.METHODS: get_data. "定义获取数据方法METHODS: salv_output. "定义SALV输出方法PRIVATE SECTION.METHODS: set_pf_status "定义设置SALV状态栏的方法CHANGING co_alv TYPE REF TO cl_salv_table.METHODS: set_layout "定义设置SALV layout的方法CHANGING co_alv TYPE REF TO cl_salv_table.METHODS: set_top_of_page "定义设置SALV 页头文本的方法CHANGING co_alv TYPE REF TO cl_salv_table.METHODS: set_end_of_page "定义设置SALV 页尾文本的方法CHANGING co_alv TYPE REF TO cl_salv_table.METHODS: set_display_setting "定义设置SALV GUI抬头文本的方法CHANGING co_alv TYPE REF TO cl_salv_table.METHODS: set_columns "定义设置SALV 表列属性的方法CHANGING co_alv TYPE REF TO cl_salv_table.METHODS: set_hotspot "定义设置SALV Hotspot的方法CHANGING co_alv TYPE REF TO cl_salv_table.METHODS: on_link_click "定义设置SALV link单击事件的方法FOR EVENT link_click OF cl_salv_events_tableIMPORTING rowcolumn.METHODS: set_colors "定义设置SALV 颜色属性的方法CHANGING co_alv TYPE REF TO cl_salv_tablect_sflight TYPE ty_t_sflight.METHODS: on_user_command "定义设置SALV User_command属性的方法FOR EVENT added_function OF cl_salv_events_tableIMPORTING e_salv_function.METHODS: set_aggregations "定义设置SALV 计总属性的方法CHANGING co_alv TYPE REF TO cl_salv_table.METHODS: set_filters "定义设置SALV 筛选属性的方法CHANGING co_alv TYPE REF TO cl_salv_table. ENDCLASS.CLASS lcl_salv_model IMPLEMENTATION.METHOD save_model.lo_model = io_model.ENDMETHOD.METHOD save_controller.o_control = lo_model->r_controller. "?= 类对象中的castingENDMETHOD.METHOD save_adapter.o_adapter ?= lo_model->r_controller->r_adapter.ENDMETHOD.ENDCLASS.CLASS lcl_report IMPLEMENTATION.METHOD get_data.SELECT carrid connid fldate price currencyFROM sflightINTO CORRESPONDING FIELDS OF TABLE lt_sflightUP TO 50 ROWS.ENDMETHOD.METHOD salv_output.DATA: lx_msg TYPE REF TO cx_salv_msg.DATA: lo_alv_model TYPE REF TO cl_salv_model.TRY.cl_salv_table=>factory(IMPORTINGr_salv_table = o_salvCHANGINGt_table = lt_sflight ).CATCH cx_salv_msg INTO lx_msg.ENDTRY."call method set PF-StatusCALL METHOD set_pf_statusCHANGINGco_alv = o_salv."call method set LayoutCALL METHOD set_layoutCHANGINGco_alv = o_salv."call method set top-of-pageCALL METHOD me->set_top_of_pageCHANGINGco_alv = o_salv."call method set end-of-pageCALL METHOD me->set_end_of_pageCHANGINGco_alv = o_salv."call method set Disply_settingCALL METHOD set_display_settingCHANGINGco_alv = o_salv."call method set ColumnsCALL METHOD me->set_columnsCHANGINGco_alv = o_salv."call method Set HotspotCALL METHOD set_hotspotCHANGINGco_alv = o_salv."call method Set colorCALL METHOD set_colorsCHANGINGco_alv = o_salvct_sflight = lt_sflight."call method save_modello_alv_model ?= o_salv.CREATE OBJECT o_salv_model.CALL METHOD o_salv_model->save_modelEXPORTINGio_model = lo_alv_model."call method set_aggregationsCALL METHOD set_aggregationsCHANGINGco_alv = o_salv."call method set_filtersCALL METHOD set_filtersCHANGING
这篇关于SAP SALV11 给SALV设置字段筛选条件的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!