2006 Dec 22 5:37 AM
Hi Friends,
How can I change the open quantity in ME22 using the BAPI BAPI_PO_CHANGE...
I am getting some errors..The values I am passing to the BAPI are:-
*-- Purchase Order document
lv_purchaseorder = tbl_join-ebeln.
*-- Calculate Open quantity
lv_quantity = ( tbl_join-menge - tbl_join-wemng ).
*-- Fills Schedule quantity to be processed.
tbl_poschedule-po_item = tbl_join-ebelp.
tbl_poschedule-sched_line = tbl_join-etenr.
tbl_poschedule-quantity = lv_quantity.
APPEND tbl_poschedule.
*-- Marks the Schedule quantity to be processed.
tbl_poschedulex-po_item = tbl_join-ebelp.
tbl_poschedulex-sched_line = tbl_join-etenr.
tbl_poschedulex-po_itemx = c_true.
tbl_poschedulex-sched_linex = c_true.
tbl_poschedulex-quantity = c_true.
APPEND tbl_poschedulex.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = lv_purchaseorder
POHEADER =
POHEADERX =
POADDRVENDOR =
TESTRUN = 'X'
IMPORTING
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
RETURN = tbl_return
POSCHEDULE = tbl_poschedule
POSCHEDULEX = tbl_poschedulex.
Is there any other required fields needs to be passed to change the open quantity..
I am checking in ME22...
The scheduled quantity is 20.
Delivered quantity is 15.
Open quantity is 5 and ( this field is in non-editable display )
Delivery date is 10.10.2002 ( which is in past )
Now using this BAPI ..I want to post the remaining open quantity which is " 5 "
How can i do this ?? Please help.
2006 Dec 22 5:44 AM
Hi Hari
Please check after making the following changes:
*-- Marks the Schedule quantity to be processed.
tbl_poschedulex-po_item = tbl_join-ebelp.
tbl_poschedulex-sched_line = tbl_join-etenr.
<b>tbl_poschedulex-po_itemx = 'U'. "c_true.
*tbl_poschedulex-sched_linex = c_true.</b>
tbl_poschedulex-quantity = c_true.
APPEND tbl_poschedulex.
If still you do not get the desired function working add the below code:
tbl_poitem-po_item = tbl_join-ebelp.
tbl_poitem-quantity = lv_quantity.
append tbl_poitem.
tbl_poitemx-po_item = tbl_join-ebelp.
tbl_poitemx-po_itemx = 'U'.
tbl_poitemx-quantity = c_true.
append tbl_poitemx.
Hope this helps.
Kind Regards
Eswar
2006 Dec 22 6:16 AM
2006 Dec 22 6:34 AM
Ok, now i have tried myself.
Here are the parameters that i have passed for successfully changing the quantity.
PURCHASEORDER - PO Number
<b>POSCHEDULE</b>
--PO_ITEM - Item Number
--SCHED_LINE - Schedule Line Number
--QUANTITY - Quantity
<b>POSCHEDULEX</b>
--PO_ITEM - Item Number
--SCHED_LINE - Schedule Line Number
--QUANTITY - 'X'.
Hope it helps this time.
Kind Regards
Eswar
2006 Dec 22 7:03 AM
Hi ,
Scheduled quan = 15
Qty delivered = 12
Open quantity = 3.
Now i have to change this 3 to 0 to make it as fully delivered and this Purchase document should not appear in the table VETVG.
In quantity field I am passing this '<b> 3 '.</b> ...plz luk into BAPI error.
This is the same code as mine. But I am having a few errors from BAPI.
Errors are:-
1) Purchase order still contains faulty items
2) Quantity (+ overdelivery tolerance) is less than quantity delivered(12)
3) Quantity 3 smaller than quantity delivered 12
2006 Dec 22 7:11 AM
Hi Eswar,
I tried with one more Purchase document and tested the BAPI directly ..by passing the same parameters.
It returned success message saying that xyz document is changed...But I checked in ME23 ..but still the open quantity is remained same and there are no changes effected.
Thanks -> Hari krishna
2006 Dec 22 7:16 AM
Hi Hari
I guess, you should change the order quantity...
i.e pass 12 instead of 3 in the way that i have provided you earlier.
For the second case, i guess you have executed in SE37, have you done the COMMIT Work???
Kind Regards
Eswar
2006 Dec 22 7:20 AM
Hi Eswar ..
Do you mean in quantity field should i pass '12'.
With the another purchase document ..
Yes..I executed the BAPI without Test Run only
But no results in ME23
2006 Dec 22 9:01 AM
Hi Hari
Yah you got my point. Please try it that way.
I will try by doing few customization settings to enable the process in my system. It might take a while for me to complete that. So please test with the way that i have mentioned to check if itz happening in your desired way...
Kind Regards
Eswar
2006 Dec 22 9:17 AM
2006 Dec 22 9:57 AM
Hari
Hurrayyyyyy, I have managed to do the process successfully.
As per my understanding your requirement is as below:
When partial delivery has happened, we will still find an entry in table VETVG. So you want to negotiate by changing the quantity, hence the entry in VETVG is disappeared.
Below is what i have done:
1. Created a Stock PO.
2. Created delivery for partial quantity
3. Done the Goods Issue
4. Change the quantity in PO to the qty that has been delivered via BAPI: BAPI_PO_CHANGE.
I have successfully changed the PO quantity via BAPI to find the entry in table VETVG disappear.
Do correct me if my understanding is wrong.
Kind Regards
Eswar
2007 Jan 03 5:15 AM
Hi Eswar,
You got my requirement properly. Please send me the code . Remember I PO can contain multiple line items and 1 line item contain multiple schedule line items.
Please explain how u proceeded. If possible Please send me the code.