‎2009 Jun 18 9:28 AM
Hi,
Please I wont to check if my line(string) content a numbre and after that I wont to extruct it.
Have u some ABAP instruction to extruct numbre from a string.
Thanks
Best regard
‎2009 Jun 18 9:40 AM
Use this:
data: v_str type string value 'SAPABAP123'.
data: v_num(3) type n.
v_num = v_str.
write:/ v_num.
‎2009 Jun 18 9:40 AM
Use this:
data: v_str type string value 'SAPABAP123'.
data: v_num(3) type n.
v_num = v_str.
write:/ v_num.
‎2009 Jun 18 9:44 AM
Hello,
Try this code:
DATA:
v_string TYPE string,
v_temp TYPE char1,
v_number TYPE string,
v_len TYPE i,
v_cnt TYPE i.
v_string = 'ABCD123EF456GH'.
v_len = STRLEN( v_string ).
DO v_len TIMES.
v_temp = v_string+v_cnt(1).
v_cnt = v_cnt + 1.
IF v_temp CA '0123456789'.
CONCATENATE v_number v_temp INTO v_number.
CONDENSE v_number.
ENDIF.
ENDDO.
WRITE: v_number.Hope this helps.
Br,
Suhas
‎2009 Jun 18 9:59 AM
Hi,
The below code will solve your problem;
Data : lv_str TYPE string,
tmp_str TYPE string.
lv_Str = 'ASFSsd123ASDF3$#s23187'.
tmp_str = lv_str.
REPLACE ALL OCCURRENCES OF REGEX '\D' IN tmp_str WITH ''.tmp_str will contain the numbers only. If it is empty mean there is no numbers in the given string.
Regards
Karthik D
Code Edited by: Karthik D on Jun 18, 2009 2:32 PM
‎2009 Jun 18 10:47 AM
hi Karthik D.
I have a erreor message :
The word "REGEX" is reserved.
have a solution for this.
Thanks for your help.
Issam
‎2009 Jun 18 10:54 AM
Hi,
What server you are working on, i dont get any error in my ECC 6.0 system. REGEX may not be supported in previous versions i guess.
Regards
Karthik D
‎2009 Jun 18 11:00 AM
‎2009 Jun 18 11:08 AM
Hi ,
Try using this Function module
'FIEB_EXTRACT_NUMBERS'
Hope this helps. Let me know if the probelm still persist.
Regards,
Janaki.
‎2009 Jun 18 11:08 AM
>
> I m working in version 4.7
>
> Issam
Sorry, i fear its not supported in version 4.7. You have to go with any of the other solutions given above.
Regards
Karthik D
‎2009 Jun 18 10:07 AM
‎2009 Jun 18 11:11 AM
DATA:
v_string TYPE string,
v_temp TYPE char1,
v_number TYPE string,
v_len TYPE i,
v_cnt TYPE i.
v_string = 'ABCD123EF456GH'.
v_len = STRLEN( v_string ).
DO v_len TIMES.
v_temp = v_string+v_cnt(1).
v_cnt = v_cnt + 1.
IF v_temp ne sy-abcd..
CONCATENATE v_number v_temp INTO v_number.
CONDENSE v_number.
ENDIF.
ENDDO.
WRITE: v_number.
‎2009 Jun 18 11:17 AM
Hi every bady,
Thank you for your help mey problem is resolved with solution of M "Mahesh Reddy" and also "Janaki Nair with FM : FIEB_EXTRACT_NUMBERS"
Thank you.
Best regard.
Issam
‎2009 Jun 18 11:14 AM