As described in my previous blog Surround your code using ABAP in Eclipse code templates you can also create your own templates and use it to surround your code with predefined patterns. Let’s have a look on how you can do that.
First you have to open the templates view in your eclipse installation. You do this by just enter ‘Template’ in the eclipse ‘Quick Access’ input field:
This opens the Templates view where you can create a new template just by clicking the marked icon:
The new template is created using a small template editor:
You first give it a name and a description and define it for the context ABAP which is the default when working in the ABAP perspective. After that you can define the template within the “Pattern” text-edit field. There a lot of predefined variables that you can use within your template. A list of available variables you can see when you click on the “Insert Variable” button on the buttom of the editor.
There are really useful variables available like the logged-on user, the current date, the system-ID or the word_selection that you need to surround your code with the template. The “cursor” variable is used to define where the cursor will be positioned after choosing the template within the editor.
After you have created the template you can see it in the Templates view and also in the code completion the next time you trigger it in your ABAP editor.
So that’s it for today. Have fun with your ABAP code templates.
Next time I will start a series of blogs concerning the new ABAP in Eclipse debugger.
Also interested things inside there. So stay tuned.