Be lazy when you write in ABAPese
![images/thumbnail.jpg - Thumbnail](/en/2011/12/modelos-de-codigo/images/thumbnail_hu621b1e1929f0288c9d9295573334490f_35222_300x0_resize_q75_box.jpg)
To find out which professions attract the laziest people, I googled the following:
Profession | Results |
---|
“médico preguiçoso (lazy doctor)"| 2,140,000
“advogado preguiçoso (lazy lawyer)"| 1,430,000
“gestor preguiçoso (lazy business administrator)"| 1,020,000
“engenheiro preguiçoso (lazy engineer)"| 647,000
“político preguiçoso (lazy politician)"| 602,000
“economista preguiçoso (lazy economist)"| 284,000
“pedreiro preguiçoso (lazy builder)"| 91,200
As this conclusively proves, engineers are not lazy enough as they are beaten by lawyers and doctors. This must change. And this tip will help. But not without making the following difference clear: lazy is not work-shy. I am talking here about noble laziness, the behaviour of those who like doing things but with the least possible effort. Lazy slobs are not included here.
SAP is something that evolves slowly, and it launched a new editor a few years ago that is full of capabilities many of which, while handy, are barely used. One of them is called ‘Code templates’ which I will now demonstrate:
- Go to SE38, SE24, SE37 or any other transaction that offers the ABAP editor;
- In the bottom right-hand corner there is an icon looking like a clipboard. Click on it;
- The editor options appear;
- From the options on the left, select ‘Code templates’;
- There you will see various pre-defined templates (e.g. TRY) and you can set up more of your own.
Here is the code templates definition:
As you write code, just write the name of one of the models anywhere and hit TAB to replace that name with its model.
Tip within a tip: ideal for “nuno was here!” type lines - de rigueur whenever splicing into someone else’s code.
Let’s be lazy!
Greetings from Abapinho.