Application Development 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: 

search a field name in n number of reports

Former Member
0 Kudos

LOOP AT itab_report. -


contains list of reports

CLEAR: progline, tb_report.

READ REPORT itab_report-master INTO tb_report.

DESCRIBE TABLE tb_report LINES progline.

LOOP AT itab_x031l.

{ find search terms }--


MOVE itab_x031l-fieldname TO searchstring.

LOOP AT tb_report.

IF tb_report IS INITIAL.

CONTINUE.

ENDIF.

MOVE tb_report TO progdata.

SEARCH progdata FOR searchstring.

the problem here is the exact match for the field is not obtained .....

eg if the field name is mandt......sy-mandt is also shown,which i dont want

can neone help me with this......can neone help me with scan abap source ,i thnk tat cod solve ma problem cos

1 ACCEPTED SOLUTION

0 Kudos

Hi,

if you want to find only mandt and not sy-mandt search for ' mandt ' (include spaces into searchstring).

REPORT ZEND_TEST17 .

DATA: text TYPE string VALUE 'sy-mandt',

pos TYPE i.

SEARCH text FOR ' mandt'.

if sy-subrc = 0.

write / 'yes'.

else.

write / 'no'.

endif.

SEARCH text FOR 'mandt'.

if sy-subrc = 0.

write / 'yes'.

else.

write / 'no'.

endif.

regards steffen

11 REPLIES 11

0 Kudos

Hi,

if you want to find only mandt and not sy-mandt search for ' mandt ' (include spaces into searchstring).

REPORT ZEND_TEST17 .

DATA: text TYPE string VALUE 'sy-mandt',

pos TYPE i.

SEARCH text FOR ' mandt'.

if sy-subrc = 0.

write / 'yes'.

else.

write / 'no'.

endif.

SEARCH text FOR 'mandt'.

if sy-subrc = 0.

write / 'yes'.

else.

write / 'no'.

endif.

regards steffen

0 Kudos

its not with mandt only dear, i have some thousands of fields

n i have to search all of them simultaneusly in the Zobjectsssss

can u help me now...chck the cod i have used search for command only

0 Kudos

Hi,

i'm afraid i don't really understand your problem

why don't you just use

concatenate ' ' itab_x031l-fieldname INTO searchstring.

instead of

MOVE itab_x031l-fieldname TO searchstring.

should at least fix the 'mandt'/sy-mandt problem.

regards

Steffen

0 Kudos

i have written the code myself ,my selection screen takes table name ..using which i fetch fields of those in itab_x031l.......then me moving this feilds into searchstring ...which is search into progdata hwich is string type for field present ..

the problem with search is i get output of those values too which contain tat string

as in if ma field name is "leng" then o/p also shows for "length" which is not required by me

Former Member
0 Kudos

Hi,

Look at the below one

RSRSCAN1 - ABAP/4 Find String in Program Source Code

Transaction SE38 -> Utilities -> Find in source code

Regards

Sudheer

Former Member
0 Kudos

Please use report : RPR_ABAP_SOURCE_SCAN from SAP r/3 4.6C version

0 Kudos

Hi,

progdata should not be a string but a char-field.

Then simply put a space before and behind your fieldname.

-


REPORT ZEND_TEST17 .

DATA: text TYPE string VALUE 'sy-mandt length'.

DATA: text2 TYPE string VALUE 'mandt leng'.

data: lt_searchstring type table of string.

data: ls_searchstring type string.

data: lv_char type char20.

ls_searchstring = 'mandt'.

append ls_searchstring to lt_searchstring.

ls_searchstring = 'leng'.

append ls_searchstring to lt_searchstring.

loop at lt_searchstring into ls_searchstring.

concatenate ' ' ls_searchstring ' ' into lv_char separated by space.

SEARCH text FOR lv_char.

if sy-subrc = 0.

write: / ls_searchstring, 'found in text? yes'.

else.

write: / ls_searchstring, 'found in text? no'.

endif.

SEARCH text2 FOR lv_char.

if sy-subrc = 0.

write: / ls_searchstring, 'found in text2? yes'.

else.

write: / ls_searchstring, 'found in text2? no'.

endif.

endloop.

0 Kudos

hi using ur solution ma SY-mandt issue is geting solved but the "length" issue is still left out.........

as if ma field's name is LENG ........ i dont want the o/p for LENGTH.... only LENG feild string should be selected....i want it to fetch the exact match for the result...

if ma field is LENG only LENG should be picked not LENGTH .....

thank you for ue help

0 Kudos

allright,

the problem is that in the string the <space> at the end is deleted.

I suggest to add a sign at the end of each line.

To search respecting the trailing space you have to use the '.pat.' pattern for the search commant.

Hope thats gonna fix it

Steffen

-


REPORT ZEND_TEST17 .

DATA: text TYPE string VALUE ' sy-mandt length *'.

DATA: text2 TYPE string VALUE ' mandt leng *'.

data: lt_searchstring type table of string.

data: ls_searchstring type string.

data: lv_char type char20.

ls_searchstring = '. mandt .'.

append ls_searchstring to lt_searchstring.

ls_searchstring = '. leng .'.

append ls_searchstring to lt_searchstring.

loop at lt_searchstring into ls_searchstring.

*concatenate ' ' ls_searchstring ' ' into lv_char separated by space.

lv_char = ls_searchstring.

*find lv_char in section offset 0 of text.

SEARCH text FOR lv_char.

if sy-subrc = 0.

write: / ls_searchstring, 'found in text? yes'.

else.

write: / ls_searchstring, 'found in text? no'.

endif.

*find lv_char in section offset 0 of text2.

SEARCH text2 FOR lv_char.

if sy-subrc = 0.

write: / ls_searchstring, 'found in text2? yes'.

else.

write: / ls_searchstring, 'found in text2? no'.

endif.

endloop.

0 Kudos

hi thanks ....but then i cant trail my text with * by ne chance ....i have lots of reports n i hav an internal table where in im reading all this report n then searching for the "feild name" in it......

can u help me with scan abap in the similar case......if u can

thanks

Former Member
0 Kudos

thank you