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

splitting a string

Former Member
0 Likes
586

Hello,

i have a string in this form,

ABCDEFGHI 123456-23 , from which i only want 'ABCDEFGHI'. Is their any SAP method or string function which cuts the string to the point where a number starts.

Thanks..

Shehryar

4 REPLIES 4
Read only

Former Member
0 Likes
551

HI dahar,

Do this way...

<b>

v_string = 'ABCDEFGHI 123456-23'

split v_string at ' ' into v_target.

</b>

Regards,

Santosh

Read only

Former Member
0 Likes
551

Hi,

One solution you van try is

data :str1(20) type c value 'ABCDEFGHI 123456-23'

REPLACE '0123456789-' WITH ' ' INTO str1.

Regards,

Sumit.

Read only

Former Member
0 Likes
551

data : v_str type string,

v_substr type string,

v_position type i.

v_str = 'ABCDEFGHI 123456-23'.

break-point.

if v_str ca '123456789'.

write 😕 sy-fdpos.

v_position = sy-fdpos.

v_substr = v_str+0(v_position).

endif.

write 😕 v_substr.

Read only

Former Member
0 Likes
551

hi,

goto ABAPDOCU transaction code,

click on keyword help,

write STRING,continue

you will get different string operations,

check them,

regards,

kcc