‎2009 Sep 10 1:10 PM
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
‎2009 Sep 10 10:54 PM
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é
‎2009 Sep 10 1:13 PM
Hi,
You need to use the ABAP statement FIND. Have a read of the help for the details.
Regards,
Nick
‎2009 Sep 10 1:29 PM
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
‎2009 Sep 10 1:36 PM
Hi,
In my WebAS 7.0 system this is not marked as obsolete. Which release are you using?
Regards,
Nick
‎2009 Sep 10 10:54 PM
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é