2023 May 12 9:09 AM
Hi experts,
I tried to rename a method of a global class, and I get the error "References in Transactions found. Refactoring is impossible." No information found in the forum.
The only transaction codes I have created are not directly linked to the global class. One starts a report which runs a method of this class. The two other ones are linked to methods of a completely-empty class. So I don't see why there would be a problem with refactoring.
Any idea what is the issue, how to solve? (okay I guess I'll have to go for the deletion of transaction codes or any other workaround).
I'm using ADT 3.30.2 with ABAP 7.57 SP 0 (on premise).
Thanks!
2023 May 16 10:09 AM
Hi Sandra,
The Rename Refactoring relies on the Where-Used List of the object to determine if renaming is supported. An error like the one you're seeing will appear if the object is referenced in an Where-Used List entry where Rename is not supported. This is currently the case with class methods referenced in Transactions. Hence, the error pop-up is working as intended, and you'll unfortunately need to manually rename and maintain the method name in this case.
However, when a transaction is solely executing a report which employs a method of a class you wish to rename, the renaming should indeed be supported and not cause the error you've reported. This does appear to be a bug - perhaps with the Where-Used List.
Unfortunately, I have been unable to reproduce the issue on our systems. If you want us to look deeper, we would either need a detailed guide from you on reproducing the bug, or alternatively, you could open a ticket using the Refactoring component (BC-DWB-AIE-REF).
The simplest solution/workaround for now seems to be to rename the references manually.
Best Regards
2023 May 12 9:52 AM
I've encountered this a few times. Fortunately I've been able to do a simple search replace to get around it.
2023 May 12 5:09 PM
matthew.billingham Thanks. Yes, renaming manually is the simplest way. I explored the other workaround by changing the 3 transaction types to remove the links with ABAP report and class, and I could then rename the method.
But honestly, I still don't understand the SAP logic to decide "refactoring is impossible", because there was absolutely no direct link between the transaction codes and the concerned class, except that the transaction is using an empty class which is not referred by any program (the where-used list of the class shows nothing).
I created another empty class which has exactly the same all default properties as the other empty class (as far as I could see), and no error when renaming after I have linked one transaction code to this class instead of the other class. So it seems SAP has kept some information on the "past life" of the other empty class which prevented the refactoring. I tried to delete object directory entries, reassigning packages, deleting, recreating with same name, clear SAP buffers and shared memory, check transport requests and cross reference tables, nothing helped. Looks like a bug somewhere.
2023 May 16 10:09 AM
Hi Sandra,
The Rename Refactoring relies on the Where-Used List of the object to determine if renaming is supported. An error like the one you're seeing will appear if the object is referenced in an Where-Used List entry where Rename is not supported. This is currently the case with class methods referenced in Transactions. Hence, the error pop-up is working as intended, and you'll unfortunately need to manually rename and maintain the method name in this case.
However, when a transaction is solely executing a report which employs a method of a class you wish to rename, the renaming should indeed be supported and not cause the error you've reported. This does appear to be a bug - perhaps with the Where-Used List.
Unfortunately, I have been unable to reproduce the issue on our systems. If you want us to look deeper, we would either need a detailed guide from you on reproducing the bug, or alternatively, you could open a ticket using the Refactoring component (BC-DWB-AIE-REF).
The simplest solution/workaround for now seems to be to rename the references manually.
Best Regards
2023 May 16 11:21 AM
Thanks Tosha. I renamed manually, that was quick. I couldn't reproduce with brand new transaction code and global class, so I prefer to give up right now, but thanks for proposing opening a ticket, I'll keep it in mind if the case happens again.