ABAP Submit呼叫SAP標準程式MB5B

2021-10-23 13:58:09 字數 2720 閱讀 8761

*& report  zmb5b_test

report  zmb5b_test.

tables:

mkpf,

mseg.

types:

begin of typ_mb5b,

matnr type mseg-matnr,

werks type mseg-werks,

name1 type t001w-name1,

start_date type sy-datum, "開始日期

end_date type sy-datum,   "結束日期

anfmenge type mseg-menge, "期初庫存

endmenge type mseg-menge, "期末庫存

end of typ_mb5b.

data:

lth_mb5b type typ_mb5b,

td_mb5b type table of typ_mb5b,

ls_data type ref to data.

field-symbols:

type standard table,

type any.

select-options:

s_werks for mseg-werks,

s_matnr for mseg-matnr,

s_budat for mkpf-budat.

start-of-selection.

call method cl_salv_bs_runtime_info=>set

exporting

display        = abap_false

metadata       = abap_false

data           = abap_true.

submit rm07mlbd               "tcode mb5b

with matnr in s_matnr

with werks in s_werks    "填寫篩選螢幕字段

with datum in s_budat

*           with lgort eq space    "每個庫存地點

*           with sobkz eq space

with datum in sc_budat

"庫存型別-特殊庫存

*           with lgbst eq space

*           with bwbst eq 'x'

*           with sbbst eq space

"清單範圍

*          with pa_wdzer eq space

*          with pa_wdzew eq 'x'

*          with pa_wdwiz eq 'x'

*          with pa_wdwuw eq 'x'

*          with pa_wdwew eq 'x'

*           with pa_ndzer eq space

*           with pa_ndsto eq 'x'

"設定*           with pa_sflva eq 't1'

with pa_sumfl eq 'x'

*           with xchar eq space

*           with xnomchb eq space

*           with xnomchb eq space

*           with nosto eq space

*           with pa_dbstd eq 'x'

*           via selection-screen

and return

.and return.

try.

call method 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 '無法獲取alv資料' type 'e'.

endtry.

cl_salv_bs_runtime_info=>clear_all( ).

if is assigned.

loop at assigning .

*    move-corresponding to lw_mb5b.

*    clear lw_mb5b.

move-corresponding to lth_mb5b.

clear lth_mb5b.

endloop.

endif.

loop at td_mb5b into lth_mb5b.

write: / lth_mb5b-matnr, '||',

lth_mb5b-werks, '||',

lth_mb5b-start_date, '||',

lth_mb5b-end_date, '||',

lth_mb5b-anfmenge, '||',

lth_mb5b-endmenge.

clear lth_mb5b.

endloop.

SAP程式呼叫函式CUAB DISPLAY CD

在對程式具體跟蹤到沒條資料的時候,發現有少量的意向訂單沒有配置號,而導致傳進函式的配置號引數為空,這個時候函式就一致執行不出來而占用系統記憶體導致。解決方案 在取訂單的配置號 vbap cuobj 的時候,加上非空的判斷即可。摘錄如下 data l cuobj like vbap cuobj ref...

SAP 使用VBA呼叫SAP RFC

使用vba呼叫sap rfc和jco 常用的方法基本一致。大致分為兩步 登入和執行 1 設定登入資訊 set r3 createobject sap.functions r3.connection.system dev r3.connection.client 160 r3.connection.s...

RFC呼叫SAP介面程式之直接讀取SAP表案例4

這個需要有sap相關基礎知識。最起碼sap表結構要熟悉。根據品號讀取計量單位 idestinationconfiguration id new rfcconfig rfcdestinationmanager.registerdestinationconfiguration id rfcdestina...