Skip to Content
Author's profile photo Thomas Fiedler

Tip of the Day: Search in ABAP Code with ADT

Hi folks,

maybe you know that situation: You want to find/replace content within your ABAP code but you want to restrict the search operation only to a specific area of the code, e.g. a method or a local class.

The solution is quite simple because on the Find/Replace dialog there is the option to restrict the search scope on the selected lines:

 

 

 

Have Fun.

Thomas.

 

 

 

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      Is "All" the default scope even if something is selected? That would be rather counter-intuitive IMHO...

      In SE38, I use Ctrl-F and the Replace works only for the selected area. If I want to run it for the whole thing then I just don't select anything. I believe it's the same way in MS Office, for example.

       

      Author's profile photo Dominik Di Lorenzo
      Dominik Di Lorenzo

      I don‘t have an adt installation here at the moment to verify it, but for 99.9999999999% I am sure it‘s the same logical default setting in ADT as you say it is in se38 and ms office.

      It would have driven me insane if it would be the other way 🙂

      Author's profile photo Michal Unger
      Michal Unger

      Hi Thomas,

      a bit off-topic, but still search-related ?
      Any idea how to find all occurrences of certain string within whole function group or module pool, i.e. in compound source code trees comprising includes? Even ADT’s improved ABAP Source Search (Ctrl-H), (where complex queries with AND/OR cannot be used in Search Filter, unfortunately) does not serve this task well.
      I still need to open the module pool or function group source code in SE80 and use binoculars icon (Ctrl-F) in the toolbar (i.e. ‘global’ find) to get the complete list – and then also the result list can be searched thru with another Ctrl-F to narrow down the lookup… So here SE80 search is still much more powerful. Any tip how to achieve the same in AiE?

       

      Author's profile photo Thomas Fiedler
      Thomas Fiedler
      Blog Post Author

      Hi Michael,

      yes, we have the HANA-based Sourcecode search:

      https://blogs.sap.com/2014/01/23/abap-sourcecode-search/

      Here you can also limit the search result for specific reports, function groups or module pools.

       

      Regards,

      Thomas.

       

      Author's profile photo Lars-Ole Lugert
      Lars-Ole Lugert

      Which leads me to the next question: How can I select an entire method within ADT?

      Best regard,
      Lars-Ole

      Author's profile photo Thomas Fiedler
      Thomas Fiedler
      Blog Post Author

      Łukasz Pęgiel Do you have an idea how to select the code of a method in ADT?

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel

      Selection of Enclosed Element is not implemented for ABAP Editors, but you can use trick with folding. Means Ctrl+NumPad- will collapse method or element. If element use it again. Then select the collapsed method and Ctrl+C

      CopyMethod

      Author's profile photo Thomas Fiedler
      Thomas Fiedler
      Blog Post Author

      Good one. Thanks.