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

REPLACE ALL OCCURENCE ... warning message in Eclipse

FredericGirod
Active Contributor
0 Likes
2,962

Hi,

I use this command:

    replace all occurences of ' ' in rv_temps with '0' in character mode.

(because I don't know enough regex)

but Eclipse give me a very interesting warning message :

Description	Resource	Path	Location	Type
Use OCCURRENCE(S), not OCCURENCE(S). OCCURENCE(S).	ZCL_CA_HEURE_CALCUL (Global Class)	[XXX] 

the statement works, but I don't like warning message. Do you have any idea ?

1 ACCEPTED SOLUTION
Read only

chaouki_akir
Contributor
2,528

Spelling of the word OCCURRENCE : you use one 'R'. Warning asks you to use 2 'R'

occurences
occurrences
7 REPLIES 7
Read only

chaouki_akir
Contributor
2,529

Spelling of the word OCCURRENCE : you use one 'R'. Warning asks you to use 2 'R'

occurences
occurrences
Read only

2,528

🙂

I could read it one hundred times without see that 🙂

Read only

Sandra_Rossi
Active Contributor
2,528

Your statement is not REGEX, the word REGEX is missing 😉

You may also use (for a regex):

rv_temps = replace( val = rv_temps regex = '...' with = '0' occ = 0 ).

(occ = 0 means all occurrences)

(NB: REPLACE function is slightly slower than REPLACE statement)

Read only

michael_piesche
Active Contributor
2,528

Use OCCURRENCES instead of OCCURENCES (occuRRences vs. occuRences)

  1. Wrong spelling of option OCCURRENCES in statement REPLACE only leads to syntax warning
  2. Wrong spelling of option OCCURRENCES in statement FIND leads to syntax error
" correct spelling of option OCCURRENCES in statement FIND
FIND ALL OCCURRENCES OF ' ' IN rv_temps RESULTS rs.
" wrong spelling of option OCCURRENCES in statement FIND leads to syntax error
FIND ALL OCCURENCES OF ' ' IN rv_temps RESULTS rs.

" correct spelling of option OCCURRENCES in statement REPLACE
REPLACE ALL OCCURRENCES OF ' ' IN rv_temps WITH '0' IN CHARACTER MODE.
" wrong spelling of option OCCURRENCES in statement REPLACE only leads to syntax warning
REPLACE ALL OCCURENCES OF ' ' IN rv_temps WITH '0' IN CHARACTER MODE.

Read only

FredericGirod
Active Contributor
2,528

my sentence wasn't complete, I would like to say : I do not use REGEX because I don't know enough REGEX.

For the funny end of the story, I remove all this and replace by the old way (maybe R/2 way): complete field with 0

And strange things, the code compile with the error in OCCURENCES, but the ABAP UNIT gives me an fatal error with something about loop without end ...

I will try to replace it with a beautiful REGEX 🙂 Thanks Sandra

Read only

FredericGirod
Active Contributor
0 Likes
2,528

the error was simple, I use a string, so no way to convert blank with 0

Read only

2,528

This is a well know spelling error in the ABAP language implementation.
The keyword was misspelled the keyword in an initial shipment.
As the correct version ( occurRences ) was only introduced later and customers had adopted the first variant, for compatibility reasons it could not be removed and both variants work currently.

However, SAP strongly suggest to use the 2nd correct version, thus the warning.

replace all occurences of ' ' in rv_temps with '0' in character mode.
replace all occurrences of ' ' in rv_temps with '0' in character mode.