Skip to Content
Author's profile photo Tuncay Karaca


I have used BAPI_MATERIAL_AVAILABILITY in iWay project to create CheckMaterialAvailability web service.  Firstly let’s look at its documentation:

Using this function module, you can determine the receipt quantity still available for a particular material in a certain plant according to ATP logic (MRPII).

The availability check is carried out on transferring the material number, the plant and the input table (WMDVSX). The scope of the check, that is, which stocks, receipts and issues are to be included in the check is defined by the combination of checking group (material master) and cheking rule. In the function module, the system uses the checking rule defined in Sales & Distribution (A). You can overrule this checking rule by using an interface or a user-exit (exit_saplw61v_001). A similar procedure is also valid for the plant parameters. The customer number in the user-exit means that the plant selection can be controlled via the customer. If no plant parameters are given via the interface, the system uses the parameter ‘WRK’ saved in the user’s fixed values.

The results of the availability check are recorded in the output table (WMDVEX). This table contains dates and available receipt quantities (ATP quantities). The results of the check depends on the following entries:

  • If no date and no quantity is transferred, the system displays the ATP situation from today’s date into the future as the result.
  • If only a date and no quantity is transferred, the system displays the ATP situation from the corresponding date as the result.
  • If both a date and a quantity are transferred, the system calculates the availability situation for the quantity specified.

In the last two cases, the parameter ‘DIALOGFLAG‘ is supplied. This can result in the following:

  • ‘ ‘ (blank) <=> quantity completely available
  • ‘X’ <=> only partial quantity available or not available at all
  • ‘N’ <=> Material not included in the availability check
    (Material not relevant to the availability check)

The system also displays the end of the replenishment lead time (ENDLEADTME).

You can run BAPI_MATERIAL_AVAILABILITY for only one material, one plant, one unit at a time. But we needed to check availability for multiple materials at a time, so I wrote a Z* RFC which wraps BAPI_MATERIAL_AVAILABILITY. Simply Z* RFC accepts multiple materials in a table parameter, then call BAPI_MATERIAL_AVAILABILITY in a loop.

Here is how call it:

*     Call BAPI Material Availability
                plant      = ls_plant-werks
                material   = it_material-material
                unit       = it_material-unit
                check_rule = it_material-check_rule
                return     = ls_return
                wmdvsx     = lt_req
                wmdvex     = lt_com.

Import Parameters:

PLANT: give a plant number
MATERIAL: give a material number
UNIT: unit of measure for the material
CHECK_RULE: give a check rule,  value table is T441R (Values Table for Checking Rule). If you don’t give check_rule, the function module gets A (SD order).

Table parameter WMDVSX (Input table (date and quantity)):

  • REQ_DATE: Requirement date. If no date and no quantity is transferred, the system displays the ATP situation from today’s date into the future as the result.
  • REQ_QTY: Required quantity.
  • DELKZ: You can give MRP element indicator, it isn’t obligatory.
  • YLINE: You can give index number to each line for internal table processing.

Export Parameters:

RETURN: If something returns with this parameter, it shows something is wrong. After calling function module, firstly check this parameter. For example you can get a message like that: “Material MMM not maintained in plant

Table parameter WMDVEX (Output table (date and ATP quantity)):

  • REQ_DATE: Requirement date from import table WMDVSX.
  • REQ_QTY: Required quantity from import table WMDVSX.
  • COM_DATE: Committed date. If there is available quantity for required quantity, it is same as REQ_DATE. It could be different than requirement date; it means there is no available quantity on required date, but it is available in the (near) future.
  • COM_QTY: Committed quantity. It must be same as required quantity.

If even you don’t give (fill out WMDVSX table), any required quantity, you get a result in table WMDVEX.

But requirement date was accepted today’s date, and required quantity was accepted as much as big number like 9,999,999,999.000.

COM_QTY (committed quantity) shows available quantity on COM_DATE (committed quantity).

Its documentation says export parameter DIALOGFLAG can be used to see whether required quantity is available or not ( ‘ (blank): Available, ‘X’: Not available or partially available, ‘N’: Material not relevant to the availability check ). But as you see I didn’t use DIALOGFLAG. I used table WMDVEX to do that. If I require 600 EAch material, and if it gives me less than this number as committed quantity, it means there is no available quantity for my requirement.

If you want to compare the result, you can use transaction CO09 (Availability Overview). It gives the same result as BAPI_MATERIAL_AVAILABILITY does.

On SDN forums there are several discussions keep going about BAPI_MATERIAL_AVAILABILITY:

Here is another link mentions BAPI_MATERIAL_AVAILABILITY:


Assigned tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi - great post.

      i know this is an older post, but I followed your example, and got the results of stock (one line) per material / plant / unit from the BAPI.  Works great.  However, my requirement is really to replicate a table response (or build one line by line per material) that is the entire ATP situation table for a material from CO09, where the “With reqmts qtys” is selected on.  So, instead of one line, I need to get the table from CO09 back.  Can the BAPI do this?  If so, how do I get that response?  I'm still researching and googling, but I'd appreciate it if you could let me know, if you know.


      Author's profile photo Former Member
      Former Member

      Hi, I found the FM that I need:  it's Availability_Check

      Author's profile photo Tuncay Karaca
      Tuncay Karaca
      Blog Post Author

      Hi Jeremy,

      Very very late response 🙂  

      So I am glad to hear you are fine.

      Author's profile photo Ricardo Andre Barg
      Ricardo Andre Barg


      After 13 years you wrote this blog, I have one question:

      Is it possible to show the DELKZ of every line in this FM?

      Author's profile photo Tuncay Karaca
      Tuncay Karaca
      Blog Post Author

      Hi Ricardo, I know a late reply. Hope you found your answer! 🙂