Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Search HARD CODE with Code Inspector

Former Member
0 Likes
3,404

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

12 REPLIES 12
Read only

Former Member
0 Likes
2,360

in syntax check ->extended syntax check make sure char strings is checked,

Read only

0 Likes
2,360

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...

Read only

0 Likes
2,360

i guess its because its too small a character value.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,360

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

Read only

0 Likes
2,360

I guess it too, but there are any way to correct this?

Read only

0 Likes
2,360

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

Read only

0 Likes
2,360

yes suhash.

you are correct..

Read only

0 Likes
2,360

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.

Read only

0 Likes
2,360

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.

Read only

0 Likes
2,360

in code inspector try putting some thing in search funct.

i guess you can put patterns there

Read only

0 Likes
2,360

I am trying something right now... If I get a answer I post here!

Read only

jordi_escodaruiz
Active Participant
0 Likes
2,360

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.