ABAP Quick - Search in source code
Sometimes it is necessary to search through different source codes in one system. We show you how it works in the SAP GUI and in Eclipse.
Table of contents
For every developer, the focus is on writing source code because it is most fun and creative. But research and understanding of source code is also an important part of daily work as a developer. Today we would like to show you how to search source code in the system, once for the SAP GUI and once as an example in Eclipse, as the new development environment.
Classic search
The classic search in the SAP GUI works with the report RS_ABAP_SOURCE_SCAN, which offers various options for searching the source code and further restricting the search quantity by selecting the packages and objects to be searched.
From a performance perspective, this restriction is also necessary because the runtime of the report can sometimes take a little longer until all resources have been searched.
For our example we are looking for a ##TODO pragma, which we have added to the source code, because we want to do something later. Such TODOs are mostly used when you later want to complete certain points that you did not manage to implement or were not required in a first prototype. For example, clean exception handling should be mentioned here.
The program provides the corresponding search results at the end and you can navigate to the source code by clicking on the corresponding entry.
Eclipse
Searching in Eclipse is a bit easier because you don't need your own report here, but you can work directly with the search function. The call is made using the key combination CTRL + H or directly in the menu. Then you will get a popup with various searches. The available searches can differ, as you can activate and deactivate them individually using "Customize ...".
In this case the "File Search" is sufficient for us and delivers the desired result. To restrict the amount of files searched, we only search for the pattern in all Z* and LZ* objects.
TODO Pragma
The use of the ##TODO pragma has also some other advantages in Eclipse. Even if this pragma does not exist in the system, it can be used. In Eclipse you get a corresponding marking in the source code and in the overview, which makes it easy to find.
This also works for FIXIT and XXX if you follow the SAP suggestions and provide the code with standardized comments.
Conclusion
The search for any object works in the new and old development world, just a little differently. Which of the searches you choose in the end is up to you, but we recommend searching in Eclipse because it is a bit more powerful and easier to use.