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: 

how implement the WHERE-USED LIST functionality in program ???

ankur_sharma16
Active Participant
0 Kudos

Hello Experts,

I am trying to implement the WHERE-USED LIST's functionality in my program, i got few FMs also while debugging the where-used list. But i want that if i enter say name of data element then program checks in database where this data element is used. And i want this without any screen or pop-up like its happening in background.

Please give me suggestion, i need to implement this in program.

Thanks and Regards,

Ankur Sharma

1 ACCEPTED SOLUTION

ankur_sharma16
Active Participant
0 Kudos

Thanks Kumar Saurav and Subrahmanya Pindiproli for the reply and suggestions.

I know these FMs and am trying to find solution with it, but the problem is that pop up screen are coming asking what to find or where to find. I do not want any screens or pop-ups.

Please suggest me something.

19 REPLIES 19

former_member186491
Contributor
0 Kudos

Hi Ankur,

You may check FM RS_EU_CROSSREF and go through the Documentation for that same as it contains one example.

Hope this may be helpful.

Thanks.

Kumar Saurav.

0 Kudos

Check out this function module ..

CALL FUNCTION 'RS_TOOL_ACCESS'.

EXPORTING

OPERATION = 'CROSSREF'

OBJECT_NAME = prog_name

OBJECT_TYPE = 'INCL'

Regards,

Shyam

ankur_sharma16
Active Participant
0 Kudos

Thanks Kumar Saurav and Subrahmanya Pindiproli for the reply and suggestions.

I know these FMs and am trying to find solution with it, but the problem is that pop up screen are coming asking what to find or where to find. I do not want any screens or pop-ups.

Please suggest me something.

0 Kudos

Hi Ankur,

I have written a program which may serve your purpose, You can implement the code from that.

Please find the attached code for your reference.

Regards,

Sharath

kesavadas_thekkillath
Active Contributor
0 Kudos

Refer program RSHDCF00 and also go through this wiki post SAP Community Network Wiki - ABAP Development - ABAP program to read where-used lists

If you are using RS_EU_CROSSREF, pass option no_dialog = X for no popup's.

ankur_sharma16
Active Participant
0 Kudos

Thanks Kesavadas Thekkillath for reply. but even this program is using 'RS_EU_CROSSREF' which is being used to find domain. And still pop up is coming.

Any suggestions???

0 Kudos

Pass parameter no_dialog = X

ankur_sharma16
Active Participant
0 Kudos

Thanks Kesavadas and Sharath, i got the info of where the data element is being use, can you help me in one more thing?

how to rename the data element in the programs found in It ?

according to me: while looping at IT to WA i can use FM to scan the prog and apply fuzzy logic to change the name in prog.

Any suggestions on that?

Please help me.

0 Kudos

You can read the f1 help on "Replace in table". But after this you have to save & activate the changed program programatically. It goes on

ankur_sharma16
Active Participant
0 Kudos

Kesavadas Thekkillath, I found two FM, but not getting how to use it as per my need.

I am sharing with you, see if you can give nay idea.

FMs : FM RS_FIND_REPLACE_GLOBAL and RS_EDTR_SEARCH.

0 Kudos

Hope this helps

CALL FUNCTION 'RS_FIND_REPLACE_GLOBAL'

  EXPORTING

    objecttype = Pass R/M/O/U/E/Y/T/F/G

    findstring = Search string ... for ex data element name

    findstring_length = Length of DE name

    exact_spelling = 'X'

    replacestring = SPACE "Text to be replaced newly

   i_find_or_replace = 'FIND'" Check what has to be passed for REPLACE from the FM code

  IMPORTING

    actual_incl_modified =      " s38e-buf_varied

    actual_changed_min =        " sy-tabix

    actual_changed_max =        " sy-tabix

  TABLES

    objecttab =  pass the object names to be scanned

  EXCEPTIONS

    NOT_FOUND = 2    

Please search for the where used list of the FM.

ankur_sharma16
Active Participant
0 Kudos

i am trying to test run this FM from past half an hour but all time i get is 'No occurences found'.

pls suggest.

0 Kudos

Here it is... I am replacing the word MATNR with EBELN in program YREPLACE. It displays a popup in which you have hit the button to replace everything. You can refer the program RSAGLSYM for help.

data:  OBJECT_TYPE(3) type c,

        KFIND(79) type c,

              FINDSTRINGLEN type SY-FDPOS,

       REPLACESTRINGLEN type SY-FDPOS,

         KREPLACE type  RSEUR-TDREPLACE.

types: BEGIN OF ty,

           MARK(1) type c,

           PROGRAM type SY-REPID,

           NAME(61) type c,

           DYNNR(4type c,

           PROGTYPE(1type c,

           OBJ_STATE(1type c,

         END OF ty.

data:it type table of ty,

      wa type ty.

wa-MARK = wa-PROGTYPE  = 'X'.

wa-PROGRAM = 'YREPLACE'.

append wa to it.

OBJECT_TYPE = 'R'.

kfind = 'MATNR'.

FINDSTRINGLEN = '5'.

KREPLACE = 'EBELN'.

REPLACESTRINGLEN = '5'.

LOOP AT it into wa.

   CALL FUNCTION 'RS_ACCESS_PERMISSION'

     EXPORTING

       MODE         = 'FREE'

       OBJECT       = wa-PROGRAM

       OBJECT_CLASS = 'ABAP'.

ENDLOOP.

CALL FUNCTION 'RS_FIND_REPLACE_GLOBAL'

   EXPORTING

     OBJECTTYPE           = OBJECT_TYPE

     FINDSTRING           = KFIND

     FINDSTRING_LENGTH    = FINDSTRINGLEN

     METHOD               = 'STRING'

     EXACT_SPELLING       = 'X'

     REPLACESTRING        = KREPLACE

     REPLACESTRING_LENGTH = REPLACESTRINGLEN

     I_FIND_OR_REPLACE    = 'REPLACE'

     MONITOR_ACTIVATION   = 'X'

   TABLES

     OBJECTTAB            = it

   EXCEPTIONS

     NOT_FOUND            = 01

     NOT_EXECUTED         = 04.

0 Kudos

Kesavadas Thekkillath, This FM is not finding the name of data element which i have defined min my program.

My objective is to find the name of data element in program and replace it with new name.

SO what should i do now, pls suggest.


0 Kudos

I tested my program and is working fine. What type of program are you using report, module pool etc. ?

Instead of checking it from SE37, try writing two sample programs and check it once. Might be the problem of case sensitivity.

Did you try executing my code ? In the second program YREPLACE just put some declarations related to MATNR.

Please note that the program to be changed must be is disabled mode and not in editable mode.

ankur_sharma16
Active Participant
0 Kudos

Kesavadas Thekkillath, Thanksfor help .


This is what i did. I just changed the program name and data element name.

DATA:  OBJECT_TYPE(3) TYPE C,

        KFIND(79) TYPE C,

        FINDSTRINGLEN TYPE SY-FDPOS,

        REPLACESTRINGLEN TYPE SY-FDPOS,

        KREPLACE TYPE  RSEUR-TDREPLACE.

TYPES: BEGIN OF TY,

           MARK(1) TYPE C,

           PROGRAM TYPE SY-REPID,

           NAME(61) TYPE C,

           DYNNR(4TYPE C,

           PROGTYPE(1TYPE C,

           OBJ_STATE(1TYPE C,

         END OF TY.

DATA:IT TYPE TABLE OF TY,

      WA TYPE TY.

WA-MARK = WA-PROGTYPE  = 'X'.

WA-PROGRAM = 'Y_WARERR22'.

APPEND WA TO IT.

OBJECT_TYPE = 'R'.

KFIND = 'ULINE'.

FINDSTRINGLEN = '6'.

KREPLACE = 'ABC'.

REPLACESTRINGLEN = '3'.

LOOP AT IT INTO WA.

   CALL FUNCTION 'RS_ACCESS_PERMISSION'

     EXPORTING

       MODE         = 'FREE'

       OBJECT       = WA-PROGRAM

       OBJECT_CLASS = 'ABAP'.

ENDLOOP.

CALL FUNCTION 'RS_FIND_REPLACE_GLOBAL'

   EXPORTING

     OBJECTTYPE           = OBJECT_TYPE

     FINDSTRING           = KFIND

     FINDSTRING_LENGTH    = FINDSTRINGLEN

     METHOD               = 'STRING'

     EXACT_SPELLING       = 'X'

     REPLACESTRING        = KREPLACE

     REPLACESTRING_LENGTH = REPLACESTRINGLEN

     I_FIND_OR_REPLACE    = 'REPLACE'

     MONITOR_ACTIVATION   = 'X'

   TABLES

     OBJECTTAB            = IT

   EXCEPTIONS

     NOT_FOUND            = 01

     NOT_EXECUTED         = 04.

IF  SY-SUBRC EQ 0.

   WRITE:'SUCCESS.'.

ENDIF.


0 Kudos

Pass FINDSTRINGLEN = '5'.

ankur_sharma16
Active Participant
0 Kudos

Hi Kesavadas, the problem was i was giving the program which is in some other package. It searches in same package only.

But anyway, for now its ok for me.

Thanks All If i get problem in this i will ask in NEW POST.

ankur_sharma16
Active Participant
0 Kudos

Special Thanks to Kesavadas for replying me quickly everytime.