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

ABAP formule text

Former Member
0 Likes
578

Hello,

I am looking for an ABAP formule witch returns the indice of a caractere in a text.

for example : I want to know the indice of the first "blank".

In the Text "CELL 2 10 512" the fisrt blank is the 5th caractere.

Thanks for your help.

Karol Walesch

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
544

Hi ,

Try this:

DATA : ipstr TYPE string.

DATA : len TYPE i VALUE 0.

DATA : ch TYPE char1.

DATA : num TYPE i VALUE 0.

DATA : pos TYPE char3.

ipstr = 'CELL 2 10 512'.

len = STRLEN( ipstr ).

DO len TIMES.

ch = ipstr+pos(1).

pos = pos + 1.

IF ch = space.

num = pos.

WRITE: 'Blank foud in position: '.

WRITE: num.

ENDIF.

ENDDO.

Hope this information is help to you.

Regards,

José

4 REPLIES 4
Read only

Former Member
0 Likes
544

Hi,

You need to use the ABAP statement FIND. Have a read of the help for the details.

Regards,

Nick

Read only

Former Member
0 Likes
544

hi,

thanks for your help,

but when am looking the statement FIND, it's written that it is a obsolete statement. isn't there an other statement or function to do that ?

Thanks,

Karol Walesch

Read only

0 Likes
544

Hi,

In my WebAS 7.0 system this is not marked as obsolete. Which release are you using?

Regards,

Nick

Read only

Former Member
0 Likes
545

Hi ,

Try this:

DATA : ipstr TYPE string.

DATA : len TYPE i VALUE 0.

DATA : ch TYPE char1.

DATA : num TYPE i VALUE 0.

DATA : pos TYPE char3.

ipstr = 'CELL 2 10 512'.

len = STRLEN( ipstr ).

DO len TIMES.

ch = ipstr+pos(1).

pos = pos + 1.

IF ch = space.

num = pos.

WRITE: 'Blank foud in position: '.

WRITE: num.

ENDIF.

ENDDO.

Hope this information is help to you.

Regards,

José