Recently my colleague Zhang, Harry has introduced one useful tool to me and I would like to share it with you. ABAP static analysis tool SQF is a static code analysis tool developed in package SUPPORT_QUERY_FRAMEWORK in software component SAP_BASIS.

It contains lots of handy tool or short cut to other system utility tools. The most attractive function which is worthy to put it into my toolset is the static code analysis.

1. use tcode SQF, double click on “Source code Analysis”

/wp-content/uploads/2013/12/clipboard1_349711.png

2. Maintain the ABAP object which you would like to do static analysis.

In this example it is function module CRM_PRODUCT_GETLIST2. Specify the object type as well, which could be found in table TADIR.

The Analysis Depth 6 means: for example in the implementation of the FM, it calls another FM or subroutine, these delegated calls will also be analyzedby the tool. Say FM calls A and A calls B, B calls C, C calls D, D calles E, E calls F and F calls G, depth = 6 means any further calls starting from F calls G will be ignored.

/wp-content/uploads/2013/12/clipboard2_349724.png

3. Click save button and it is automatically navigated back to SQF main view. Click F8 to execute.

/wp-content/uploads/2013/12/clipboard3_349725.png

The progress will be displayed in the bottom, the bigger size of depth specified, the more time the analysis will take.

/wp-content/uploads/2013/12/clipboard4_349726.png

After execution, the color of icon changes from white to blue, which means the analysis result is available.

/wp-content/uploads/2013/12/clipboard5_349727.png

4. The analyis results are categorized into four groups:

a. Call hierarchy, something like the one in SAT.

/wp-content/uploads/2013/12/clipboard6_349728.png

b. the table read access in static call. Those table read access done via dynamic coding will be listed in group d.

/wp-content/uploads/2013/12/clipboard7_349729.png

Compare with DB access list analyzed by runtime trace SAT, there are far more entries than the static one. This is not surprising, as in CRM product, the set type access is implemented in a highly dynamic way.

/wp-content/uploads/2013/12/dy_349732.png

c. interface call:

clipboard9 (1).png

d. Dynamic coding

/wp-content/uploads/2013/12/clipboard10_349731.png


Further reading


You could still achieve the same result but use different approach – use ABAP code inspector. For details please read this blog: A Small tip to get all transparent tables used in ABAP code .


To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Jelena Perfiljeva

    Hm, we don’t have the Source Code option in this transaction. System status shows ABAP 701, SP 8.

    Also sorry if it’s a stupid question, but I’m still scratching my head – what exactly is “static analysis” (and how is it different / better than other analysis)?

    Thank you.

    (0) 
    1. Jerry Wang Post author

      Hi Jelena,

      please check the note 1814328: SQF: Plug-In for Source Code Scans.

      Regarding terminology “static analysis”, I just reuse the definition in ISTQB certification: static analysis is the analysis that could be performed without the code being executed, like syntax check, ATC check etc, while the dynamic analysis depends on the code execution in the runtime, like performance check, memory leak check analysis and so on.


      Best regards,

      Jerry

      (1) 
  2. Sandra Rossi

    Thanks a lot Jerry.

    There is one very disturbing bug when one enters the object, is that the last entered field is ignored if one presses BACK or SAVE immediately. Workaround: press ENTER or TAB so that the value is taken into account.

    For information, we may analyze “only” these object types/subobjects (source: method CREATE_FOR_OBJECT of class CL_SRC_ENTITY_ROOT) :

    • FUNC <function module>
    • PROG <prog> FORM (empty subroutine) : the whole program
    • PROG <prog> FORM <subroutine>
    • PROG <prog> CLAS <local class>
    • FUGR <func group> FORM <subroutine>
    • FUGR <func group> CLAS <local class>
    • CLAS <class pool>
    • CLAS <class pool> METH <method>
    • CLAS <class pool> CLAS <local class>
    • INTF <interface pool>
    • INTF <interface pool> METH <method>
    • INTF <interface pool> CLAS <local class>

     

    (0) 

Leave a Reply