ITPub博客

首页 > 数字化转型 > ERP > 抓取报表ALV GRID上的数据 转于elliott

抓取报表ALV GRID上的数据 转于elliott

原创 ERP 作者:niuchao 时间:2019-05-15 09:42:05 1 删除 编辑

抓取报表ALV GRID上的数据

在很多开发情况下,我们需要处理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: type table,
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 .
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 assigning .
move-corresponding to gw_mb5td.
append gw_mb5td to t_mb5td.
endloop.
sort t_mb5td.

endform. “ GET_DATA

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/166523/viewspace-753166/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2004-11-04

  • 博文量
    141
  • 访问量
    136182