08-30-2005 4:45 PM
Hello All,
I use BAPI_PO_CHANGE to delete a Item in PO.
And i do a Commit, it deletes PO item.
That is fine, after some checks i need to undelete/ Unblock the item which i have deleted earlier.
unfortunetly i cannot do the checks prior to deletion.
Inforeground i can use the unlock to undlete a deleted item, how do it do it with FM or BAPI.
Are theer any BAPI's or FM to do UNDELETE / UNBLOCK a deleted item?
Best Regards.
08-30-2005 4:48 PM
08-30-2005 4:48 PM
08-30-2005 4:50 PM
nope , it doesn't work
Aveek, I cannot roll back i do commit already , as i said earlier i will be able check the conditions only after i delete the PO item and commit it ( It has to send an IDOC to another system).
RICH IT WORKS ; I WAS N'T FILLING THE ITEMX:
I COUN'T ASSIGN POINTS SOME ERROR STOPS TO DO SO; WILL UPDATE WHEN THINGS ARE FINE.
Message was edited by: Mano Sri
08-30-2005 4:52 PM
Hi,
Please refer to the note 456927. It deals with PO idocs but may not be appropriate for BAPI.
regards
Aveek
08-30-2005 4:55 PM
Hi,
Another way is do a rollback:
Call BAPI to change
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = purchase_order
poheader = v_poheader
testrun = testrun
TABLES
return = return
poitem = i_poitem
poitemx = i_poitemx
poschedule = i_poschedule
poschedulex = i_poschedulex.
IF testrun = c_x.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
return = return.
ELSE.
Validation necessary if errors occurred
READ TABLE return WITH KEY type = c_success
id = '06'
number = '023'."Successfully changed
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
return = return.
endif.
endif.
08-30-2005 5:04 PM
This sample program is working good for me. It deletes the line and undeletes it.
report zrich_0002 .
data: return type table of bapiret2 with header line,
poitem type table of bapimepoitem with header line,
poitemx type table of bapimepoitemx with header line.
parameters: p_ebeln type bapimepoheader-po_number,
p_dflag as checkbox.
poitem-po_item = '000001'.
poitem-delete_ind = p_dflag.
append poitem.
poitemx-po_item = '000001'.
poitemx-delete_ind = 'X'.
append poitemx.
call function 'BAPI_PO_CHANGE'
exporting
purchaseorder = p_ebeln
* POHEADER =
* POHEADERX =
* POADDRVENDOR =
* TESTRUN =
* MEMORY_UNCOMPLETE =
* MEMORY_COMPLETE =
* IMPORTING
* EXPHEADER =
tables
return = return
poitem = poitem
poitemx = poitemx
* POADDRDELIVERY =
* POSCHEDULE =
* POSCHEDULEX =
* POACCOUNT =
* POACCOUNTPROFITSEGMENT =
* POACCOUNTX =
* POCONDHEADER =
* POCONDHEADERX =
* POCOND =
* POCONDX =
* POLIMITS =
* POCONTRACTLIMITS =
* POSERVICES =
* POSRVACCESSVALUES =
* POSERVICESTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* POTEXTHEADER =
* POTEXTITEM =
.
commit work.
check sy-subrc = 0.
Regards,
Rich Heilman
08-30-2005 5:07 PM