This is a test message to test the length of the message box.
Login
ABAP Quick Where-used list
Created by Software-Heroes

ABAP Quick - Where-Used list messages

When working with BAPIs and messages, it usually comes to a loss of searchability in the use of messages because they are firmly created in structures.

Advertising

For what does you actually need the proof of use of messages? You probably can even think of that as a developer if you were looking for a mistake and wanted to understand the surrounding code of the message. When was the message generated provides in many cases the context of the data and the checks that led to these messages. At this point you can usually already derive the error and correct it.

But what if you can not understand the generation of the message? Either you know the call point of the message or start searching in the source code. But you can also make it easier for yourself by including pseudo-calls of use for the messages.

 

Where-Used list

The where-used list works using the keyword MESSAGE and the number, that is, if the message is generated in a BAPI and the normal BAPI structures are used, then the where-used list does not work because only the number and the message class do not work as a literal fpr the search function.

 

Pseudo calls

However, the integration of a message can cause some problems because it interrupts the program flow. In this context, you will find pseudo-calls to messages in SAP source code more often, but it will never call this messages. If you stumble over such a call for the first time, it may seem strange why just a piece of code that has not been run is at this point.

But that is exactly the meaning of this piece of source code, it has only one meaning at this point and that is the proper function of the where-used list.

 

Implement messages

So what does an integration of the intended use of a message look like? Today, we suggest three methods that you can easily use for your own.

 

Classic use

The classic variant is also used by SAP in many older reports and relies on the shuttering in an IF statement, which is never called. Normally, the message is displayed without parameters and in one line. Disadvantage here is e.g. that there are several statements on one line, which could be contrary to your development conventions.


" Classic variant
IF 0 = 1. MESSAGE S011(F5). ENDIF.

 

Inline Declaration

The IF-statement is omitted with this method and the message is saved in a variable in the coding. Visual processing does not take place because the INTO addition is used when calling. Disadvantage is the declaration of a new variable, even if one has, for example, several meditations in a row. Then you should consider whether you declare the variable in the data part or use a different name each time, which again defines many local variables.


" Inline Declaration
MESSAGE s012(F5) INTO DATA(ld_msg).

 

System variable

If you do not want to rely on an inline declaration and do not want to create a local variable, you can also use a system parameter to take over the contents of the variable. This has the advantage that you do not have to pay attention to the defined variables.


" System variable
MESSAGE s013(F5) INTO sy-prtxt.

 

Conclusion

The where-used list can be helpful to yourself or other developers in many situations. It is superfluous code at first, but it will simplify your work, especially in error analysis. So if you want to do you and your colleagues a favor, then just use one of the tips shown.


Included topics:
QuickWhere-Used listMessages
Comments (0)
Advertising

ABAP Quick - Creation of test data

Category - ABAP

What challenges do you have when setting up test tables and test data and how can machine processing help you?

06/25/2021

ABAP Unit Quick Guide

Category - ABAP

Our current e-book is now available on Amazon, we would like to briefly show you what you can expect in the book and what it will bring you in the end.

05/28/2021

ABAP Quick - RFC Buffer

Category - ABAP

Here is a little tip from us about what can go wrong with the buffer when reading via RFC and what you should definitely pay attention to.

04/23/2021

ABAP Quick - Wait for task

Category - ABAP

Today a tip for asynchronous processing or if you want to put processing in a separate task in special situations. What happens afterwards?

03/05/2021

ABAP Quick - Performance INSERT vs VALUE

Category - ABAP

In this article we take a look at the performance of the insert operations APPEND, INSERT and VALUE with regard to tables and evaluate the performance and stability during development.

02/26/2021