Different ways to Find any String or Hard Coded Value in SAP ABAP Code

The different ways to search any String or Hard Coded Value within SAP ABAP Code including Reports, Includes and Classes Explained !

Reports to find String in SAP ABAP Program

The different methods to find any String in SAP ABAP Code are:

  • Report RSRSCAN1
  • Standard Report RKCTSEAR
  • Report AFX_CODE_SCANNER (it requires at least one package name)
  • Custom Report

The recommend Report to search any string in ABAP Programs in RPR_ABAP_SOURCE_SCAN.

But it is not available in all SAP Version like (CRM, SRM,…). In this case, you may want to use RSRSCAN1.
( The RSRSCAN1 reachs its limits very quickly and may dumb, consider running it with a limited ABAP programs )

Transaction codes to find String in SAP ABAP Code

  • SE38 > Tools
  • and also Transaction Code EWK1

As RPR_ABAP_SOURCE_SCAN, you may not have the EWK1 Transaction codes in your system.

Search String in ABAP Report Tcode: CODE_SCANNER

And my preference to search for String in ABAP source is for the standard Transaction Code CODE_SCANNER.
In fact, the  CODE_SCANNER Tcodes is for “Scans Report/Funct. Group/Class Code” and it is based on the report AFX_CODE_SCANNER.

In the Search Criteria, the only parameters required are the package & the Search String 1.
You have also options to :

  • Ignore Comment lines
  • Display Objects Without Lines
  • Open Objects in Edit Mode

You can also restrict your string search to :

  • Programs ( Reports, Includes, Screen )
  • Function Groups
  • Classes

Custom Report to search for String or Hard coded in SAP Programs

An alternative to find a String or any hard coded value in SAP ABAP code / programs is to create your own report and take the control.
The main algorithm is :

Read the SAP Dtabase View TRDIR

The TRDIR is  based on SAP Table REPOSRC.
The main field for TRDIR are:

  • NAME ABAP Program Name
  • SQLX Source code protection
  • EDTX Editor lock flag
  • VARCL Case-Sensitive
  • DBAPL Application database
  • DBNA Logical database
  • CLAS Program class
  • TYPE Selection screen version
  • OCCURS Automatically generated program
  • SUBC Program type
  • APPL Application
  • SECU Authorization Group
  • CNAM Author
  • CDAT Created on
  • UNAM Last changed by
  • UDAT Changed On
  • VERN Version number
  • LEVL Level
  • RSTAT Status
  • RMAND Client

Read Screen Souces from Table D020S

The SAP Tables D020S (System table D020S (screen sources)) stores the Screen Sources.

Search for String in ABAP Report & Classes

Use the ABAP statement READ REPORT in order to read the ABAP sources into an internal Table.
for example: read report gv_RepName into gt_SrcCode.

Search for String in DynPro (Screen)

For Screen and Dynpro, use rather IMPORT DYNPRO.
For example: import dynpro gs_DynHeader gt_DynFields gt_DynLines gt_DynParams id gs_DynPro.

You will find the whole Report here Search for Strings in ABAP Source Code

Further Reading on ABAP Programming

If you want to go further and learn more about ABAP Programming or even refresh your ABAP knowlege, I recommend the following Books:


SAP and SAP logo are registered trademarks of SAP AG. Sap4tech.net is not associated with SAP AG.

We have made every effort to make sure provide relevant search results, use the content on this site at your own risk.

We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.