‎2006 Aug 17 10:40 AM
I want to extract numeric string from astring.
it should stop reading if it hits an alphabet that is requirement.it is not that numeric string is of fixed lenght but it will be in begining.
example:78965rocksalt
result:78965.
‎2006 Aug 17 10:43 AM
REPORT ZTESTH .
DATA: P(5) TYPE N,
T TYPE I.
P = '123AD'.
T = P.
WRITE T.
execute above report and check. it will solve ur doubt
‎2006 Aug 17 10:46 AM
you can use the below logic.
lstr = '121354ad'.
if lstr ca sy-abcde.
write lstr+0(sy-fdpos) to lnum.
endif.
Regards
Anurag
Please note you might need to translate to upper case as CA is case-sensitive.
Message was edited by: Anurag Bankley
‎2006 Aug 17 10:47 AM
Hi,
Declare the variable as type N.
data: a1(20) type c value '78945asdfaf',
a2(5) type n.
a2 = a1.
write:/ a1,
/ a2.
regards
Subbu
‎2006 Aug 17 11:03 AM
Hi,
use fm PREPARE_STRING
DATA zahl(11) VALUE ' 0123456789'.
CALL FUNCTION 'PREPARE_STRING'
EXPORTING
i_valid_chars = zahl
i_xvalid_check = 'X'
i_xchar_repl = 'X'
i_xtoupper = 'X'
CHANGING
c_string = example.
CONDENSE example NO-GAPS.
result = example.Andreas
pls reward useful answers
thank you