07-06-2023 3:05 PM
Hello all,
when renaming a class, I unfortunately encounter the error message "Refactoring Condition Check Failed: Number of external references exceeds threshold. Refactoring impossible."
The problem was already described in 2020(!) in the linked post [ABAP Development Tools] Renaming an interface is not possible: Too many external references and was answered by saying that the threshold is a hard coded value.
In my opinion this is not a solution to the problem! Unfortunately, I could not find any further information about this.
What happens in my case? Since a method do_something( ) should not be redefined and implemented in every subclass, I inherit a method from the root class through several levels. As is not uncommon with inheritance, the tree may get wider in the lower levels. This then leads to a lot of (indirect) references to the root class. Unfortunately, this also leads to the problem that refactoring in the root class is no longer possible. Is the application of good structuring or object orientation not desired? I mean it must be possible to structure classes cleanly and if needed to inherit a method from the root class down without encountering such a problem afterwards.
Dear SAP colleagues, is there any news about this? Otherwise I ask you to improve this as soon as possible, because this is not a new problem.
Thanks for your answers and best regards
Sebastian
07-06-2023 4:07 PM
I doubt that it's a huge problem for many people, so it's unlikely it'll be attended to.
I stand by my comment in the original thread: if you've got that many subclasses, there's an issue with your architecture.
07-06-2023 4:10 PM
07-18-2023 10:26 AM
Hello Sebastian,
You are
right this is not a new problem but there is also no news about this topic.
Nevertheless, I can at least demystify this threshold. The threshold is 50 and it
is not directly about references but about transportable includes affected by
the rename (whereas section includes and method includes of a global class are
combined in an single artificial include and count as one include). So, if
references in more than 50 different includes exist, the rename can’t be executed.
From our experience the likelihood of getting a rename through decreases with
the number of affected objects. Therefore, this threshold was introduced and is
still present.
Before I write about options discussed inside ADT, I would kindly ask you to write down your ideas or wishes on how rename could improve here.
Thanks and
Best Regards
Markus
07-18-2023 12:31 PM
07-18-2023 10:54 AM
Hi Markus,
thank you for your answer. I am happy that you are already discussing this topic.
Just this morning, together with colleagues, I worked my way to the relevant point in the ADT using debugging and skipped the logic that checks against the threshold. A renaming of the relevant class failed using the regular procedure as described above and could now be carried out successfully using this method.
As part of this, we also thought about what a more flexible solution could look like. One of our ideas was to allow the threshold to be adjusted via a setting within Eclipse or alternatively via customizing within SAP.
Since we are (unfortunately) still developing on the basis of R/3 ABAP Release 7.50, we also compared the threshold value with S/4 as a precaution and were able to determine that there are no differences in the coding. That's why I asked you if, in the case of an adjustment, you could also think of developers like me, who currently still have to work with older releases due to technical requirements from companies.
Best regards
Sebastian
07-18-2023 1:56 PM
You could always just make a custom repair of that bit of code. Since you'd only ever use in a development system, seems low risk to me.