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

How to capture First Statement

umashankar_sahu
Active Participant
0 Likes
1,274

Hi All

I want to search some key words like Search and condense used in programs, all programs i am reading in internal table one by one (itab).

example

loop at itab.

itab-text CS 'SEARCH '.

i am looking for the text which starts with Search means

Search a in b.

.......... search a in b.

..................... search a in b.

cosider dots as a spaces (blanks, take it like it is written after some offset)

any format in particular line where it should starts with search.

and i want to avoid text like

loop at itab " for search a in b.

or any thing which is not satrts with search key word as well when its present after some letters also i want to avoid.

i mean to say that in particular line of program which should starts with Search first character should be search may be it is after some spaces.

pls suggest how to achieve this

thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,240

Use the SEARCH statement:

loop at itab.
condense itab-data.
SEARCH ITAB-data for 'search' staring at 0 ending at 5.
if sy-subrc = 0.
write:/ 'Search String found'.
endif.
endloop.

Regards,

Ravi Kanth Talagana

7 REPLIES 7
Read only

Former Member
0 Likes
1,240

hi,

you mean that , u want to search Keyword in all your customized program.

please give more details.

Sanket.

Read only

0 Likes
1,240

yah it is for all program which are presnt in particular server whether its customized or standard it depends on what given in selection citeria like Z* or Y* or SAP*

Read only

Former Member
0 Likes
1,240

hi,

Use

SCAN ABAP SOURCE OBJECT KEYWORDS INTO T_KEYWORDS..

.etc.

Using the above statement you can have all the keywords in a program into the internal table t_keywords. Try with F1 for more information.

Using SCAN you can even check for INCLUDES and also any Z Function modules using the SEARCH key word in your custom program.

Regards

Sharath

Read only

Former Member
0 Likes
1,241

Use the SEARCH statement:

loop at itab.
condense itab-data.
SEARCH ITAB-data for 'search' staring at 0 ending at 5.
if sy-subrc = 0.
write:/ 'Search String found'.
endif.
endloop.

Regards,

Ravi Kanth Talagana

Read only

0 Likes
1,240

hi ravi

i tried with your solution but its covering

len_Search type i,

SELECTION-SCREEN COMMENT 1(25) text170 FOR FIELD c_search.

but my requirement is in particular line if the first word is Search whether it should start with first position or after certain offset position but in that particular line the first word should be Search

Read only

Former Member
0 Likes
1,240

PARAMETERS: P_NAME TYPE FNAME.

CONDENSE P_NAME.

TRANSLATE P_NAME TO UPPER CASE.

IF P_NAME+0(6) EQ 'SEARCH'.

WRITE 'Success.'.

else.

write 'Fail.'.

endif.

this code ignores prepadded spaces and tabs.

Read only

andrea_olivieri
Contributor
0 Likes
1,240

Hi,

why don't you try the standard abap program RPR_ABAP_SOURCE_SCAN?

This abap is designed to search for ABAP program code/screen flow logic for specific texts.

You can use multi-search string (patterns are allowed) in a program or a program set.

It's very powerful.

Enjoy it.

Kind regards.

Andrea