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

extract numc from string

Former Member
0 Likes
524

Hi!!

Is there any FM which helps u to fetch the NUMC value from a string

Eg: if the string is asdet5756frgd it shud give the output as 5756.

2 REPLIES 2
Read only

Former Member
0 Likes
399

REPORT  zzztest.

DATA:str(20) TYPE c VALUE 'abcd 1234225523 xyz',
num(10) TYPE n.

num = str.

WRITE:/ num NO-ZERO.

all you need to take care about is, that your num variable is long enough to take all the digits in your string.

Edited by: Florian Kemmer on Feb 26, 2008 2:02 PM

Read only

Former Member
0 Likes
399

Hi,

You can do as below :



data : var(10) type c value 'ACNC12345'.
data : num(10) type n.

num = var.
shift num left deleting leading '0'.
write num.

O/P : 12345.