2007 Mar 16 10:16 AM
Dear all,
I'm developing some BAPIs according to the BAPI Programming Guidelines. I'm also using the Persistent Services to manage the persistence of my business object.
The BAPI Programming Guidelines describe the Delete method as "deletes an instance of an SAP business object type from the database" I've implemented this using persistent services with method DELETE_PERSISTENT.
I'd like to implement the undelete method.
According to the documentation at <a href="http://help.sap.com/saphelp_nw04/helpdata/en/f5/a36828bc6911d4b2e80050dadfb92b/frameset.htm">Management States</a>, a persistent object deleted has state 4.
The state transition table suggests that the method CREATE_PERSISTENT can be applied to objects in state 4 - persistent deleted resulting in state 3 - persistent and has been changed.
If before a commit work, I wish to "undelete" the object, how can I achieve this? Ideally, I'd like to simply provide the business key or GUID and request an "undelete" on a deleted persistent object, of course before commit work has been triggered. I do understand I can use CREATE_PERSISTENT to create the object - but this requires that attributes are provided again...
Is there an UNDO method?
Any suggestions would be appreciated.
Regards
Andrew
Message was edited by:
Andrew Barnard
Additional clarification acknowledging the possibility of using the CREATE_PERSISTENT method.
2007 Mar 16 11:42 AM
Hello Andrew
If there is no UNDO (of the DELETE_PERSISTENT) possible then you could try a work-around:
(1) User pushes button "Delete Instance of Business Object"
(2) Instead of directly calling method DELETE_PERSISTENT you could collect the instance in an itab of to-be-deleted instances.
(3) When the user finishes the transaction then you call indeed method DELETE_PERSISTENT for the collected instances.
(4) If the user wants to UNDO her actions the instances are removed from the list.Regards
Uwe
Dear all,
I'm developing some BAPIs according to the BAPI Programming Guidelines. I'm also using the Persistent Services to manage the persistence of my business object.
The BAPI Programming Guidelines describe the Delete method as "deletes an instance of an SAP business object type from the database" I've implemented this using persistent services with method DELETE_PERSISTENT.
I'd like to implement the undelete method.
According to the documentation at <a href="http://help.sap.com/saphelp_nw04/helpdata/en/f5/a36828bc6911d4b2e80050dadfb92b/frameset.htm">Management States</a>, a persistent object deleted has state 4.
The state transition table suggests that the method CREATE_PERSISTENT can be applied to objects in state 4 - persistent deleted resulting in state 3 - persistent and has been changed.
If before a commit work, I wish to "undelete" the object, how can I achieve this? Ideally, I'd like to simply provide the business key or GUID and request an "undelete" on a deleted persistent object, of course before commit work has been triggered. I do understand I can use CREATE_PERSISTENT to create the object - but this requires that attributes are provided again...
Is there an UNDO method?
Any suggestions would be appreciated.
Regards
Andrew
Message was edited by:
Andrew Barnard
Additional clarification acknowledging the possibility of using the CREATE_PERSISTENT method.
2007 Mar 16 11:42 AM
Hello Andrew
If there is no UNDO (of the DELETE_PERSISTENT) possible then you could try a work-around:
(1) User pushes button "Delete Instance of Business Object"
(2) Instead of directly calling method DELETE_PERSISTENT you could collect the instance in an itab of to-be-deleted instances.
(3) When the user finishes the transaction then you call indeed method DELETE_PERSISTENT for the collected instances.
(4) If the user wants to UNDO her actions the instances are removed from the list.Regards
Uwe
2007 Mar 19 9:34 AM
Thanks Uwe,
I think I will go down this direction. In my case, I don't have a user pressing a button, but do have a consumer of my BAPI / RFCs. In either case, the approach you suggested is workable.
Andrew
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |