‎2011 Aug 03 2:19 PM
Hi
I need to use the AVAILABILITY_CHECK function module to check the availability of the material in APO system.
Could anyone please let me know what would be the parameters that should be passed to this FM for the case below
If there is no stock on the particular material, then it should bring the replacement material.
‎2011 Aug 03 2:52 PM
Hi Karthik,
Below is the code for the FM
DATA: lt_atpcs LIKE atpcs OCCURS 0 WITH HEADER LINE,
ls_atpca LIKE atpca.
lt_atpcs-matnr = matnr.
lt_atpcs-werks = werks.
lt_atpcs-kdauf = kdauf.
lt_atpcs-kdpos = posnr.
lt_atpcs-bdter = datlo.
lt_atpcs-xline = 1.
lt_atpcs-idxall = 1.
lt_atpcs-chkflg = 'X'.
CALL FUNCTION 'AVAILABILITY_CHECK'
TABLES
p_atpcsx = lt_atpcs
CHANGING
p_atpca = ls_atpca
EXCEPTIONS
error = 1
OTHERS = 2.Now you check for the Sy-subrc = 0.
Write your code for the replacement material fetch and re run the FM keeping it in a sub-routine
repeat the process,
Revert for further clarification
Thanks
Sri
‎2011 Aug 03 3:14 PM
Hi Sri,
When the standard VA01 is executed, for a material with less stock it will automatically propose the repalcement material.
This function module also provides the replacement material and i could check it in debug.
But I couldnt get the exact parameters as there are lot of parameters being paseed and I dont think that all the parameters would be required to get the replacement material.
So if you know what could be the required parameters for the function module to propose the replacement material, it would be helpful.