库存:
1. BAPI_MATERIAL_AVAILABILITY 获得商品可用库存
ATP information: 疑问是 标准ATP检查用的这个BAPI 吗?
2. CO_ZA_AVAILABILITY_CHECK
3. AVAILABILITY_CHECK_CONTROLLER
4. AVAILABILITY_CHECK
库存管理:
BAPI_GOODSMVT_GETDETAIL 显示货物移动的明细
BAPI_GOODSMVT_GETITEMS 显示物料凭证的详细清单
BAPI_GOODSMVT_CREATE 货物移动过帐,入库,出库
BAPI_GOODSMVT_CANCEL 冲销货物移动
**获得商品可用库存实例1:
DATA:lv_av_qty_plt LIKE bapicm61v-wkbst. DATA:ls_bapireturn TYPE bapireturn. DATA:lt_wmdvex TYPE TABLE OF bapiwmdve. DATA:ls_wmdvex LIKE LINE OF lt_wmdvex. DATA:lt_wmdvsx TYPE TABLE OF bapiwmdvs. DATA:ls_wmdvsx LIKE LINE OF lt_wmdvsx. DATA:lv_matnr TYPE matnr18. lv_matnr = <ls_data>-matnr. CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY' EXPORTING plant = s_werks-low material = lv_matnr unit = <ls_data>-meins stge_loc = '1000' batch = <ls_data>-charg IMPORTING av_qty_plt = lv_av_qty_plt return = ls_bapireturn TABLES wmdvsx = lt_wmdvsx wmdvex = lt_wmdvex. READ TABLE lt_wmdvex INTO ls_wmdvex WITH KEY com_date = sy-datum. IF sy-subrc = 0. <ls_data>-com_qty = ls_wmdvex-com_qty. ENDIF. **当筛选界面库位=3000时,当前库存和可用库存取值相等,均取MCHB-CLABS IF P_LGORT = '3000'. <ls_data>-com_qty = <ls_data>-clabs. ENDIF.
例2 转自:https://www.cnblogs.com/rockyzjut/p/3170909.html
*****ATP检测 DATA: END_RLT LIKE EBAN-LFDAT, NOT_AVAILABLE, AVAILABLE(3), AVAIL_QTY_PLANT LIKE BAPICM61V-WKBST. DATA:xwmdvsx LIKE BAPIWMDVS OCCURS 0, xwmdvex LIKE BAPIWMDVE OCCURS 0. DATA: ls_temp type BAPIWMDVS. DATA: ls_temp_ex type BAPIWMDVE. ls_temp-REQ_DATE = ls_sale-ETDAT. ls_temp-REQ_QTY = ls_sale-sqty. append ls_temp to xwmdvsx. CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY' EXPORTING plant = ls_sale-WERKS material = ls_sale-MABNR unit = ls_sale-meins check_rule = 'A' STGE_LOC = ls_sale-LGORT * BATCH = ls_sale-CHARG CUSTOMER = ls_first * DOC_NUMBER = SALESDOCUMENT ITM_NUMBER = ls_sale-POSNR DEC_FOR_ROUNDING = '0' IMPORTING endleadtme = end_rlt av_qty_plt = avail_qty_plant dialogflag = not_available TABLES wmdvsx = xwmdvsx wmdvex = xwmdvex EXCEPTIONS error_message = 1. read table xwmdvex index 1 into ls_temp_ex.