Skip to Content
Author's profile photo Jerry Wang

Webclient UI Source code search tool

The source code scan report RS_ABAP_SOURCE_SCAN ( or transaction code CODE_SCANNER ) is a good tool for ABAPers.

In my Webclient UI development life, I would also expect that there is also a similar tool which enable the scan on html source code of ui component view, for example I want to search by keyword “ActiveXObject” to get a list of ActiveX control used in Javascript code.

/wp-content/uploads/2014/05/clipboard1_460090.png

Why RS_ABAP_SOURCE_SCAN could not support html source code scan

In the beginning I plan to enhance RS_ABAP_SOURCE_SCAN instead of development a new tool. All the objects( class, report, function module) which supported by this tool could have their source code read out via keyword READ REPORT.

/wp-content/uploads/2014/05/clipboard2_460121.png

 

this is not the case for handler class of ui component view. Although you could still set breakpoint on the ABAP code in view handler class and debug them,

/wp-content/uploads/2014/05/clipboard3_460122.png

however they are stored in a difference way than normal ABAP class /report, thus it is not possible to fetch their source code from repository via READ REPORT. Besides that you can easily observe the page editor are quite different from normal ABAP Editor for class/report/function module, which means if I enhance RS_ABAP_SOURCE_SCAN, I also need to enhance the navigation logic after I double click on the result list to see the source code in ABAP editor.

So finally I decide to develop a tool on my own.

Develop a tool to allow scan on UI component view source code

There are only two parameters for code scan: Search keyword and UI component whose BSP view’s html source you expect to scan.

/wp-content/uploads/2014/05/clipboard4_460123.png

You could specify multiple UI component via selection options:

/wp-content/uploads/2014/05/clipboard5_460130.png

The search result is displayed in ALV. Double click on result row,

/wp-content/uploads/2014/05/clipboard6_460132.png

and it will automatically navigate to the BSP view editor with the very line which contains the search keyword being highlighted as below:

/wp-content/uploads/2014/05/clipboard7_460136.png

This tool has simple input and output UI, but it has already 100% fulfilled my html source code scan requirement.

/wp-content/uploads/2014/05/clipboard8_460137.png

How to make this tool run on your laptop

create a new Z report and copy the source code from attached text file. This tool contains the following parts:

1. an executable report zbsp_code_view

2. a global class ZCL_BSP_CODE_TOOL

3. a function module ZCALL_EDITOR. Of course you should also have a function group, in my case it is named as zbspeditor.

4. a new screen 0101 used in FM ZCALL_EDITOR.

Flow logic:

/wp-content/uploads/2014/05/clipboard9_460138.png

 

Element list:

/wp-content/uploads/2014/05/clipboard10_460139.png

layout design:

/wp-content/uploads/2014/05/clipboard11_460140.png

Feel free to adapt this tool to meet your own requirement

Update on 2017-02-10

You can find all source code from my github.

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Richard Brünning
      Richard Brünning

      Hi, can you provide the source code again? I think it was lost in migration 🙂

      Author's profile photo Jerry Wang
      Jerry Wang
      Blog Post Author

      Hello Richard,

      Thanks for reading, I have uploaded all source code into github.

      By the way, this url contains many of my ABAP tool, you can have a look 🙂

      Best regards,

      Jerry

      Author's profile photo Richard Brünning
      Richard Brünning

      Thank you very much will do that!

      Author's profile photo Jin Dou
      Jin Dou

      Hi Jerry,

      Thanks for your blog, you forgot to upload module status_0101.

       

      Dou

      Author's profile photo Jerry Wang
      Jerry Wang
      Blog Post Author

      Hello Dou,

      Thanks a lot for reporting it. I have added the missing code to github now.

      Best regards,

      Jerry

      Author's profile photo 守言 袁
      守言 袁

      Hello Jerry,

      Your GitHub page is not available, would u pls upload the source code again.

      Thanks so much!

      Best Wishes.