三个SAP标准的FM
1. BAPI_MATERIAL_AVAILABILITY 获得商品可用库存
2. CO_ZA_AVAILABILITY_CHECK
3.AVAILABILITY_CHECK_CONTROLLER
4.AVAILABILITY_CHECK
DEMO:以下参数的值是我一个个试的,如果想知道为什么,请看源程序。
wa_ATPCS-MATNR = wa_marc-matnr.
wa_ATPCS-WERKS = wa_marc-werks.
wa_ATPCS-PRREG = ‘BO’. “ATP type
wa_ATPCS-BDTER = SY-DATUM. “availability date
wa_ATPCS-XLINE = ‘1’. ”
wa_ATPCS-IDXATP = ‘1’.
wa_ATPCS-RESMD = ‘X’.
wa_ATPCS-CHKFLG = ‘X’.
wa_ATPCA-ANWDG = ‘8’.
APPEND wa_ATPCS TO it_ATPCS.
CALL FUNCTION ‘AVAILABILITY_CHECK’
* EXPORTING
* P_SCHEDSH =
* P_SCHEDTR =
TABLES
* P_ATPALLX =
* P_ATPASSRESX =
* P_ATPASSX =
p_atpcsx = it_ATPCS
* P_ATPCSX_R3 =
P_ATPDSX = it_ATPDS
* P_ATPFIELDX =
* P_ATPMATX =
* P_ATPMATX_R3 =
* P_ATPPLANTX =
* P_ATPREX =
* P_ATPSDUX =
* P_ATPSOPX =
* P_ATPSSPX =
* P_ATPTERMX =
* P_ATPREQTERMX =
* P_MDVEX =
* P_MDVEX_R3 =
* P_MDVEX_APO =
* P_QTDERGX =
* P_QTDOBJX =
* P_QTDQTYX =
* P_T441VX =
* P_TMVFX =
* P_ATPDIAX =
* P_ATPDIAWX =
* P_QUOT_CHX =
* P_QUOT_VBX =
CHANGING
P_ATPCA = wa_ATPCA
* P_ATPCB =
* P_ATPCC =
EXCEPTIONS
ERROR = 1
OTHERS = 2
.
IF sy-subrc = 0.
SORT it_ATPDS.
READ TABLE it_ATPDS INTO wa_ATPDS WITH KEY DELKZ = ‘WB’ BINARY SEARCH. “wb stock
IF sy-subrc = 0.
wa_ArticleStock-TOTALQTY = wa_ATPDS-QTY_O. “total qty
wa_ArticleStock-VALIDQTY = wa_ATPDS-QTY. “val qty
ENDIF.
ENDIF.
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/18235.html