cde insceptor

download cde insceptor

of 8

Transcript of cde insceptor

  • 8/13/2019 cde insceptor

    1/8

    Most of the time we do developments and when it comes to checking or doing the review of the code wegenerally use Code Inspector and EPC i.e. Extended Program Check.

    But have you ever wondered what these tools are doing behind the scene?

    You can call the Code Inspector for the relevant single objects directly from the ABAP Editor (SE38), theFunction Builder (SE37), or the Class Builder (SE24) ( Object->Check->Code Inspector ). The system thenchecks using a default check variant which is provided by SAP.

    SE38

    SE37

  • 8/13/2019 cde insceptor

    2/8

    So in this post I will give an overview of how we can use the potentials of code inspector and how we canpin point the errors and deliver the best quality code with adherence to ABAP coding guidelines.

    What is Code Inspector?

    The Code Inspector is a tool for checking Repository objects regarding performance, security, syntax,and adherence to name conventions.

    Using the Code Inspector (transaction code SCI ), you can check individual objects or sets of objects forperformance, security, syntax, and adherence to naming conventions. You can also determine statisticalinformation or search for certain ABAP words (tokens). In the Code Inspector, you can

    define inspections that, with the help of check variants , examine certain sets of objects. As the result ofan inspection, you receive information messages, warning messages, or error messages on differentproperties of the examined objects.

    Limitations:

    The range of functions in the Code Inspector is limited to checking static object definitions and cantherefore only point out certain problems.

    It cannot, for example, give a precise statement as to how the overall performance of a program is. To beable to do this, you need to analyze program execution yourself at runtime for example, using theRuntime Analysis Tool (transaction code SE30), the Performance Trace (ST05), or the GlobalPerformance Analysis Function (ST30).

    How to start Code Inspector?

    You can call the Code Inspector using transaction code SCI or through the menu path SAPMenu Tools ABA P Workbench Tes t Code Inspec to r .

    You can call the Code Inspector using transaction code SCI or through the menu path SAPMenu Tools ABAP Workbench Test Code Inspector.

  • 8/13/2019 cde insceptor

    3/8

    Below is the screen when you start Code Inspector.

    We have three Blocks as below:

    1. Inspection

    2. Object Set

    3. Check Variant

    What is Inspection?

    Inspection is the process of checking individual objects or set of objects as to whether certainprogramming guidelines have been adhered to. The result of an inspection run is a list of the individualchecks made with errors, warnings, or information messages. There are two types of inspections. Theydiffer with respect to whether the results are made persistent or not.

    Persistent inspections with results storageFor execution on the local server or parallel execution on the server group. You can plan persistentinspections as background jobs and use them for any size of object set.

    Anonymous or ad-hoc inspections without results storageFor execution on the local server and for fewer than 50 objects. You can execute ad-hoc inspections inonline mode only.

    When you give a name in inspection box and click create icon following is the screen you get.

  • 8/13/2019 cde insceptor

    4/8

    In the screen above you can see we can do inspection of an Object set (we will see shortly what thatmean) which can be thought of as a collection of objects, Or we can do inspection of objects capturedunder any transport request by selecting the Request/Task radio button.

    We can also do inspection of individual objects by selecting the Single radio button and giving the type ofobject and giving the name in the input box.

    The next thing is Check Variant which is kind of collection of check rules that we have to follow whileinspecting any object.

    What are Object Sets?

    They are collection of several single objects together in a group/set. Sets of objects include, for example,programs, function groups, classes, or DDIC objects.In general, any Repository objects can be includedin a set of objects.

    There are global and local sets of objects.Global sets of objects are visible for all users while local objectsare only visible for a single user. You can create global sets of objects only if you have the appropriateauthorizations

    .. .Previous

    Below is the screen you will get when you give the Object Set name and click the create icon.

    There are lots of filters that you can use to group objects into an object set.

    http://www.saptechnical.com/Tutorials/ABAP/CI/Index.htmhttp://www.saptechnical.com/Tutorials/ABAP/CI/Index.htmhttp://www.saptechnical.com/Tutorials/ABAP/CI/Index.htmhttp://www.saptechnical.com/Tutorials/ABAP/CI/Index.htm
  • 8/13/2019 cde insceptor

    5/8

    What are Check Variants?

    This is the most important and most crucial component in Code Inspector. The Check Variants arenothing but the rules to be checked when we do the inspection. The system checks the individual objectsof a defined set of objects for certain attributes using the check variant.

    SAP supplies the global DEFAULT variant, which you can use to check objects from within the

    workbench i.e. when you do from SE24, SE37, SE38 or SE80. You can anytime enhance the predefinedlist of check categories and individual checks supplied by SAP but with restriction that you have properauthorizations to change or create check variants.

    The individual checks are assigned to different check categories. The following list shows examples ofcheck categories and individual checks.

    General checks contain formatting elements, such as listing table names from SELECT statements.

  • 8/13/2019 cde insceptor

    6/8

    Performance checks contain checks for performance and for resource use, such as:

    1. Analysis of the WHERE condition for SELECT / UPDATE and DELETE

    2. SELECT statements that read past the table buffer

    3. Low-performing accesses to internal tables

    Security checks contain checks for critical statements, cross-client queries, inadequate authoritychecks.

    Syntax check / generation contains ABAP syntax check, an enhanced program check, and generation:

    Programming conventions contain checks for name conventions.

    Search functions contain searches in ABAP coding for tokens (words) and statements.

    These are just to mention the most important but there are lot more you can explore.

    Give an appropriate name for the check variant based on the checks it will perform and click the createicon. It will take you to the following screen:

  • 8/13/2019 cde insceptor

    7/8

    If we select the check box for a category all sub items will be checked, you can manually select multipleitems from the tree structure and enable the checks.

    There is an arrow shown in attributes column where you can again do a pinpoint check. Clicking on theattributes arrow will open more options to be checked.

  • 8/13/2019 cde insceptor

    8/8

    For every check there is documentation provided where you can see how this check will work and whatresults you can expect after the inspection.

    So go and dig down into the options provided and do not just rely on the results of Workbench Codechecks. Create a custom check variant where it will check for all the possible errors that one can expectto be rectified in static review of the code.