WRITTEN BY: supportmymoto.com STAFF
What’s Code Inspector?
The Code Inspector is a instrument for checking Repository objects.
Utilizing the Code Inspector, we are able to examine particular person objects or units of objects for efficiency, safety, syntax, and adherence to call conventions.
Within the Code Inspector, you may outline inspections that, with the assistance of examine variants, look at sure units of objects.
As the results of an inspection, you obtain info messages, warning messages, or error messages on completely different properties of the examined objects
The ideas are defined within the weblog by Nick Younger Establishing and utilizing the SAP Code Inspector.
On this weblog we see the step-by-step tutorial for utilizing Code Inspector.
The summarized fundamental ideas are as beneath:
What’s Verify Variant, Object Set, Inspection within the context of Code inspector?
- Verify Variant – This defines the principles to be utilized, which checks are to be made and the settings of these checks.
- Object Set – This defines the event objects that can be included.
- Inspection – This defines a mix of Verify Variant and Object Set, in different phrases what checks are to be utilized to which growth objects.
What’s the distinction between native and World Verify Variants?
- World parts can be found to all customers.
- Native parts are related instantly with a selected person id.
- SAP gives a World Verify Variant with the identify ‘DEFAULT’. That is used for objects which can be checked from the context menu of Applications, Lessons, Perform modules and so on.
- In your username, In case you create a Native Verify Variant with the identify DEFAULT, the system will use this as an alternative of the worldwide examine variant.
Process 1)Browse the World ‘DEFAULT’ examine variant.
The World DEFAULT examine variant can be displayed as proven beneath:
Allow us to not change the World DEFAULT examine variant.
Process 2) Create Native DEFAULT examine variant.
Allow us to create a Native DEFAULT variant (for the logged in person) by copying from World DEFAULT variant.
Save the Native DEFAULT Verify Variant.
Right here onwards everytime you use the Code Inspector from a context-menu of a program, Perform module, Class, and so on, the native DEFAULT variant is used (as an alternative of the worldwide DEFAULT variant) for analyzing the code.
Process 3) Create a Pattern program and look at with (native) DEFAULT variant of code inspector.
Create a program ZTEST_ONE.
if wanted, you may copy from beneath textarea:
After activating this system, execute the code inspector as proven beneath.
The Outcomes can be displayed as below:
The warning messages present that naming conventions aren’t adopted for the names spfli_table, alv_obj, alv_exc_obj and row_count.
The ‘DEFAULT’ examine variant enforces the rule “World knowledge declarations in program have to be prefixed with letter G adopted by letter akin to sort of the information – T for inner tables, O for object references, X for exception objects, E or V for elementary sorts.”
So the names in our pattern program ought to start with gt_*, go_*, gx_*, gv_* or ge_* based mostly on their sorts.
Go to this system and make adjustments as proven beneath:
Execute the code inspector.
Process 4)Create a non-DEFAULT examine variant.
Create a brand new Code Inspector Verify Variant (non DEFAULT).
Save the variant.
Process 5) Validate the pattern program in opposition to the newly created Non-DEFAULT Verify Variant.
Create an ObjectSet.
Create an Inspection, and Execute.
The outcomes can be displayed as proven in subsequent display screen.
Right the Program.
Activate the Program.
To run the inspection ZCI_01 once more, we have to create a brand new model of the inspection ZCI_01.
Create a brand new model of Inspection:
Execute new model of Inspection.
You will note outcomes as proven beneath: