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

integer value or character value

Former Member
0 Likes
1,133

hi

i one of the fields in my report, i may get a character value like ABCD and some times only interger like 1234

and some times it may come like 12AE, it depends on case to case

now my question is i have to consider only the interger value i.e. 1234 and the other two cases should not be considered

now how to check if the filed is having character value or integer value

4 REPLIES 4
Read only

Former Member
0 Likes
754

hi! ram reddy

Hope this Helps you.

Try by using relational operator

CS (Contains String)

assign the whole 0 -9 numbers to a variable and raise a check by comparing the assigned variable and the fetched data.

Reward me if its useful.

Regards,

Nagulan

Read only

0 Likes
754

can any one tell me other way

Read only

0 Likes
754

Hi

you can do the following

IF Var1 CA sy-ABCDE and Var1 NA '0123456789'.

it is a Char completely

Elseif Var1 NA Sy-abcde and Var1 CA '0123456789'.

it is completely numeric.

else.

it is Alpha Numeric

endif.'

Regards

Raj

Read only

Former Member
0 Likes
754

Hi Ram Reddy

Please check if this code helps


REPORT  zytest.

DATA:
 w_var1(10) TYPE c VALUE 'ABC123',
 w_var2(10) TYPE c VALUE '123',
 w_var3(10) TYPE c VALUE '1a2b',
 w_num(11)  TYPE c VALUE '0123456789 '.

IF w_var1 CO w_num.
  WRITE:w_var1.
ENDIF.

IF w_var2 CO w_num.
  WRITE:w_var2.
ENDIF.

IF w_var3 CO w_num.
  WRITE:w_var3.
ENDIF.