Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to use BAPI_MATERIAL_AVAILABILITY Function Module....

Former Member
0 Likes
17,891

Hi Experts,

I want to know actual free available quantity (ATP Qty.) for mass materials,

How to use BAPI_MATERIAL_AVAILABILITY function module ?

I have select all material from MARA and inserted in itab.

LOOP AT ITAB.

CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'

EXPORTING

PLANT =

MATERIAL =

UNIT =

  • CHECK_RULE =

  • 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 =

  • DIALOGFLAG =

  • RETURN =

TABLES

WMDVSX =

WMDVEX =

.

I dont know how to use it.

pl. guide us.

Yusuf

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,678

Hi,

Refer to this thread, An example is given by Rich.

Thanks,

Anitha

5 REPLIES 5
Read only

Former Member
0 Likes
5,679

Hi,

Refer to this thread, An example is given by Rich.

Thanks,

Anitha

Read only

0 Likes
5,678

Hi Anitha,

I have created report ztrial and copied this BAPI FM and executed but this is not showing anything.

Yusuf

Read only

Former Member
0 Likes
5,678

Hi,

data: iwmdvsx type table of bapiwmdvs with header line,

iwmdvex type table of bapiwmdve with header line.

parameters: p_matnr type mara-matnr,

p_werks type marc-werks,

p_meins type mara-meins.

call function 'BAPI_MATERIAL_AVAILABILITY'

exporting

plant = p_werks

material = p_matnr

unit = p_meins

  • CHECK_RULE =

  • STGE_LOC =

  • BATCH =

  • CUSTOMER =

  • DOC_NUMBER =

  • ITM_NUMBER =

  • WBS_ELEM =

  • STOCK_IND =

  • IMPORTING

  • ENDLEADTME =

  • AV_QTY_PLT =

  • DIALOGFLAG =

  • RETURN =

tables

wmdvsx = iwmdvsx

wmdvex = iwmdvex.

check sy-subrc = 0.

Text

ATP information

Functionality

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).

regards

Read only

Former Member
0 Likes
5,678

Hi Yusuf,

if you need some information use

MD_STOCK_REQUIREMENTS_LIST_API. It works very good.

About BAPI_MATERIAL_AVAILABILITY i have only the SAP-documention.

Regards, Dieter

Read only

Former Member
0 Likes
5,678

Hi,

DATA: LV_TABIX LIKE SY-TABIX,

LT_WMDVSX LIKE BAPIWMDVS OCCURS 0 WITH HEADER LINE,

LT_WMDVEX LIKE BAPIWMDVE OCCURS 0 WITH HEADER LINE.

LV_TABIX = SY-TABIX.

CLEAR: LT_WMDVSX, LT_WMDVEX.

REFRESH: LT_WMDVSX, LT_WMDVEX.

  • Fill communication table

LT_WMDVSX-REQ_DATE = ET_PROCUREMENT_ITEM-DELIV_DATE.

LT_WMDVSX-REQ_QTY = ET_PROCUREMENT_ITEM-QUANTITY.

APPEND LT_WMDVSX.

  • Availability check with check rule '03'

CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'

EXPORTING

PLANT = ET_PROCUREMENT_ITEM-PLANT

MATERIAL = ET_PROCUREMENT_ITEM-MATERIAL

UNIT = ET_PROCUREMENT_ITEM-UNIT

CHECK_RULE = '03'

TABLES

WMDVSX = LT_WMDVSX

WMDVEX = LT_WMDVEX

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC EQ 0.

READ TABLE LT_WMDVEX WITH KEY

COM_DATE = ET_PROCUREMENT_ITEM-DELIV_DATE.

IF SY-SUBRC EQ 0.

ET_PROCUREMENT_ITEM-AVAIL_QTY = LT_WMDVEX-COM_QTY.

ENDIF.

ENDIF.

Regards

Sudheer