SAP BAPI_MATERIAL_AVAILABILITY Function Module for ATP information









BAPI_MATERIAL_AVAILABILITY is a standard bapi material availability SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for ATP information processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for bapi material availability FM, simply by entering the name BAPI_MATERIAL_AVAILABILITY into the relevant SAP transaction such as SE37 or SE38.

Function Group: W61V
Program Name: SAPLW61V
Main Program: SAPLW61V
Appliation area: M
Release date: 16-Oct-1997
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function BAPI_MATERIAL_AVAILABILITY pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'"ATP information
EXPORTING
PLANT = "Plant
* WBS_ELEM = "WBS Element
* STOCK_IND = "Special Stock Indicator
* DEC_FOR_ROUNDING = "No. of decimal places to which rounding should be performed
* DEC_FOR_ROUNDING_X = "Updated information in related user data field
* READ_ATP_LOCK = "Control indicator for availability check
* READ_ATP_LOCK_X = "Updated information in related user data field
* MATERIAL_EVG = "
MATERIAL = "Material number
UNIT = "Unit of measure for display
* CHECK_RULE = "Checking rule
* STGE_LOC = "Storage location
* BATCH = "Batch
* CUSTOMER = "Customer number
* DOC_NUMBER = "Document number
* ITM_NUMBER = "Item number

IMPORTING
ENDLEADTME = "End of replenishment lead time
AV_QTY_PLT = "Quantity available at plant level
DIALOGFLAG = "Indicator (X = not available, N = no check)
RETURN = "

TABLES
WMDVSX = "Input table (date and quantity)
WMDVEX = "Output table (date and ATP quantity)
.




Customer Function user exits

Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.
EXIT_SAPLW61V_001 User Exit for Determining Checking Rule and Plant

IMPORTING Parameters details for BAPI_MATERIAL_AVAILABILITY

PLANT - Plant

Data type: BAPIMATVP-WERKS
Optional: No
Call by Reference: No ( called with pass by value option)

WBS_ELEM - WBS Element

Data type: BAPISDITM-WBS_ELEM
Optional: Yes
Call by Reference: No ( called with pass by value option)

STOCK_IND - Special Stock Indicator

Data type: BAPICM61V-SOBKZ
Optional: Yes
Call by Reference: No ( called with pass by value option)

DEC_FOR_ROUNDING - No. of decimal places to which rounding should be performed

Data type: BAPICM61M-ANDEC
Optional: Yes
Call by Reference: No ( called with pass by value option)

DEC_FOR_ROUNDING_X - Updated information in related user data field

Data type: BAPIUPDATE
Optional: Yes
Call by Reference: No ( called with pass by value option)

READ_ATP_LOCK - Control indicator for availability check

Data type: BAPICM61V-VFPST
Optional: Yes
Call by Reference: No ( called with pass by value option)

READ_ATP_LOCK_X - Updated information in related user data field

Data type: BAPIUPDATE
Optional: Yes
Call by Reference: No ( called with pass by value option)

MATERIAL_EVG -

Data type: BAPIMGVMATNR
Optional: Yes
Call by Reference: No ( called with pass by value option)

MATERIAL - Material number

Data type: BAPIMATVP-MATNR
Optional: No
Call by Reference: No ( called with pass by value option)

UNIT - Unit of measure for display

Data type: BAPIADMM-UNIT
Optional: No
Call by Reference: No ( called with pass by value option)

CHECK_RULE - Checking rule

Data type: BAPIT441V-PRREG
Optional: Yes
Call by Reference: No ( called with pass by value option)

STGE_LOC - Storage location

Data type: BAPICM61V-LGORT
Optional: Yes
Call by Reference: No ( called with pass by value option)

BATCH - Batch

Data type: BAPICM61V-CHARG
Optional: Yes
Call by Reference: No ( called with pass by value option)

CUSTOMER - Customer number

Data type: BAPIKNVVKY-CUSTOMER
Optional: Yes
Call by Reference: No ( called with pass by value option)

DOC_NUMBER - Document number

Data type: BAPISDHEAD-DOC_NUMBER
Optional: Yes
Call by Reference: No ( called with pass by value option)

ITM_NUMBER - Item number

Data type: BAPISDITM-ITM_NUMBER
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for BAPI_MATERIAL_AVAILABILITY

ENDLEADTME - End of replenishment lead time

Data type: BAPICM61M-WZTER
Optional: No
Call by Reference: No ( called with pass by value option)

AV_QTY_PLT - Quantity available at plant level

Data type: BAPICM61V-WKBST
Optional: No
Call by Reference: No ( called with pass by value option)

DIALOGFLAG - Indicator (X = not available, N = no check)

Data type: BAPICM61V-DIAFL
Optional: No
Call by Reference: No ( called with pass by value option)

RETURN -

Data type: BAPIRETURN
Optional: No
Call by Reference: No ( called with pass by value option)

TABLES Parameters details for BAPI_MATERIAL_AVAILABILITY

WMDVSX - Input table (date and quantity)

Data type: BAPIWMDVS
Optional: No
Call by Reference: No ( called with pass by value option)

WMDVEX - Output table (date and ATP quantity)

Data type: BAPIWMDVE
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for BAPI_MATERIAL_AVAILABILITY Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.

DATA:
lv_plant  TYPE BAPIMATVP-WERKS, "   
lt_wmdvsx  TYPE STANDARD TABLE OF BAPIWMDVS, "   
lv_endleadtme  TYPE BAPICM61M-WZTER, "   
lv_wbs_elem  TYPE BAPISDITM-WBS_ELEM, "   
lv_stock_ind  TYPE BAPICM61V-SOBKZ, "   
lv_dec_for_rounding  TYPE BAPICM61M-ANDEC, "   
lv_dec_for_rounding_x  TYPE BAPIUPDATE, "   
lv_read_atp_lock  TYPE BAPICM61V-VFPST, "   
lv_read_atp_lock_x  TYPE BAPIUPDATE, "   
lv_material_evg  TYPE BAPIMGVMATNR, "   
lt_wmdvex  TYPE STANDARD TABLE OF BAPIWMDVE, "   
lv_material  TYPE BAPIMATVP-MATNR, "   
lv_av_qty_plt  TYPE BAPICM61V-WKBST, "   
lv_unit  TYPE BAPIADMM-UNIT, "   
lv_dialogflag  TYPE BAPICM61V-DIAFL, "   
lv_return  TYPE BAPIRETURN, "   
lv_check_rule  TYPE BAPIT441V-PRREG, "   
lv_stge_loc  TYPE BAPICM61V-LGORT, "   
lv_batch  TYPE BAPICM61V-CHARG, "   
lv_customer  TYPE BAPIKNVVKY-CUSTOMER, "   
lv_doc_number  TYPE BAPISDHEAD-DOC_NUMBER, "   
lv_itm_number  TYPE BAPISDITM-ITM_NUMBER. "   

  CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'  "ATP information
    EXPORTING
         PLANT = lv_plant
         WBS_ELEM = lv_wbs_elem
         STOCK_IND = lv_stock_ind
         DEC_FOR_ROUNDING = lv_dec_for_rounding
         DEC_FOR_ROUNDING_X = lv_dec_for_rounding_x
         READ_ATP_LOCK = lv_read_atp_lock
         READ_ATP_LOCK_X = lv_read_atp_lock_x
         MATERIAL_EVG = lv_material_evg
         MATERIAL = lv_material
         UNIT = lv_unit
         CHECK_RULE = lv_check_rule
         STGE_LOC = lv_stge_loc
         BATCH = lv_batch
         CUSTOMER = lv_customer
         DOC_NUMBER = lv_doc_number
         ITM_NUMBER = lv_itm_number
    IMPORTING
         ENDLEADTME = lv_endleadtme
         AV_QTY_PLT = lv_av_qty_plt
         DIALOGFLAG = lv_dialogflag
         RETURN = lv_return
    TABLES
         WMDVSX = lt_wmdvsx
         WMDVEX = lt_wmdvex
. " BAPI_MATERIAL_AVAILABILITY




ABAP code using 7.40 inline data declarations to call FM BAPI_MATERIAL_AVAILABILITY

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

"SELECT single WERKS FROM BAPIMATVP INTO @DATA(ld_plant).
 
 
"SELECT single WZTER FROM BAPICM61M INTO @DATA(ld_endleadtme).
 
"SELECT single WBS_ELEM FROM BAPISDITM INTO @DATA(ld_wbs_elem).
 
"SELECT single SOBKZ FROM BAPICM61V INTO @DATA(ld_stock_ind).
 
"SELECT single ANDEC FROM BAPICM61M INTO @DATA(ld_dec_for_rounding).
 
 
"SELECT single VFPST FROM BAPICM61V INTO @DATA(ld_read_atp_lock).
 
 
 
 
"SELECT single MATNR FROM BAPIMATVP INTO @DATA(ld_material).
 
"SELECT single WKBST FROM BAPICM61V INTO @DATA(ld_av_qty_plt).
 
"SELECT single UNIT FROM BAPIADMM INTO @DATA(ld_unit).
 
"SELECT single DIAFL FROM BAPICM61V INTO @DATA(ld_dialogflag).
 
 
"SELECT single PRREG FROM BAPIT441V INTO @DATA(ld_check_rule).
 
"SELECT single LGORT FROM BAPICM61V INTO @DATA(ld_stge_loc).
 
"SELECT single CHARG FROM BAPICM61V INTO @DATA(ld_batch).
 
"SELECT single CUSTOMER FROM BAPIKNVVKY INTO @DATA(ld_customer).
 
"SELECT single DOC_NUMBER FROM BAPISDHEAD INTO @DATA(ld_doc_number).
 
"SELECT single ITM_NUMBER FROM BAPISDITM INTO @DATA(ld_itm_number).
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!