A very useful feature in ABAP development is the possibility to create a new method from the editor via the form-based method generation wizard. Here I will show you how you can do that with ABAP in Eclipse:
So let’s assume you are in the editor implementing your ABAP code in a class method.
Now you recognize that you need a new method that you want to call within your created code.
You can now navigate to the definition part of the class to add the method signature, implement the method and navigate back to the call position of the newly created method. That’s a bit cumbersome, isn’t it. 😕
Why not do the following:
You can create the new method by just typing the name of the non-existing method in the editor and use the Quick Fix functionality. You do this just via pressing CTRL-1 when the cursor is positioned on the method name:
On the upcoming Quick Fix popup you choose the option Create method ….
The editor now opens a wizard to define the signature of the new method:
You can now specify the most relevant details of the method like visibility, access scope and the name.
In addition you can specify the parameters of the method via the table control. You can define whether you need importing, exporting, changing or returning parameter and you can specify the parameter type with very nice value help in the editor cell.
When you are ready with the declaration you press Finish and you’re done.
The editor now automatically generates out of this information the method declaration and the method implementation:
You can now directly go ahead with your implementation.