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

Filter Numeric Variables

Former Member
0 Likes
896

Hi Experts,

I wanted the way how I can identify the particular variable is wheather character type or numeric type??

For example in my database i have records like abc, xyz, 125 etc.

Now I wanted to filter the data based on numeric & character file. Say in one table i want XYZ, ABC & in other one I want 125.

I believe that we have certain system fields available. Let me suggest.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
823

Hi Neha,

Try using the logic

itab-(fieldname) > 0. "Field value

if yes numeric.

else.

not numeric.

endif.

Thanks,

Kasiraman R

5 REPLIES 5
Read only

Former Member
0 Likes
824

Hi Neha,

Try using the logic

itab-(fieldname) > 0. "Field value

if yes numeric.

else.

not numeric.

endif.

Thanks,

Kasiraman R

Read only

Former Member
0 Likes
823

Hi,

Neha

for tht u declare two internal tables

then in another internal table get database records then do like this

loop at maininternaltable.

if record co '0123456789'.

append to first_itab.

else.

append to second_itab.

endif.

if u do in this way u r problem get solves.

plzz reward if usefull

feel free to ask any quiries my mail id is mutyalasunilkumar@gmail.com

plzz dont forget to reward if useful.

Read only

Former Member
0 Likes
823

Hi

Neha still if u dont get the answer plz dont hesitate to ask

and if u r problem is solved plzz reward

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
823

Hi,

sy-abcde will tell you whether the value ia alphabet.For numbers, you need to declare a varaible of 10 character length with value '0123456789' as suggested. If there is no alphanumeric, then you can code

if v1 ca sy-abcde.

"move it to itab1.

elseif v1 ca '0123456789'.

"move it to itab2.

endif.

Read only

Former Member
0 Likes
823

Hi,

Use FM 'NUMERIC_CHECK' to find out whether the value is numeric or char.

Input: 123

Result : HTYPE : NUMC

INPUT: 35CA

Restul : CHAR

Hope this helps you.