‎2009 Aug 20 1:28 PM
Hi everyone!
I need o find hard code iin many programs, but I am not finding the right item I have to mark in Code Inspector to find it!
Ex: IF l_bwart EQ '280'.
This kind of text '280' is never showed in Code Inspector. How can I create a Inspection just to catch this kind of instruction?
Tks
‎2009 Aug 20 1:31 PM
in syntax check ->extended syntax check make sure char strings is checked,
‎2009 Aug 20 1:36 PM
Yes, it is checked but return no errors.
I created a test report with the code:
REPORT ztest.
DATA: l_bwart TYPE bwart.
l_bwart = '280'.
IF l_bwart = '280'.
Write: l_bwart.
ENDIF.
I checked just this check and returned no erros...
‎2009 Aug 20 1:50 PM
‎2009 Aug 20 1:53 PM
Hello Marcos,
I donot think that you can check this "type of hardcoding" with Code Inspector / Extended Syntax Check.
As suggested in earlier posts, you can try to check the "character string" hardcoding with Extended Syntax Check.
@Soumya: '280' is not a "character string" hardcoding.
Try like this:
DATA: l_bwart TYPE string.
l_bwart = 'Code'.
IF l_bwart = 'ABCD'.
WRITE: l_bwart.
ENDIF.BR,
Suhas
‎2009 Aug 20 1:53 PM
‎2009 Aug 20 2:00 PM
Ok, but I have to look out to a package of programs to discover this kind of Hard Code...
Edited by: Marcos Antonio Munhós on Aug 20, 2009 3:01 PM
‎2009 Aug 20 2:01 PM
‎2009 Aug 20 2:14 PM
do one thing.
write a report.
which first reads the report using read report
and then loop at the report table and check for ' ' except data declaration parts.
‎2009 Aug 20 2:18 PM
It can work, but here we use a tool that use a inspection of code inspector to do the job!
My question is: There are any way to customize the Code Inspector Inspection to catch exactly what you said? Literals character like '280', for example.
‎2009 Aug 20 2:30 PM
in code inspector try putting some thing in search funct.
i guess you can put patterns there
‎2009 Aug 20 3:02 PM
I am trying something right now... If I get a answer I post here!
‎2009 Nov 11 3:20 PM
Dear Marcos
This thread is answered, but it's worth to add this answer.
You can find any hard code with Code Inspector (SCI).
To do so, proceed as follows:
1-Create a new check Variant, named for example ZSEARCH
2-Open the folder "Search Functs."
3-Press the button to "Find Unwanted Language Elements"
4-In the Unwanted Language Elements dialog press the button of Find Unwanted Language Elements block
5-Un the Multiple Selection for Unwanted Language Elements press the trash button to empty the default elements
6-Inform * '280' * (note the blank spaces between * and ', ' and *
7-Accept dialogs
8-Save the check Variant
9-Go back
10-Create a new Inspection, named for example ZSEARCH
11-In the check variant block select ZSEARCH
12-Select a single program or a Object Set.
13-Launch the search.
Hope this helps.