转载:https://blog.csdn.net/fengxin_/article/details/107516820
SALV有个的功能,就是submit其他SALV程序后能直接取得显示的结果。
方法一:通常情况下,可以将submit的SALV显示结果发送到内存中,
通过 SUBMIT .... EXPORTING LIST TO MEMORY AND RETURN,
然后通过函数 LIST_FROM_MEMORY 读取,通过 WRITE_LIST 写入,这么做比较繁琐。
方法二:通过类CL_SALV_BS_RUNTIME_INFO来实现:
步骤一:1,将Submit的salv设置为不显示模式
" 设定SALV运行模式, cl_salv_bs_runtime_info=>set( display = abap_false "不显示 metadata = abap_false data = abap_true ).
步骤二:submit SALV程序
SUBMIT ztld_mm_009 WITH s_date = s_date WITH s_werks IN g_werks WITH s_lgort IN s_lgort EXPORTING LIST TO MEMORY AND RETURN.
步骤三:调用cl_salv_bs_runtime_info=>get_data_ref()取得结果
TRY. "取得运行数据 cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = go_data ). * 数据赋值 ASSIGN go_data->* TO <git_outtab>. CATCH cx_salv_bs_sc_runtime_info. ENDTRY. CALL METHOD cl_salv_bs_runtime_info=>clear_all.
步骤四:进行数据的处理
做过的一个实例:
types : begin of ty_alvinfo, bukrs type bseg-bukrs, "公司 werks like mard-werks, "工厂 lgort like mard-lgort, "库位,即库存地点 xhnum type i, "序号 matnr like mard-matnr, "SAP物料编码 maktx like makt-maktx, "SAP物料描述 meins like mara-meins, "单位 bklas like mbew-bklas, "评估类型 " stprs LIKE mbew-stprs, "标准成本 peinh like mbew-peinh, "价格单位 matkl like mara-matkl, "物料组编号 xchpf like mara-xchpf, " 物料批次 wgbez like t023t-wgbez, "物料组名称 sumlabst like mard-labst, "总库存 sumlabst1 type mard-labst, "总库存(计算) " vmver LIKE mbew-vmver, "期间单位价格 verpr like mbew-verpr, "移动平均价 bwtar like mbew-bwtar, "评估类型 salk3 like mbew-salk3, "估价的总库存价值 dmbtr type ekbe-dmbtr, "库存金额 budat like mkpf-budat, "库存时间 days type faglflext-objnr00, "库存时间 labst like mard-labst, "库存数量 lgobe type t001l-lgobe, "仓库名称 qty10 type mard-labst, "7日以内库存数量 dmbtr10 type ekbe-dmbtr, "7日以内库存金额 qty11 type mard-labst, "7至15日库存数量 dmbtr11 type ekbe-dmbtr, "7至15日库存金额 qty12 type mard-labst, "15至30日库存数量 dmbtr12 type ekbe-dmbtr, "15至30日库存金额 qty13 type mard-labst, "30至60日库存数量 dmbtr13 type ekbe-dmbtr, "30至60日库存金额 qty14 type mard-labst, "60至90日库存数量 dmbtr14 type ekbe-dmbtr, "60至90日库存金额 qty15 type mard-labst, "90至120日库存数量 dmbtr15 type ekbe-dmbtr, "90至120日库存金额 qty16 type mard-labst, "120至180日库存数量 dmbtr16 type ekbe-dmbtr, "120至180日库存金额 qty17 type mard-labst, "180至360日库存数量 dmbtr17 type ekbe-dmbtr, "180至360日库存金额 qty18 type mard-labst, "360至720日库存数量 dmbtr18 type ekbe-dmbtr, "360至720日库存金额 qty19 type mard-labst, "720日以上库存数量 dmbtr19 type ekbe-dmbtr, "720日以上库存金额 menge type mseg-menge, "入库总数量 eisbe like marc-eisbe, "安全库存 bstmi like marc-bstmi, "最小批量 lv_datum type sy-datum, verpr1 type mbewh-verpr, box(1), end of ty_alvinfo. DATA go_data TYPE REF TO data. FIELD-SYMBOLS: <git_outtab> TYPE ANY TABLE . ”结构必须和被调程序的ALV 结构一样 field-symbols: <gis_outtab> type ty_alvinfo. RANGES:g_werks FOR mseg-werks . CLEAR g_werks. g_werks-sign = 'I'. g_werks-option = 'EQ'. g_werks-low = '6001'. APPEND g_werks. CLEAR g_werks. g_werks-sign = 'I'. g_werks-option = 'EQ'. g_werks-low = '6003'. APPEND g_werks. cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ). SUBMIT ztld_mm_009 WITH s_date = s_date WITH s_werks IN g_werks WITH s_lgort IN s_lgort EXPORTING LIST TO MEMORY AND RETURN. TRY. "取得运行数据 cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = go_data ). * 数据赋值 ASSIGN go_data->* TO <git_outtab>. "结构必须和被调程序的ALV 结构一样 CATCH cx_salv_bs_sc_runtime_info. ENDTRY. CALL METHOD cl_salv_bs_runtime_info=>clear_all. IF go_data IS NOT INITIAL . *数据处理 LOOP AT <git_outtab> ASSIGNING <gis_outtab>. ztld_dmbtr = <gis_outtab>-dmbtr + ztld_dmbtr. ztld_cqje = <gis_outtab>-dmbtr14 + <gis_outtab>-dmbtr15 + <gis_outtab>-dmbtr16 + <gis_outtab>-dmbtr17 + <gis_outtab>-dmbtr18 + <gis_outtab>-dmbtr19 + ztld_cqje . ENDLOOP. ENDIF.
标签:mard,werks,库存,读取,dmbtr,ABAP,ALV,type,like From: https://www.cnblogs.com/seven1314pp/p/18530587