‎2009 Nov 30 2:41 PM
dear all,
lets say if my data coming is with numbers and strings e.g. "123 ABC XYZ"... how can i just get the number out? because the number can be "123" for now and the next "999999" which means the length for number will always change.
and once i do get my number out... do i need to convert it from string into number? thanks for the advice.
‎2009 Nov 30 2:52 PM
Hi,
Pls. use the sample code below to resolve your issue....
DATA: w_char1 TYPE string,
w_char2 TYPE string,
w_temp TYPE string.
w_char1 = '12345 ABC DEF 12345'.
w_temp = w_char1.
WHILE w_temp IS NOT INITIAL.
IF w_temp+0(1) CO '0123456789'.
CONCATENATE w_char2 w_temp+0(1) INTO w_char2.
ENDIF.
SHIFT w_temp LEFT.
ENDWHILE.
WRITE w_char2.Thanks,
Sid
‎2009 Nov 30 2:52 PM
Hi,
Pls. use the sample code below to resolve your issue....
DATA: w_char1 TYPE string,
w_char2 TYPE string,
w_temp TYPE string.
w_char1 = '12345 ABC DEF 12345'.
w_temp = w_char1.
WHILE w_temp IS NOT INITIAL.
IF w_temp+0(1) CO '0123456789'.
CONCATENATE w_char2 w_temp+0(1) INTO w_char2.
ENDIF.
SHIFT w_temp LEFT.
ENDWHILE.
WRITE w_char2.Thanks,
Sid