‎2008 Jun 16 7:17 AM
Hello,
I want to change the quantity , price and schedule line delivery date, I am able to change quantity and price , but delivery date is not changing with BAPI
below is my code
DATA :po_items TYPE bapiekpo OCCURS 0 WITH HEADER LINE,
po_item_schedules TYPE bapieket OCCURS 0 WITH HEADER LINE,
return TYPE bapireturn OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'BAPI_PO_GETDETAIL'
EXPORTING
purchaseorder = '4500000946'
items = 'X'
schedules = 'X'
TABLES
po_items = po_items
po_item_schedules = po_item_schedules
return = return .
******For change BAPI
DATA : return1 TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
poitem TYPE bapimepoitem OCCURS 0 WITH HEADER LINE,
poitemx TYPE bapimepoitemx OCCURS 0 WITH HEADER LINE,
poschedule TYPE bapimeposchedule OCCURS 0 WITH HEADER LINE,
poschedulex TYPE bapimeposchedulx OCCURS 0 WITH HEADER LINE.
LOOP AT po_items.
CLEAR poitemx.
MOVE-CORRESPONDING po_items TO poitem.
poitemx-net_price = 'X'.
poitemx-quantity = 'X'.
poitem-quantity = 15.
poitemx-po_item = poitem-po_item.
poitemx-po_itemx = 'X'.
poitem-net_price = 3.
APPEND poitem.
APPEND poitemx.
ENDLOOP.
LOOP AT po_item_schedules.
MOVE-CORRESPONDING po_item_schedules TO poschedule.
poschedule-sched_line = 0001.
poschedule-delete_ind = 'X'.
poschedule-delivery_date = '20080710'.
poschedulex-PO_ITEM = 00010.
poschedulex-SCHED_LINE = 0001.
poschedulex-PO_ITEMX = 'X'.
poschedulex-SCHED_LINEX = 'X'.
poschedulex-QUANTITY = 'X'.
poschedulex-PO_ITEMX = 'X'.
poschedulex-SCHED_LINEX = 'X'.
poschedulex-DELETE_IND = 'X'.
APPEND poschedule.
APPEND poschedulex.
ENDLOOP.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = '4500000946'
poheader = poheader
poheaderx = poheaderx
TABLES
return = return1
poitem = poitem
poitemx = poitemx
poschedule = poschedule
poschedulex = poschedulex
.
COMMIT WORK.
WRITE : 'DO'.
Thanks ,
Bijal
‎2008 Jun 16 7:27 AM
Hi,
Firstly call function moduleBAPI_TRANSACTION_COMMIT
ater your BAPI_PO_CHANGE.
pls check the note in documentation below:
In the case of changes that are to be made via the BAPI_PO_CHANGE, a firewall first checks whether the relevant fields are changeable. This approach follows that of the online transaction
First check in your transaction whether the delivery date is changeable or not.
And also consult your functional guy.
I hope this will help you.
‎2008 Jun 16 7:27 AM
Hi,
Firstly call function moduleBAPI_TRANSACTION_COMMIT
ater your BAPI_PO_CHANGE.
pls check the note in documentation below:
In the case of changes that are to be made via the BAPI_PO_CHANGE, a firewall first checks whether the relevant fields are changeable. This approach follows that of the online transaction
First check in your transaction whether the delivery date is changeable or not.
And also consult your functional guy.
I hope this will help you.
‎2008 Jun 16 7:39 AM
‎2008 Jun 16 2:10 PM
Hi
A few things can't work in your code:
- you delete the schedule line (poschedule-delete_ind = 'X'.)
- poschedulex-delivery_date is not flagged so delivery date is not registered to be changed
- poschedule-delivery_date is not a date field it is a 10 character field, you must not give the internal date format to the bapi but the external date format.
Here is your po_item_schedules loop reworked:
DATA: date TYPE sy-datum.
LOOP AT po_item_schedules.
poschedule-po_item = po_item_schedules-po_item.
poschedule-sched_line = po_item_schedules-serial_no.
poschedulex-po_item = po_item_schedules-po_item.
poschedulex-sched_line = po_item_schedules-serial_no.
date = '20080710'.
WRITE date TO poschedule-delivery_date.
poschedulex-delivery_date = 'X'.
APPEND poschedule.
APPEND poschedulex.
ENDLOOP.Regards