Customization of code inspector
in a inspecting program in ABAP: Avoid "SELECT * or SELECT SINGLE *" All the queries SELECT * and SELECT SINGLE * queries should be output.
A new message should be created for each query.
It must be possible to restrict the search in the version to table names (eg, "ZMI_CO_ * ") in the framework of a select option.
It should be possible to further restrict the result to a column count (eg, only tables with 8 or more columns). It should be possible to give the value as parameter).
Title on the selection screen:
Select option: "Table Name" (table name)
Parameters: number of columns (column count) <Object> <objectname> line <line
<tablename> table is read with SELECT. "
Example:
Function ZMI_ARC_VBAK_CHECK line 81
Table T001 is read with SELECT.
"<Object> <Object name> line <line number
Table <Table name> is read with SELECT *. "
Example:
Function ZMI_ARC_VBAK_CHECK line 81
Table T001 is read with SELECT *.
Hi Naveen,
Please follow the below method:
Select all program names from TADIR / REPOSRC table and Function Modules from TFDIR.
For each program and main program of function module use READ REPORT statement followed by SCAN ABAP SCOUCE with tokens..
Doing above steps you will be having only un-commented code lines (One Complete code till period '.' as one record in internal table) in an internal table.
There try to find if the code Lines is having SELECT * or SELECT SINGLE * as its first 8 / 15 Chars.
If so you may try finding which table is being used there (By Splitting the one complete code at 'FROM' and spaces ).
Lastly keep appending the Desired Program names and the Line Number of Program into another table. and later you may report the Program name with line of Code or can give Interactive Functionality using EDITOR_PROGRAM function module which will Navigate to Corresponding line of code of the chosen Program.
Hoping it Helps!!
Thanks,
Preyansh
Similar Messages
-
Customizing the code inspector with check for two executable statements in same line
Hi Everyone,
I have a reuirement to customize the code inspector.I need to create a check 'Two executable statements should not be in the same line'.
While doing so i am facing one problem as in internal table it is capturing the report as word by word with same row number nd different line number.
If anyone have worked on this before then help me out.
I am using CL_CI_TEST_SCAN as superclass and making the changes in the run method.
Regards,
KhushbooIn the source code you will have this in comment right, use the "#EC ENHOK.
-
Hi Everyone,
In our project we have a requirement to automate the code review checklist preparation to the maximum extent possible.
Code Inspector has some standard checks included into it from which we can select the relevant checks for inspection purpose. My question is, whether we can customize it to add few more checks to meet our requirement or whatever standard check is there is the most we can have??????
SAP Ver 4.6c.
Any links to download relevant materials?
Any one having any custom object build for this purpose they can share it.
It would be of great help.Hi
http://help.sap.com/saphelp_nw04/helpdata/en/56/fd3b87d203064aa925256ff88d931b/content.htm
see tis link
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/50456d27-0a01-0010-ed95-ba71d8f0d74b
http://searchsap.techtarget.com/loginMembersOnly/1,289498,sid21_gci918390,00.html?NextURL=http%3A//searchsap.techtarget.com/tip/0%2C289483%2Csid21_gci918390%2C00.html
The Code Inspector (transaction code SCI) is a tool for checking Repository objects regarding performance, security, syntax, and adherence to name conventions. You can also determine statistical information 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 of an inspection, you receive information messages, warning messages, or error messages on different properties of the examined objects.
You can check the following link for details.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/events/sap-teched-03/abap%20troubleshooting
http://help.sap.com/saphelp_erp2004/helpdata/en/56/fd3b87d203064aa925256ff88d931b/frameset.htm
<b>Reward if usefull</b> -
Code Inspector: Enhancement / Adding own rules?
Hi All,
I wonder whether there is a way to add own rules to the Code Inspector.
With own rules I mean checking the coding against our development guidelines, just two examples:
1) Before SELECT ... FOR ALL ENTRIES it needs to be checked, whether the internal table is not initial.
2) No direct table update to SAP tables.
I locked to SCII. I believe it is not a solution to define a new check variant, since I haven't found the possibility there to add own rules (just naming conventions, searching for characters).
Thus, I wonder whether there is any user-exit, BAdI etc. I could use - or do I really have to write my own parser - which would be a nightmare (multiple meanings of statements (INSERT can change an internal table or database table - depending on the table / variable given); considering global variables, method parameters etc.).
Any advise is welcome!
Best regards
LarsHi Lars,
Check the below link to customize SCI as per your requirement.
http://sapignite.com/enhancement-of-code-inspector/
<removed by moderator>
Thanks
SA
Edited by: Thomas Zloch on Feb 18, 2011 5:44 PM - please do not beg for points, age old thread by the way -
Code inspector - Release of transport
Hi,
When we release the transport request, default variant of code inspector is executed.
Is there any customization for this ? If yes, were do we do setting for this? I need to use own created variant instead of default.
Regards,,,
Sunil JoyousHi,
You can create your own default variant in transaction SCI. If you create a local variant instead of a global one and call it DEFAULT it will be used instead of the standard one.
Regards,
Nick -
Hi All,
I am trying to do the check to my program i.e CODE INSPECTOR. i am seeing the following warning messages below.
1 warning message
Program zraj0xxx include zraj0xxx row 000083 Column0000
%LINR-VBUP contains a hyphen
(The Hyphen is used as a dereferencing operator! )
Note: when i double click on the above message its taking me to the below code of my program.
DATA %COUNT-VBUP(4) TYPE X.
DATA %LINR-VBUP(2).
TABLES VBPA.
DATA %COUNT-VBPA(4) TYPE X.
DATA %LINR-VBPA(2).
2 warning message
Program zraj0xxx include zraj0xxx row 000079 Column0000
Field string VLPMA is not referenced statically in the program
Note: when i double click on the above message its taking me to the below code of my program.
SELECTION-SCREEN: BEGIN OF BLOCK PROG
WITH FRAME TITLE TEXT-F58.
TABLES: VLPMA,
VLKPA.
TABLES VBUP.
3 warning message
Program zraj0xxx include zraj0xxx row 000001 Column0000
TEXT- GOH from the text pool is not used.
Note: when i double click on the above message its taking me to the below code of my program.
REPORT ZHYD0147 LINE-SIZE 255 NO STANDARD PAGE HEADING
MESSAGE-ID ZB
LINE-COUNT 065(001).
Thanks in advance.
Rajesh.Hi Rajesh,
First warning message.
DATA %COUNT-VBUP(4) TYPE X.
DATA %LINR-VBUP(2).
TABLES VBPA.
DATA %COUNT-VBPA(4) TYPE X.
DATA %LINR-VBPA(2).
Here you are not supposed to use hyphen but instead use '_'.
Second warning message
Program zraj0xxx include zraj0xxx row 000079 Column0000
Field string VLPMA is not referenced statically in the program
That means you are not using this VLPMA any where in your program so bettr delete fromt he Top Include.
Note: when i double click on the above message its taking me to the below code of my program.
Third warning message
Program zraj0xxx include zraj0xxx row 000001 Column0000
TEXT- GOH from the text pool is not used.
this also means that you are not using this Text elemnt anywhere of your program.So delete this one also.
Thanks
Rohini. -
Select query gives error in Code inspector and extended program check
Hi,
I have a query .
SELECT pernr
FROM pa9100
INTO TABLE t_nca_tab
WHERE endda EQ c_date AND
z_nca_required EQ c_yes.
This query gives me an error in Code inspector like :
Large table pa0001: No first field of table index in WHERE condition
I have one more query that gives error in extended program check
SELECT SINGLE stell ename
INTO (g_stell, g_name)
FROM pa0001
WHERE pernr EQ wa_nca_tab-pernr AND
endda EQ c_date.
The warning says:
*In "SELECT SINGLE ...", the WHERE condition for the key field "SEQNR" does not
test for equality. Therefore, the single record in question may not be unique.*
Its too urgent.
Please reply.
Regards,
Binay.The first field is PERNR .. so if UR not giving pernr it will fetch
all the data from the said table and between the given dates ..
Check if this is your requirement ...
write the select as ...
where r_pernr is a range ...
SELECT pernr
FROM pa9100
INTO TABLE t_nca_tab
WHERE pernr in r_pernr <----
endda EQ c_date AND
z_nca_required EQ c_yes.
As UR using select single it's expecting to use all the key
fields in the where condition ...
U can ignore this warning message -
Execute ABAP Code Inspector from Outside of SAP
Hi all...
For reporting purpose, I would like to use ABAP Code Inspector (transaction SCI) for generating output as a file, it should call from outside of SAP through RFC function module and generate the list (output) as flat file (or XML), does anyone have been done with similar work like this? I wonder if you could share your experience with me...
thanks in advance,
yayan irianto.I managed to set up the variant, however found a problem.
I used "Search ABAP Statement Patterns" under "Search Functs" and set the pattern like followings.
SELECT + INTO *
SELECT SINGLE + INTO *
However following statements were detected.
SELECT * INTO TABLE IT_DRAW FROM DRAW.
SELECT MANDT INTO TABLE IT_DRAW FROM DRAW.
SELECT SINGLE * INTO TABLE IT_DRAW FROM DRAW.
SELECT SINGLE MANDT INTO TABLE IT_DRAW FROM DRAW.
It's because + means one ABAP token in the code inspector.
Is there anyway to find only "SELECT SINGLE *" and "SELECT *" ? -
Hi Abapers,
I have done recording for Tcode:pa30 in my report and used call transaction method. because of this i'm getting one error in when i check code inspector.
error message:
CA CL_CI_TEST_CRITICAL_STATEMENTS0002
Critical Statements
Call of Transaction &1
&1 = Name of Transaction
For CALL TRANSACTION there must already be a suitable transaction authorization with the calling transaction.
Kindly help me out to fix this error.
Thanks in advance.Hi
Goto SE24
enter this class CL_CI_TEST_CRITICAL_STATEMENTS
and see its documentation.
It shows the all critical errors that are there in code.
Regards
Anji -
How to exclude the standard Include programs in Code Inspector?
I am running code inspector (SCi) on all the development objects using a package. But in certain repository objects standard include programs have been used. I want to exclude the standard include programs while running SCI on the package. What are the ways to achieve this?
Hi,
while defining an object set choose:(in the menu)
Edit - Exclude View Maintenance Function Groups.
This should exclude most or at least some of the includes from being checked.
Kind regards,
Hermann -
Hi All,
I am doing Code Inspector Check for my Program.
Doing this, I am getting an Error Message Indicating to use TYPE TABLE OF instead of OCCURS 0 statement while declaring Internal Tables.
Question is, Is there any difference between TYPE TABLE OF and OCCURS 0 (Performance wise) ?
Helpful answers will be rewarder by points.
Thanks & Regards
Swatantra PathakHI,
Yes.
OCCURS 0 is obsolete now.
When we define internal table with OCCURS 0 it will allocate a default memory of 8KB. In TYPE TABLE/STANDARD TABLE OF it is dynamic i.e as and when we get a record memory will be allocated.
eg: If ur itab is with OCCURS 0 and u have data of size 2kb then 6KB memory is wasted i.e allocated and not used.
eg2: If ur itab is with OCCURS 0 , Each record accupies 1 KB. Then after filling 8 records and at the time of getting 9 th records another 8KB is allocated. If u have 9 records in ur table then 7KB is wasted.
If u r getting allocated with some memory(Resource) and not using means performancewise it is bad.
Hope above examples are clear.
Thanks,
Vinod. -
Differences between SLIN and Code Inspector
Hi,
Can anyone tell me the differences between SLIN and Code Inspector(SCI)..?
and in which cases we use SLIN and SCI..?
and as an ABAPer, which one should we prefer..?
Thanks,
Pradeep.Hi
Extended syntax check or SLIN is used to check the program in all aspects for the different syntaxes like
When you use select single whether you have passed all the key fields or not>
whether you have maintained the text elements texts or not,
Have you used UNIT...CURRENCY along with the QTY and AMOUNT fields when displayed using the WRITE statement
and check for all the varities of statements used in the code, and if there is some problem with that statement/command, it will display as error or warning.
Check following links -
slin
can any one tell me abt SLIN T-CODE
Reward points if useful
Regards
Anji -
Hello,
I am trying to use the Code Inspector and I would like to check only specific Includes from a Function Group.
In my Object Set I specified the Function Group I wanted to scan (Tab Classes, Function Groups, etc.) and I specified the Include I wanted to specially verify in the Program Tab.
It takes a lot of time to run and I get a runtime error. I have about 10 Includes to check so it should not take that long.
Is there a way to combine 2 different selections in the standard selection fields without considering modifying the source code?
I've checked the Code Inspector documentation but did not really find something that could help me solve my problem.
Does anyone have a solution?
Thanks in advance.
SylvainHi guys,
Thanks for the answers but it's not solving my problem.
Here is an example of the situation I am going through:
The SAP standard program SAPLYDEVCM contains a lot of standard Includes and some new Customer specific Includes that were added during the project.
I want to scan only the Customer Includes Y* and Z*. When I enter the specific Include names the Code Inspector scan all Includes of the main program SAPLYDEVCM and that is not what I want.
Is it possible to scan only the Customer Specific Includes?
I hope my example was clear enough.
Thanks for the help.
Regards,
Sylvain -
Code Inspector Showing Error!!!
Hi All,
How to correct the following error raised by Code Inspector Check!!!!
ProgramZFTSRPRECC Include ZFTSRPRECC Row 1 Column 0
The namespace of the programZFTSRPRECC has the setting "C" and cannot be
tested
A possible cause for this is that an SAP program is being checked in a customer
system
Note, the following rule applies after a change in the sourcecode:
For testing the namespace settingis ignored for one week.
regards,
naveen.....Check the attributes of the program, whether u may be selected "C" in Application option, if yes change to something else and test.
Pls get back with the result. -
How to remove Unicode errors from extended check and code inspector
Hi
We are working on making all our ABAP program to make unicode compliant. We are activating unicode flag in attribute and correcting syntax errors. After this when we do the extended checks or SLIN or code inspector, usually giving error for many statements such as whenever there is message.
<b>Code is :</b>message a208 with text-004.
<b>Error description is</b> :
The message 208 for id zz has no long text.
You can hide this message using "#EC *
208 is - & does not exist in & &. And text 004 is - Cannot open the output file
By using #EC * we can remove errors. But Is this the correct way and what does this indicate? Please explain.Hi Yogesh,
Can you check whether the message number 208 in message id ZZ has the Self Explanatory checkbox as checked or not? I think it is not checked and u have also not maintained any long text. Hence the error.
By using #EC - you do not remove the error, however u hide it from SLIN.
It is used if there is some known error you cannot avoid which is returned by SLIN and you dont want it to be reported. Also, a way to "cheat" the reviewer who might be checking for errors.
Not good !!
Regards,
Aditya
Maybe you are looking for
-
P205-s7469 speakers not working for windows 7 64 bit
I recently upgraded from vista 32bit to windows 7 64 bit. My laptop is equiped with harman/kardon speakers, 2 main speakers and sub woofers under the laptop. The speakers worked fine under vista, now that I have windows 7 my speakers sound bad and t
-
Cards in my local Mac address book 5.0.3 won't sort - They're alphabetized but in 2 separate groupings. Can't get them combined, by first or last name. Solutions?
-
How to get last Record ior Total rows in For Loop Cursor ?
Hi Friends I would like to know , the last record in for loop cursor, i have the code in following format cursor c1 is select * from emp; begin for r1 in c1 loop v_total_rec := ? ( i would like to know total rows in the cursor , say for example if cu
-
Hi, I try to install, the SQL Express 2008 R2 with Advanced The installation has only one error (Error 1316. The Specific account already exists.) and the Management Tools Basic setup is failed. Overall summary: Final result: SQL
-
Problem with changing double to int!
Hi guys. I've got a major headache trying to solve this problem, and I'm hoping maybe someone abit wiser than I could help me out. I've added two lots of code, one where if I input 10 as the distance I get an answer of 423.529411..etc. However I want