Skip to Content
Author's profile photo Paul Bakker

Someone deleted an ABAP program – how do I get it back?

The Problem

/wp-content/uploads/2013/10/hole_295678.jpg

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.

The Solution

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
  • etc

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

/wp-content/uploads/2013/10/jigsaw_295677.jpg

http://www.123rf.com

Assigned Tags

      16 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Nice Idea...

      Author's profile photo Former Member
      Former Member

      I never thought we can retrieve something after deletion. Great Paul Bakker.

      Please include if you have more restoring tips. They will be always helpful.

      Author's profile photo Paul Bakker
      Paul Bakker
      Blog Post Author

      Well, since you ask, I actually encountered another similar issue today (at another client). Some 'goose' had deleted a top-level function group Z_VT_DIALOGS, but all its includes & function modules still remained.

      In this case all I had to do was recreate the function group (in SE80). Immediately, all the includes automagically reattached themselves to it. No version history retrieval required.

      cheers

      Paul

      Author's profile photo Former Member
      Former Member

      Do we have to do this everytime be4 we delete our program :-

      SE38 Utilities > Versions > Generate Version???

      Does that  effect the program by anymeans??

      Anyway thanks for the post paul.

      Author's profile photo Rick Bakker
      Rick Bakker

      Hi Amarantha,

      This is for retrieving programs deleted by accident. You don't have to Generate Version if you are deleting it intentionally.

      Anyway, Generate Version is only useful if it's a local object A version is saved every time a transport is done.

      regards

      Rick

      Author's profile photo Former Member
      Former Member

      Thanks Rick for answering my queries.

      Author's profile photo Hiriyappa Myageri
      Hiriyappa Myageri

      Before this we need Generate Version then only we can able retrieve it.

      Author's profile photo Rick Bakker
      Rick Bakker

      "Before this we need Generate Version then only we can able retrieve it."

      Only if it's a Local object ($TMP). If it gets transported then a version is saved automatically.

      Author's profile photo Matthew Billingham
      Matthew Billingham

      If the object is in Production or Test (as in Rick's scenario) then it must have been transported, and it must have a version.

      Author's profile photo Matthew Billingham
      Matthew Billingham

      For SE38  at least, you don't even have to create the object. You can enter its name and go straight to version management.

      Author's profile photo Paul Bakker
      Paul Bakker
      Blog Post Author

      Thanks for the tip Matthew!

      Author's profile photo Former Member
      Former Member

      Dear Paul,

      In normal ABAP program SE38, we can download program from Quality or Production System, Go to Utilities and More Utilities and Download and save it in .xml format and upload in Development Systems using above procedure except download use upload with previous name and then also we can recovery the program .

      Over all its is Nice Article Paul πŸ˜€ πŸ˜€

      Thanks and regrads,

      Madhukumar L

      Author's profile photo Matthew Billingham
      Matthew Billingham

      While you can do that, don't you think that Paul's appraoch is simpler?

      Author's profile photo Former Member
      Former Member

      Ya, i do agree Paul's Approach is simpler,But what every i have mentioned above is also one more way to fulfill to requirement.

      Just i have mentioned alternate way to fulfill the requirement.

      Author's profile photo Anmol Bhat
      Anmol Bhat

      Hi Paul Bakker,Β 

       

      You just saved my 10 days of work. Thanks a tonΒ  πŸ™‚

       

      Regards,

      Anmol

      Author's profile photo Paul Bakker
      Paul Bakker
      Blog Post Author

      Great to hear it ! πŸ™‚