Application Development 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: 

Numerics in a string...

Former Member
0 Kudos

Hi all!

I am looking for a FM to find and identify numerics or alphanumerics contained in a string. I know I can use 'ca'... but I look for a standard FM.

Thanks!

Miguel Angel.

Message was edited by:

Miguelangel Julian

1 ACCEPTED SOLUTION

Former Member
0 Kudos

check FM NUMERIC_CHECK

but why do u want to go for FM where there is an easy way using CA

6 REPLIES 6

Former Member
0 Kudos

check FM NUMERIC_CHECK

but why do u want to go for FM where there is an easy way using CA

0 Kudos

Hello!

Really what I need is a FM that says me...

String_In: AB12C

Results:

Position1: char

Position2: char

Position3: num

Position4: num

Position5: char

or something like this...

Thanks!

Former Member
0 Kudos

Hi,

CONVERSION_EXIT_ALPHA_INPUT

converts any number into a string fill with zeroes, with the number at the extreme right

Example:

input = 123

output = 0000000000000...000000000000123

CONVERSION_EXIT_ALPHA_OUTPUT

converts any number with zeroes right into a simple integer

Example:

input = 00000000000123

output = 123

Reward if helpful.

Regards

Raghavendra.D.S

Former Member
0 Kudos

then chandrasekhar gives you the correct fm here only you have to process character by character of a string...

data : text(15) value 'ABC12D',

len type i,

pos type i,

vchar.

compute len = strlen( text ).

do len times.

vchar = text+pos(1).

now use fm numeric_check and pass vchar here in eimport param you get htype.

write : / 'Pos', sy-index ,' is', htype.

pos = pos + 1.

enddo.

regards

shiba dutta

0 Kudos

Thanks Shiba!

You are right, but i'm looking for the same functionality you said, but in a standard FM. There is any like this? If no, there is no problem, I will say to my partner I need to create a Z function.

Thanks all!

Former Member
0 Kudos

Hi,

Try this,

data: c(10) type c.

c = '15684648ab'.

if c co '0123456789'.

write:/ 'All numeric'.

else.

write:/ 'Not all numeric'.

endif.

Regards,

Padmam.