‎2020 Apr 28 3:33 PM
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 ?
‎2020 Apr 28 3:47 PM
Spelling of the word OCCURRENCE : you use one 'R'. Warning asks you to use 2 'R'
occurences
occurrences
‎2020 Apr 28 3:47 PM
Spelling of the word OCCURRENCE : you use one 'R'. Warning asks you to use 2 'R'
occurences
occurrences
‎2020 Apr 29 6:11 AM
‎2020 Apr 28 4:42 PM
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)
‎2020 Apr 28 9:43 PM
Use OCCURRENCES instead of OCCURENCES (occuRRences vs. occuRences)
" 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.

‎2020 Apr 29 6:15 AM
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
‎2020 Apr 29 6:49 AM
the error was simple, I use a string, so no way to convert blank with 0
‎2021 Nov 10 10:24 PM
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.