In this post you will learn to use transaction CODE_SCANNER to search for text strings within ABAP programs.

Imagine a situation where you need to check whether custom programs in your system have any SELECT query on a standard table. It is possible to do it with a where used list but we will see how this can be done using the code scanner.

The tools looks like below.

The program name for this is AFX_CODE_SCANNER.

Search Criteria

  • Package – Entering a package name is mandatory
  • Objects – If you only need to search custom programs then ‘Z*’ can be used
  • Package Contained – All packages within the mentioned package will be used.
  • Search String 1 – Enter the string that you want to search
  • Search String 2 – One more search string can be entered, result will be shown only if both the strings are found

Options

  • Exclude Search String 1/2/3 – This can be used to filter out the strings which you do not want in the result. For example, I want to search for table name but not for field as shown in below example.
  • Number of Output Lines – Number of lines from the code to be displayed in output
  • Ignore Comment Lines – Do not search in commented lines.
  • Display Objects Without Hits – Even if the search string is not found the searched object name will be listed in the output.
  • Open Objects in Edit Mode? – After the result is displayed – when you double click on the result line – it opens the code in display mode by default. With this checkbox, we can change the mode to edit mode.

Objects to be Scanned

These checkboxes allow us to restrict the search.

Output

Now, let us try out the options

Number of Output Lines = 2.

Display Objects Without Hits

Open Objects in Edit Mode?

Other Options for Searching in ABAP Code

You might not have this program in your system then you can try below programs.

  1. RPR_ABAP_SOURCE_SCAN
  2. RS_ABAP_SOURCE_SCAN
  3. Transaction code EWK1

These both programs are similar with RS_ABAP_SOURCE_SCAN being a newer version of RPR_ABAP_SOURCE_SCAN.

RS_ABAP_SOURCE_SCAN

Similar search can be carried out in this report. Here package is not mandatory.

This search returns 468 hits as it checks for strings SFLIGHT or SELECT unlike CODE_SCANNER which understands that both the strings should matched.

However, this program can still be used if you do not know the package name where you want to search.

EWK1

This transaction shows a quick search option as a popup where you can fine a string. This is a very good option if you need to search quickly in few custom programs.

(Credits: https://www.linkedin.com/in/gabrielsouzasys/ )

It has output similar to Global Program search we use in SE38 or any other gui ABAP editor.

If you have more experience in using these tool, have any other excellent alternative or a related tip – do mention it in the comments section so that we all benefit from the same.

For more SAP Tips, Tricks, and How-to posts visit SAP Tips & Tricks


If you like the content, please subscribe…

Join 4,010 other subscribers

Discovering ABAP YouTube Channel