Someone deleted an ABAP program – how do I get it back?
A bizarre incident occurred the other day: we discovered that a complex, custom (ABAP) WebDynpro – which has been in Production for years – had disappeared from our Development client.
The object exists in Production and Test, but not in Development. Even more bizarre, there was no transport in DEV recording that it had been deleted.
Could it be a technical glitch? There’s none that I can think of.
Was it perhaps a rogue agent? Would a developer really delete a program and then cover his/her tracks by deleting the transport as well? Unlikely.
We’re still not sure. Anyway, we had to figure out a way to restore the program quickly, as urgent maintenance was required.
The BASIS guys suggested transporting the program back from Test to DEV, but that just seemed too hard.
We then discovered a much easier way, which I am sharing in this document. It hinges on the realization that even when you delete a program, the version history lives on in the database.
Here’s the recovery procedure (for a simple ABAP program):
- transaction SE38: create a new program object with the _exact_ same name, and save it (you will be prompted to create a new transport)
- in the ABAP Editor, choose menu item Utilities > Versions > Version Management
- select the most recent version (obviously not today’s) and click on the ‘Retrieve’ button
- press the ‘Back’ button – you will see now that all your code has been restored 🙂
- press ‘Save’ and Activate
- Also restore the text elements; these have a version history as well.
For ABAP WebDynpro, the procedure is a bit more complex, because multiple objects are involved.
You need to re-create:
- the Web Dynpro (in SE80)
- the Component Controller
- the Windows
- the Views
- the Interface Controller
- the Web Dynpro Application
For each object the procedure is basically the same: recreate an object with the exact same name, and retrieve the most recent version. If it has no version history (like the WebDynpro Application), then you just create it manually by copying whatever is in Production.
In all cases, you should have a copy of the program object open in Prod, and do constant eyeball comparisons until you are sure that everything matches. To be safe, you might even want to use version management to do a remote compare of the finished product (use the “REMOTE comparison” button in SE38: Utilities > Version > Version Management)
Of course, this only works if your object was transported at least once, OR you executed the ‘Generate Version’ function (SE38 Utilities > Versions > Generate Version). The latter applies to local objects as well.
Once all this is done, you can commence your urgent maintenance.
Happy ending 🙂
PS: a similar strategy can be used to retrieve deleted workflows as well: http://scn.sap.com/docs/DOC-52274