2006 Sep 07 11:12 PM
Hi all ,
I am having a text variable .
I need to fill an internal table with it only if its a Numeric otherwise it shld not be considered .
Please advise .
Thanks in Advance .
Vivek K
2006 Sep 08 1:04 AM
of course, you may also need to consider thousands seperaters (',') and embedded spaces.
Depending on if you are checking the extra space in the field you may need to do this.
data: c(10) type c value '123.78'.
data: len type i.
len = strlen( c ).
if c+0(len) CO '0123456789.'.
* Ok, allow it.
endif.REgards,
RIch Heilman
2006 Sep 07 11:13 PM
hi,
loop at itab.
if itab-field1 CO '0123456789'.
append itab to itab1.
endif.
endloop.
Thanks,
Naren
2006 Sep 08 12:17 AM
2006 Sep 08 1:04 AM
of course, you may also need to consider thousands seperaters (',') and embedded spaces.
2006 Sep 08 2:46 AM
You can use numeric check or alternatively you can use the following code:
DATA : l_string TYPE string,
lv_lifex TYPE likp-lifex VALUE '10.001'.
MOVE 'abcdefghijklmnopqrstuvwxyz' TO l_string.
CONCATENATE l_string 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' INTO l_string.
CONCATENATE l_string
'`~!@#$%^&*()-_=+|\}]{["''";:/?>,<' INTO l_string.
IF lv_lifex CA l_string.
WRITE 😕 'Contains Characters'.
ELSE.
WRITE 😕 'Only Numeric'.
ENDIF.
For me CO dint work with '10.001' so I had to resort to the above to make it to work.
hith
Sunil Achyut
Message was edited by: Sunil Achyut
2006 Sep 08 3:57 AM
Hi
Just to add to our friends responses, you can use
FM: <b>CATS_NUMERIC_INPUT_CHECK</b> to check for pure numeric
values which will consider the decimal and unit
separator.
Kind Regards
Eswar
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |