获取标准报表CJI3的ALV数据
1、CJI3
运行标准程序CJI3,获取对象和业务货币值,在其他程序中展示
2、代码展示
CJI3对应程序名rkpep003,最终展示的ALV结构可以再程序中找到。
因为本实例只获取其中两个字段的值,也可以直接在ALV点F1获取字段名称
TYPES:BEGIN OF ty_alv, objid TYPE kaep_coac-objid,"编辑的格式中的对象 wtgbtr TYPE kaep_coac-wtgbtr,"交易货币中的总值 END OF ty_alv. DATA ls_cji3 TYPE REF TO data. DATA:lt_alv TYPE TABLE OF ty_alv, ls_alv TYPE ty_alv. FIELD-SYMBOLS:<fs_cji3> TYPE ANY TABLE. RANGES:r_pspid FOR proj-pspid, r_budat FOR cobk-budat. r_pspid-sign = 'I'. r_pspid-option = 'EQ'. r_pspid-low = 'YA-2201004'. APPEND r_pspid. r_budat-sign = 'I'. r_budat-option = 'EQ'. r_budat-low = '20221101'. r_budat-high = '20221130'. APPEND r_budat. "运行时不显示,只获取ALV数据 cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ). "调用CJI3 SUBMIT rkpep003 WITH cn_projn IN r_pspid WITH r_budat IN r_budat WITH koagr = '40' AND RETURN. TRY . cl_salv_bs_runtime_info=>get_data_ref("获取数据 IMPORTING r_data = ls_cji3 ). ASSIGN ls_cji3->* TO <fs_cji3>. MOVE-CORRESPONDING <fs_cji3> TO lt_alv. CATCH cx_salv_bs_sc_runtime_info. MESSAGE '无法获取ALV数据' TYPE 'E'. ENDTRY. cl_salv_bs_runtime_info=>clear_all( ).
运行结果
定期更文,欢迎关注