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

extracting 'text-'

Former Member
0 Likes
407

Hi,

I want to display only list of all 'Text-...' in given code.

I am able to get entire string containing 'Text-...'

eg:

READ REPORT 'ZTEST_AM_ALV1' into itab.

loop at itab into wa.

if wa co 'text-'.

write : / sy-tabix,

result.

endif.

endloop.

o/p:all the lines having 'Text-...'

but,

I want only the list of 'Text-...'

Thanks.

3 REPLIES 3
Read only

Former Member
0 Likes
390

Try this..

<b>data : begin of it_text occurs 0,

text(8),

end of it_text.</b>

READ REPORT 'ZTEST_AM_ALV1' into itab.

loop at itab into wa.

<b>search wa for 'TEXT-'.

if sy-subrc eq 0.

it_text-text = wa+sy-fdpos(8).

append it_text.

clear it_text.

endif.</b>endloop.

Read only

Former Member
0 Likes
390

Hi,

data: w_text(10) type c.

READ REPORT 'ZTEST_AM_ALV1' into itab.

loop at itab into wa.

if wa cs 'text-'.

w_text = wa+sy-fdpos(5).

concatenate w_text 'text-' into w_text.

write : / sy-tabix,w_text.

endif.

endloop.

only the list of 'Text-...'

Message was edited by:

Rammohan Nagam

Read only

meikandan_krishnan2
Participant
0 Likes
390

READ REPORT 'ZTEST_AM_ALV1' into itab.

data count type i.

loop at itab into wa.

REPLACE ALL OCCURRENCES OF 'Text-' IN text WITH new REPLACEMENT COUNT rcount

count = count + rcount.

write : 'Count in iteartion number , sy-tabix , 'is' , count.

endloop.

write 😕 'total text counts' , Count.

Use ignoring case if necessary