BAPI_MATERIAL_AVAILABILITY returns different ATP quantity than CO09
I'm using the following code to get ATP quantity of material, it returns (field: AV_QT_PLT = d_WKBST) the current stock quantity (it doesn't subtract orders and deliveries from that quantity). I need to get a return value from BAPI which value is as "Cummulative ATP quantity" from CO09.
You can see in my code which parameters i used to get the value - CHECK_RULE is 'A' etc.
I take the value: BAPICM61V-WKBST as my return value - maybe i need to take some other value to get what i need (cummulative ATP quantity)?
REPORT Z_ATP_CUMMULATIVE. Parameter: p_matnr like BAPIMATVP-MATNR, p_werks like BAPIMATVP-WERKS default 'AR01' obligatory, p_unit like BAPIADMM-UNIT. *Data: int_wmdvsx like BAPIWMDVS occurs 0 with header line, * int_wmdvex like BAPIWMDVE occurs 0 with header line. Data: int_wmdvsx type table of bapiwmdvs with header line, int_wmdvex type table of bapiwmdve with header line, d_WKBST like BAPICM61V-WKBST. CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY' EXPORTING PLANT = p_werks MATERIAL = p_matnr UNIT = p_unit CHECK_RULE = 'A' * STGE_LOC = * BATCH = * CUSTOMER = * DOC_NUMBER = * ITM_NUMBER = * WBS_ELEM = * STOCK_IND = * DEC_FOR_ROUNDING = * DEC_FOR_ROUNDING_X = * READ_ATP_LOCK = * READ_ATP_LOCK_X = IMPORTING * ENDLEADTME = AV_QTY_PLT = d_WKBST * DIALOGFLAG = * RETURN = TABLES WMDVSX = int_wmdvsx WMDVEX = int_wmdvex . Write:/ d_WKBST. If sy-subrc = 0. endif.
Edited by: mihailosundic on Jan 28, 2012 9:54 AM
OK i have found the issue, i just needed to take the value from my table: int_wmdvex and field is: COM_QTY
I have the same value as cumm.ATP qty from CO09.
Edited by: mihailosundic on Jan 28, 2012 10:03 AM
I used a different type of ATP check, althow we use 'A' in sales orders, but '03' was just what i wanted.