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

FM For Searching a string In Program

Former Member
0 Likes
2,538

Hi Everybody ,

I have Program name and a string , Is there any function module to find that string in that particular Program.

If FM doesnot exists any alternative ?

Regards ,

raju.

1 ACCEPTED SOLUTION
Read only

Sm1tje
Active Contributor
0 Likes
1,921

Do you need a FM for this? There is a standard report which does the search: RS_ABAP_SOURCE_SCAN

13 REPLIES 13
Read only

Former Member
0 Likes
1,921

Hi,

Please Try below function kodule:AA_CUS_SCAN_PROG_FOR_STRING

regards

jana

Read only

0 Likes
1,921

AA_CUS_SCAN_PROG_FOR_STRING Functon module doesnt exists

Read only

0 Likes
1,921

Hi which server your using, it is availble in ECC6.0

Read only

former_member761936
Active Participant
0 Likes
1,921

Hi Raju ,

I am not sure about function module but there is a statement to do this.

 

TYPES: BEGIN OF T_TYPE, 
         LINE(72), 
       END OF T_TYPE. 
DATA: PROGRAM LIKE SY-REPID VALUE 'PROGNAME', 
      T TYPE STANDARD TABLE OF T_TYPE WITH 
             NON-UNIQUE DEFAULT KEY INITIAL SIZE 500. 

READ REPORT PROGRAM INTO T. 
IF SY-SUBRC <> 0. 
  ... 
ENDIF. 

Now Internal table T has entire code of program.

Then using keyword find you can know wheather that string is present in that particular program.

Hope this will help you.

Read only

0 Likes
1,921

I understood what u said but i need the functonaliy just like WHERE_USED LIST.

So it should highlight the string wherever it occurs.

Read only

Former Member
0 Likes
1,921

Hi,

AA_CUS_SCAN_PROG_FOR_STRING
*"  IMPORTING
*"     REFERENCE(ID_STRING1)     " string
*"     REFERENCE(ID_STRING2) OPTIONAL
*"     REFERENCE(ID_PROGRAM) TYPE  REPID OPTIONAL " program name
*"  EXPORTING
*"     REFERENCE(EF_FOUND)
*"  TABLES
*"      IT_PROGRAM
*"      ET_CODING OPTIONAL

Regards

Adil

Read only

0 Likes
1,921

I am using GDV , Iam not getting tht fnction module

Read only

Sm1tje
Active Contributor
0 Likes
1,922

Do you need a FM for this? There is a standard report which does the search: RS_ABAP_SOURCE_SCAN

Read only

Former Member
0 Likes
1,921

Thanks Micky ,

What u hve given is rite but we need to prepare BDC for that so for my requirement i shudnt do tht...so only i need FM.

If u can tell me.

Read only

former_member761936
Active Participant
0 Likes
1,921

Hi,

Use this code for searching string in the program



TYPES: BEGIN OF T_TYPE, 
        LINE(80), 
      END OF T_TYPE. 

DATA: T TYPE STANDARD TABLE OF T_TYPE WITH 
             NON-UNIQUE DEFAULT KEY, 
      WA_T TYPE T_TYPE. 

MOVE 'Alaska Texas       ' TO WA_T. 
APPEND WA_T TO T. 
MOVE 'California Arizona ' TO WA_T. 
APPEND WA_T TO T. 
SEARCH T FOR '*ONA' AND MARK. 


Read only

Former Member
0 Likes
1,921

Hi Raju,

Check this code sample By Amit Jain, to find a string in a selected programs:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/44439390-0201-0010-5ba8-967a49af...

The following function module helps in search of a string in all programs existing in an environment.

RPR_ABAP_SOURCE_SCAN

Regards,

Chandra Sekhar

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,921

check this program

RPR_ABAP_SOURCE_SCAN

Read only

Former Member
0 Likes
1,921

Hi,

Use this Function Module AA_CUS_SCAN_PROG_FOR_STRING. I have tried this. It gives the line numbers of the string also.