‎2005 Nov 30 8:13 PM
Hi,
I want to call BAPI_MATERIAL_AVAILABILITY in ABAP program. Please give me some sample code how i can do this??? Please help
‎2005 Nov 30 8:18 PM
‎2005 Nov 30 8:16 PM
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.
‎2005 Nov 30 8:17 PM
‎2005 Nov 30 8:18 PM
‎2005 Nov 30 8:25 PM
Hi,
Thanks for your help. I want to check whether this BAPI will return ATP quantity. What are all input values i should pass to this BAPI. Please give me Sample code to call & display this BAPI results in ABAP program....
Help me...
‎2005 Nov 30 8:31 PM
Hi this will return ATP quantity, you can find this in table WMDVEX.
regards
vijay
‎2005 Nov 30 8:36 PM
check the rules avialble in T441r.
WMDVEX-COM_QTY will hold ATP quantity.
* Fill communication table
LT_WMDVSX-REQ_DATE = ET_PROCUREMENT_ITEM-DELIV_DATE.
LT_WMDVSX-REQ_QTY = ET_PROCUREMENT_ITEM-QUANTITY.
APPEND LT_WMDVSX.
pass Plant,Material,Unit , Checking Rule, in tables pass
LT_WMDVSX, you will get the Data to lt_WMDVEX.
it will have ATp qauntity.regards
vijay
‎2005 Nov 30 8:37 PM
Hi,
Great help. Just one more help, How i can write Structure wmdvex values using Write statement.
I tried this Loop at Wmdvex
write : / t_wmdvex.
endloop.
But it's saying me that cann't convert to text field.
Please help me..........
‎2005 Nov 30 8:39 PM
Loop at Wmdvex
write : / t_wmdvex-COM_QTY,
t_wmdvex-BDCNT,
t_wmdvex-REQ_QTY.
*like this try
endloop
‎2005 Nov 30 8:41 PM
loop at t_wmdvex.
write:/ t_wmdvex-BDCNT,
t_wmdvex-REQ_DATE,
t_wmdvex-REQ_QTY,
t_wmdvex-COM_DATE,
t_wmdvex-COM_QTY.
endloop.
please reward if it solves your problem.
Message was edited by: Vijay Babu Dudla
‎2005 Nov 30 8:49 PM
Hi,
I want to pass Hardcoded Value Like My own values to this BAPI. How i can do that? Ex. Plant
'ALB1' Material "100000223" Unit "EA" like this. Is that possible????
‎2005 Nov 30 8:51 PM
CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
EXPORTING
PLANT = 'ALB1'
MATERIAL = '100000223'
UNIT = 'EA'
CHECK_RULE = '03'
TABLES
WMDVSX = LT_WMDVSX
WMDVEX = LT_WMDVEX
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC EQ 0.Message was edited by: Vijay Babu Dudla
‎2005 Nov 30 9:01 PM
‎2005 Nov 30 9:04 PM
hi,
REPORT YATP.
DATA: LV_TABIX LIKE SY-TABIX,
LT_WMDVSX LIKE BAPIWMDVS OCCURS 0 WITH HEADER LINE,
LT_WMDVEX LIKE BAPIWMDVE OCCURS 0 WITH HEADER LINE.
data ET_PROCUREMENT_ITEM LIKE BBPPOGN.
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 = 'ALB1'
MATERIAL = '100000223'
UNIT = 'EA'
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.
write 😕 et_procurement_item-avail_qty.
Loop at lt_wmdvex.
write : / lt_wmdvex-COM_QTY,
lt_wmdvex-BDCNT,
lt_wmdvex-REQ_QTY.
endloop.
This is my program but no value written for WMDVEX.
‎2005 Nov 30 9:08 PM
‎2005 Nov 30 9:10 PM
Check the materials you have inputted correctly or not
vlaues to mantnr,plant.
‎2005 Nov 30 9:16 PM
Remember material number is stored internally with leading zeros, so if you really want to access the data using a hardcoded value then you must do it like this...
call function 'BAPI_MATERIAL_AVAILABILITY'
exporting
plant = 'ALB1'
material = '000000000100000223'
unit = 'EA'
check_rule = '03'
tables
wmdvsx = lt_wmdvsx
wmdvex = lt_wmdvex
exceptions
others = 1.Regards,
Rich heilman
‎2005 Nov 30 9:17 PM
hi First what you do
Go to MARC table take one matnr,plant
with this matnr go to mara then select take meins from that and for now don't pass rule, and pass only those.
i suggested you before it self , rules are maintained in one table check and based on that you pass , but now you can check with out any rule.
regards
vijay
‎2005 Nov 30 9:19 PM
Notice here that in my sample program the conversion is done for you when using parameters.
report zrich_0001.
data: lv_tabix like sy-tabix,
lt_wmdvsx like bapiwmdvs occurs 0 with header line,
lt_wmdvex like bapiwmdve occurs 0 with header line.
data et_procurement_item like bbppogn.
lv_tabix = sy-tabix.
<b>parameters: p_werks type marc-werks.
parameters: p_matnr type mara-matnr.</b>
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
<b> plant = P_werks
material = p_matnr</b>
unit = 'EA'
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.
write :/ et_procurement_item-avail_qty.
loop at lt_wmdvex.
write : / lt_wmdvex-com_qty,
lt_wmdvex-bdcnt,
lt_wmdvex-req_qty.
endloop.
Regards,
Rich Heilman
‎2005 Nov 30 9:20 PM
Hi I think Now you got the solution,
if you got the solution try to reward points .
Go to tables and get the values....pass them to FM
thanks
vijay
‎2005 Nov 30 9:22 PM
The Units It Always Never Be 'EA' so try to pass the correct info.
regards
vijay
‎2005 Nov 30 9:28 PM
Hi guys,
Thanks a lot for Solution. I got the answer. Really i will appreciate your help. thanks again. I rewarded points....
‎2005 Nov 30 9:29 PM
‎2005 Nov 30 9:35 PM
yes. When i change that input as leading zero I got the ATP Quantity........
‎2005 Nov 30 9:38 PM
‎2005 Nov 30 9:38 PM
‎2005 Nov 30 9:43 PM
Hi,
I rewared points for u too....... My special rewards "CLAPS" & thanks....for such a timely help...
‎2005 Nov 30 9:45 PM
‎2005 Nov 30 9:46 PM
‎2005 Nov 30 9:55 PM
Hi,
I got this ATP Quantity, I want to display this ATP Qunatity in Material Search help, that's in VA01 if i enter Standard order press enter it will take me to next screen. In that screen material field if i press f4 or Mouse click i will get Search help screen . in that result list i need to add Plant & ATP value. Any idea guys?????????
‎2005 Nov 30 10:02 PM
Hi
Try to Open in another thread and people can see your question.
regards
vijay
‎2005 Nov 30 10:12 PM
‎2008 Oct 29 11:05 AM
Hi,
I am using a BAPI in sales order simplification program. I just want to know that is it really necessary to "COMMIT WORK" calling the BAPI function?
‎2008 Oct 29 11:08 AM
Oh My god!!! U bought back Three years Old post!!!!!1
OK. Coming to your answer... You need to give commit after BAPI's to reflect the changes in the database.
After calling your particular BAPI, you should use "BAPI_TRANSACTION_COMMIT".
Regards,
Vishwa.