Have you ever written a piece of code and later on couldn’t find it anymore because you have accumulated so much code over the years?
Have you ever wondered how somebody else used a particular ABAP statement because you can’t figure out how it’s supposed to work?
Have you ever been frustrated with going through the version management of a module pool or function group to find a piece of coding you did some time ago and might have deleted?
Wouldn’t it be nice if there was a program in the standard system that would let you search for a piece of code, a comment or some string you are looking for?
In older releases, if your system contains the travel expense module, the report RPR_ABAP_SOURCE_SCAN is/was available to help with the above mentioned tasks/questions.
This report was later taken over into the basis system and is now available under the name RS_ABAP_SOURCE_SCAN.
In the Report/Dynpro Selection section you specify which programs you want to search. Function modules and classes would have to be specified via the function group program name, e.g. SAPLBALV_ADDON for the function group BALV_ADDON, or CL_GUI_ALV_GRID* for the class CL_GUI_ALV_GRID.
The Search Criteria section determines what you want to search for and how it is displayed.
String searched for
This is the string or code you are looking for, e.g. DATA if you wanted to find all the data statements in a certain program/range of programs.
+/- x Lines
Determines how many lines of code before and after the line with the search hit are displayed
If you also want to search in the includes that make up a report, function group or class
Modification Assistant Changes
Searches for comments that were inserted by the modification assistant when you modified a standard SAP program.
Ignore Comment Lines
Comment lines starting with ‘*’ or ” are excluded from the search and the list output.
Search for masked objects
This is incorrectly translated. It should read ‘masked object search’.
This indicates that you are using wildcard characters in the search string (masks).
For example if the check box is NOT set and your search string is DAT* the search will likely not find anything because it is looking for the exact string DAT*.
If you set the checkbox for masked search this would return all lines in the report that have DATA statements or statements like DATE or DATUM. You can use the wildcard characters *, + and #. If you want to know more about this look at the ABAP keyword documentation for CP (covers pattern).
Search Range Section
Determines where you want to search. ABAP or Dynpro Code or both.
Here is a sample output for a masked search on program SAPLBALV*.
Hotspot click on any of the code lines will navigate you to the corresponding line in the editor (this does not always work properly. This was a bug that has been corrected in the new version of the program -> following explanations).
New Version of the Program
With some of the nice new features of ABAP, e.g. searches using regular expressions (REGEX) it made sense to give the program a little face lift. I rewrote it a while back and in the latest basis releases it looks like this now:
The search string has moved to the top of the selection criteria and the option for doing masked searches has been removed.
Instead you can use regular expression in the search string.
This is a lot more powerful then masked searches. If the search string contains a regular expression then you need to set the checkbox underneath it.
One example for a regular expression would be [[:digit:]]. This regular expression would find all lines of code that contain a numeric value (or digit). Check out the ABAP online documentation for REGEX and the report DEMO_REGEX_TOY.
The section for the search object selection has also been revamped. There are now dedicated input fields (with F4 helps) to select function modules, classes or packages that should be searched.
The search range section has a new checkbox ‘Version Database’. When this checkbox is set the system will also search in the versions of the selected objects.
New Output List:
The output of the list is now an ALV hierarchic sequential list, which means that you can expand/collapse the list to get a more/less detailed view of the search results.
Output list expanded
Output list collapsed.
Hotspot click on a line of code in the expanded list will navigate you to the corresponding spot in the editor.
Search with Versioned Data:
Version number 0 is the currently active version. Hotspot click on a line of code with version number > 0 will take you to the editor of this version. Unfortunately here it is not possible to position directly on the selected line of code.
Since most of you won’t have the latest version of the report available yet (because of the basis release) I created a Z Version of the program that you can install on your system. You can find the SAPlink slinkee here.