本文共 1280 字,大约阅读时间需要 4 分钟。
在很多开发情况下,我们需要处理sap标准报表程序跑出的数据,很多人会想到内存的处理方法,但是得到的格式不如人意,在google了几天后终于找到了个例子,以下是本人实例中的相关部分。
types:begin of ty_mb5td,
matnr type ekpo-matnr, “Article werks type ekpo-werks, “Site mb5td_calc_trame type mb5td-mb5td_calc_trame,“Calculated Stock in Transit on Date meins type mara-meins, “Base Unit of Measure end of ty_mb5td. data:t_mb5td type table of ty_mb5td, gw_mb5td type ty_mb5td.*内表定义的字段要跟ALV structure里的一致。
*&———————————————————————*
*& Form GET_DATA *&———————————————————————* * text *———————————————————————-* * –> p1 text * <– p2 text *———————————————————————-* form get_data.data:ls_data type ref to data.
field-symbols: <lt_data> type table, <l_data> type data. cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ).submit rm07mtrb_date ”Tcode MB5TD
with bukrs in s_bukrs with reswk eq p_werks with pa_budat eq p_budat with xtram eq ” and return.try.
cl_salv_bs_runtime_info=>get_data_ref( importing r_data = ls_data ). assign ls_data->* to <lt_data>. catch cx_salv_bs_sc_runtime_info. message ‘Unable to retrieve ALV data’ type ‘E’. endtry.cl_salv_bs_runtime_info=>clear_all( ).
loop at <lt_data> assigning <l_data>.
move-corresponding <l_data> to gw_mb5td. append gw_mb5td to t_mb5td. endloop. sort t_mb5td.endform. “ GET_DATA
转载地址:http://zyhaf.baihongyu.com/