2014 Apr 03 12:47 PM
Good Morning Gurus.
I Have a Dump , this dump occurs because my program Check a variable numeric but in this variable have a value with letters ,then occurs dump.
STATICS: v_catly TYPE zcatly,
v_msgtx TYPE zmensagem_t.
IF v_catly IS INITIAL OR v_catly = ' '.
EXIT.
ENDIF.
v_catly is type numeric ,but when check " IF v_catly IS INITIAL OR v_catly = ' '." it has the value ' BEA-3 .
The beter solution is?
1- check if variable have letters with 'CS, CA' ,if yes move to variable char or exist other way.
ERROR:
An exception occurred that is explained in detail below.
This exception cannot be caught in the context of the current statement.
The reason for the exception is:
The program attempted to interpret the value "BEA-3" as a number, but
since the value contravenes the rules for correct number formats,
this was not possible.
Thanks
2014 Apr 03 2:17 PM
Hi Ronaldo,
REPORT zao.
START-OF-SELECTION.
*-----------------------
DATA: v_catly(8) TYPE n VALUE 78213970.
IF v_catly CO '0123456789'.
WRITE: 'numbers'.
ENDIF.
*----------------------
DATA: lv_str TYPE string.
lv_str = '782g13970'.
FIND FIRST OCCURRENCE OF REGEX '([a-zA-Z])' IN lv_str.
IF sy-subrc = 0.
WRITE:/ 'letter'.
ENDIF.
2014 Apr 03 1:00 PM
2014 Apr 03 1:34 PM
2014 Apr 03 2:11 PM
Then simply move this value to a char variable and compare stuff
2014 Apr 03 1:38 PM
2014 Apr 03 1:50 PM
2014 Apr 03 1:53 PM
Hi Ronaldo,
Keep a temporvary Character variable and use it for check or any other purpose. In temporvary character variable you can pass numeric values also.
So what you do is assign that numeric variable value to that temporvary variable of type character and then do the process.
I hope this helps you. If there is any issues please revert back to me i will help you.
Regards,
Sri Hari Anand Kumar
2014 Apr 03 2:17 PM
Hi Ronaldo,
REPORT zao.
START-OF-SELECTION.
*-----------------------
DATA: v_catly(8) TYPE n VALUE 78213970.
IF v_catly CO '0123456789'.
WRITE: 'numbers'.
ENDIF.
*----------------------
DATA: lv_str TYPE string.
lv_str = '782g13970'.
FIND FIRST OCCURRENCE OF REGEX '([a-zA-Z])' IN lv_str.
IF sy-subrc = 0.
WRITE:/ 'letter'.
ENDIF.
2014 Apr 03 3:31 PM
2014 Apr 03 2:52 PM