How to Restrict the Execution of an ABAP Program?

How to Restrict the Execution of an ABAP Program?

Clarification of the Question

I would venture to classify this note as a kind of user hack. Let’s imagine a situation in which you are developing an ABAP program (Program A), fully aware that in the foreseeable future it will need to be retired and replaced by another program (Program B). The key point here is that Program A must eventually no longer be used.

When the time comes to start using the new program (Program B), we assume that the old one (Program A) cannot be removed from the user role (the reasons for this will not be discussed here). The consultant's task is to avoid user frustration by displaying an appropriate informational message to the user. Let’s look at an example.

One rather radical approach to the question “How to restrict the execution of an ABAP program?” is discussed in the note How to Generate a Dump in an ABAP Program?. Spoiler: not recommended!

Initial Setup

You have a useless ABAP program A:

And an equally useless program B:

Task Statement

Restrict the execution of ABAP Program A and inform the user that they should use Program B instead.

Solution

Add the technical names of both ABAP programs to the corresponding fields in table DELREPS (Transaction SM30)

In Program A (which needs to be disabled), insert a few lines of code — these can be found by examining where the message type PP 034 is used

This is how Program A will look after the changes have been made

Testing

0:00
/0:44