07-06-2012 1:51 PM
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
07-09-2012 6:21 AM
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.
07-06-2012 2:45 PM
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.
07-06-2012 2:49 PM
Check out this function module ..
CALL FUNCTION 'RS_TOOL_ACCESS'.
EXPORTING
OPERATION = 'CROSSREF'
OBJECT_NAME = prog_name
OBJECT_TYPE = 'INCL'
Regards,
Shyam
07-09-2012 6:21 AM
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.
07-09-2012 6:46 AM
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
07-09-2012 6:37 AM
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.
07-09-2012 6:50 AM
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???
07-09-2012 7:09 AM
07-09-2012 9:38 AM
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.
07-09-2012 10:26 AM
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
07-09-2012 10:38 AM
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.
07-09-2012 10:47 AM
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.
07-09-2012 10:59 AM
i am trying to test run this FM from past half an hour but all time i get is 'No occurences found'.
pls suggest.
07-09-2012 11:43 AM
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(4) type c,
PROGTYPE(1) type c,
OBJ_STATE(1) type 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.
07-09-2012 12:39 PM
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.
07-09-2012 12:47 PM
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.
07-09-2012 3:20 PM
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(4) TYPE C,
PROGTYPE(1) TYPE C,
OBJ_STATE(1) TYPE 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.
07-10-2012 5:43 AM
07-10-2012 6:19 AM
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.
07-10-2012 6:32 AM