Renaming objects in ABAP for Eclipse
If you want to rename ABAP classes, methods or variables you have two possibilities: Feel the pain or use Eclipse…
It’s pretty simple! Just right click on the object and choose “Rename”:
But that’s not all – every reference will be renamed! So this is a killer feature if you want to move objects in your namespace…
Unfortunately this doesn’t work for function modules and function groups, there you need to use function module RS_FUNCTION_RENAME and update the references manually.
If you haven’t downloaded ABAP on Eclipse yet:
To see the full Features of refactoring in Eclipse, take a look at http://help.sap.com/saphelp_banking450sp06/helpdata/en/4e/c859406e391014adc9fffe4e204223/content.htm?frameset=/en/4e/c0ca886e391014adc9fffe4e204223/frameset.htm¤t_toc=/en/4e/c0ca886e391014adc9fffe4e204223/plain.htm&node_id=174&show_children=false (thanks to https://people.sap.com/thomasfiedler)
Sorry but it's not refactoring, it's renaming. Certainly renaming can be part of the refactoring process but hardly qualifies as refactoring by itself IMHO.
Was expecting much more from this blog, based on the title. You might want to change it or at least correct the typo.
I do agree that I had higher expectations from the blog title.
But I also accept the point that the renaming-tool in AiD is one of its refactoring tools.
I think changing the title to make it clearer that blog is about only that aspect is a good idea.
How about something like "Refactoring in ABAP for Eclipse - renaming"
(Maybe this could be a start of a "Refactoring in ABAP for Eclipse - " blog series?)
I will call refactoring the discipline to change the internal code structure without changing its observable behavior. For me the hard part is the discipline. Change is risky and we perform safe changes in small steps to reduce the risk.
Although Refactoring is not only renaming, automatic renaming surely qualifies as one of the small steps in my view.
It is nice when tools allow us to refactor safely, without only having to trust our coding ability or our test suite. In the ABAP Workbench we can move methods of global classes, I am quite sure AiE implements more steps that are not described here (Ctrl+1). Isn't it possible to extract methods safely?
I agree with Jelena, this is only rename not a refactoring,
refactoring, it means, that you want to do restructuring an existing code to improve the code. IF you have a code which is really hard to be readable, then you need to refactor the code ( divide code to parts) to be easily and understandable.
Off course you're right - it's "only" renaming. But it's much more powerful since it updates all dependent objects.
Right now, we're facing the problem that we can't move to a namespace we own - any ideas? Eclipse says that moving from a Z devclass to a namespace devclass is not possible.
here you find all the refactoring features of Eclipse:
I followed your link to “Extracting Variables from Literals” ( http://help.sap.com/saphelp_banking450sp06/helpdata/en/4e/c1c1596e391014adc9fffe4e204223/content.htm )and had a look at it:
There’s a lot of text, examples, limitations and so on, but I don’t see a section explainin what there actually is to do (e.g. “right-click on literal -> Choose ‘refactor’ … ).
Surely I’m missing something?
[Edit: by trying, I now found out it can be done via quick-fix (CTRL+1), still my comment stands: the help should tell me exactly that!]
if i may answer, the "ABAP Refactorings" are grouped under the section "Quick Assist", where the help states & i quote
All supported transformations are available through the quick fix menu that can be triggered from the Source menu or through the Ctrl+1 shortcut. As an alternative the Quick Assist view provides a permanent view on the available quick assists.
ok, undestood, thanks for the clarification!
For what its worth, the full refactoring capabilities in Eclipse is why I loved it when working with Java. I wrote a blog post some time ago on this topic from a Java perspective, which may still be of interest and some use now - https://blogs.sap.com/2014/02/14/eclipse-aint-all-bad-a-few-tips-tricks-that-might-help/
BTW, I found a way to move to a namespace. You just have to move the objects in $TMP, if this is not possible as the objects have been exported already you can manipulate TADIR using SE16(n).
Nice Blog thanks.
Is there a possibility to rename the components of the constan? lets say we have a constant that is defined like this
BEGIN OF _gc_constant,
field1 TYPE string VALUE '1',
END OF _gc_constant.
I dont find any way to rename it in Eclispe
Maybe you can try to replace the whole coding block?