Lazy and Smart ABAPers

One of my very good friends once wrote a four line article titled “What Laziness leads to?” in LinkedIn.

What is the Outcome of Laziness?
Automation.

What is the after effect of Automation?
More Laziness, More Profit.

If there were to be a competition of short articles, my friend’s article would have definitely featured in the top list. Being an ABAPer, we often do the repetitive work every day. For example, in every program we need to create flower boxes, we need to declare the events of the programs, we need to create selection screen etc. Copy and Paste is the best tool invented by the Computer scientists. The majority of computer users use the Ctrl + C and Ctrl + V feature irrespective of the software platform.

ABAP editor has also evolved all these years. From the boring blue screen to any screen colour/background we like. From GUI to eclipse editor, ABAP and ABAPer have made huge jumps. These days ABAPer are also working in javascript, SQL and UI programming. But old ABAPers (like me) and those who did not get the opportunity to work in new areas, still do 90 percent of their work in the ABAP workbench/editor.

Also Read: SAP Adobe Forms for Beginners.

Let us see what are the common shortcuts and helpers which smart ABAPers of this age (not lazy) have in the same old ABAP editor.

1. Copy the same line below the existing line i.e duplicate the statement.

Use Ctrl + D to copy duplicate lines just below it.

Copy duplicate line2. Copying multiple rows of one column and paste them. Remember only one column not all columns (copying all the columns is easy).
You can copy multiple rows of one column using Alt + drag your cursor.

Can you copy just one column in ABAP editor? Yes, we can.

Check the image below. Only constant lc_tab is selected and the other columns of the other rows are not.

Press Alt + drag your cursor to left till the column end and then drag down.

ABAP Technical
Then press Ctrl+C and then go to the rows where you want to paste it.

You need to apply the same trick where you want to paste it. Check this image. You need to hold Alt and drag the cursor vertically down and right side to create space for the copied rows of one column.

SAP ABAP for beginners

Check the copied rows of one column are pasted (Ctrl + V) in your selected area.

SAP Techies

For ABAPers: Fun about ABAP for SAP HANAΒ 

This is quite handy when you have repetitive words to be written in multiple rows. In the above example, it is Tab separator constant. In another case, it might be key work TYPE to be written while BEGIN OF TYPE declaration. Also, you can copy field name and data element from SE11 structure/table and paste it into your editor and then use Alt + drag to add TYPE.3 4

Initially, you might find some difficulty selecting columns using the trick. Keep trying and using and in no time you would start appreciating it more and more. πŸ™‚

Also Read: Back to Basics

3. Line Separators or CodeΒ Separators
If you need a dashed line in your code, it might be for separation of code or modularization or just for making your code pretty. Do you type ‘*’ or ‘”‘ and then press ‘-‘ till the end of the line? Sometimes you might want to use ***** asterisks to do the same. Do you press ‘*’ till the end?

You should be taking advantage of the code completion feature of SAP. Just type ‘*–‘ and you get suggestions. Similarly type ‘***’ and you get suggestions. Hit ‘TAB’ key and it writes the full code for you.

Auto Code Completion

You might be using IF-ELSE, DO-ENDO, LOOP ENDLOOP, CASE ENDCASE auto completion. But have you ever used IF ELSE ENDIF? Just type ife, and you get the suggestion. In fact, you can make SAP auto suggest you for anything and everything you code. It is completely in your control.

SAP Technical

Where can we find the list of all Code Completion short codes?

Vanilla ABAPClick the small Options icon on the right-hand side bottom corner in your editor. You can control the timing and properties of Code Completion. Code Template would actually have the code which would be written when you hit TAB when code completion suggestion creeps in.

You can create your own custom Code Completion list and add them to the repository.

You might like this: Are you an ABAP Coder or a Programmer?

4. Program Templates
Whenever an ABAPer creates a new program, they have some codes which are needed in each and every program they created. Flower box, revision log, Selection Screen, Program Events etc. Usually, we refer to another program and copy the template.

Patterns in SAP

Check, I am creating a fresh new program and start typing ZZ_TEMPLATE. As I complete the word the auto-completion is visible and when I hit ‘TAB‘ key, the whole program skeleton is written for me.

Program Events

The idea is to have the template for all the needed areas. Flower box, revision log, selection screen, events. Now, once I have the template, I just give the correct program name, description, logs and change the selection screen fields. If I do not need checkbox or radio buttons declaration, I delete them.

Also Read: End to End Configuration and Implementation of Two SAP Fiori Apps with no Coding

I remember in some projects we had the custom Pattern saved and used for the same purpose.

But later I realised, SAP has provided a smart way to avoid creation of that custom Pattern (since Pattern is also a development which we need to save in transport or local). Click the same small Options icon again on the right-hand side bottom corner in your editor. Hit Code Templates ->Add -> Give the name & description -> OK.5

6

Paste your template code and Save it. Now everyone using this development box can use your template to get the job done faster. πŸ™‚

9

Note : You can create one template for any work which you need very often, for example, selection screen snippet or file validation code or F4 Help code or MODIF id code etc. If you do not remember some syntax, just save a template for it and you do not need to remember it for life. πŸ™‚

If you like the template and want to use it, you can copy from this file. Β Template File.

But most projects will have their own flower box and templates, so use your project specific ones and save in the template.

Also Read: Do all ABAPers know Fixed Point Arithmetic?

5. Save the code in PDF format
Sometimes you want to take a backup of your code. Usually, we copy and paste it to a notepad or we go through Utilities -> More Utilities -> Download. But keeping your code back up in PDF format has its own beauty.

Just click the same icon at the bottom right of your editor, go to Keyboard option and look for File.ExportPDF short cut. For my case it is Shift + P. You can change this keys and assign your favourite keys to save as PDF. I have kept Shift + P unchanged.

Save code in PDF file

Go to the desired program which you want to save in PDF. Hit Shit + P or any other keys if you have changed it. Save at the desired path you want.

Save Program in PDF format 13

The code in PDF file always looks better. Isn’t it? πŸ™‚

6. Have charm in the editor where you spend maximum time at work.
There should always be spice in your life. If you are bored of looking at the blue screen of your editors or just want to customize the fonts and colours for better readability or want different colours for fun or want something which soothes your eyes, check the below image.

Change background color of editor

This the current configuration of my workplace.

You can configure it for yourself using the same small icon on the right bottom corner of your editor. Choose Fonts and Colors. Below is the setting for my editor. Try and have fun!!

Fonts setting

We have tried to reveal that small Options icon on your screen in this article. Hope after going through this post, that icon can no longer hide from your sharp eyes.

If you have some more short codes/cuts or tricks or any other interesting stuff, please do share it with us. If you have something which can help us be more smart/lazy, that would be more welcomed. πŸ™‚

If you want to get such useful articles directly to your inbox, please SUBSCRIBE. We respect your privacy and take protecting it seriously.

If you liked this post, please hit the share buttons and like us on facebook.

Thank you very much for your time!!

 

Also, check our popular and effective Tutorials:

1. ABAP for SAP HANA Tutorials
2. ABAP Web Dynpro Tutorials
3. GOS Tutorial
4. OOPs ABAP Tutorial
5. HANA Tutorial
6. SAP Netweaver and OData Tutorial
7. SAP Adobe Form Tutorial
8. SAP Fiori Tutorial
9. SAPUI5 Tutorial

Share on Facebook193Share on LinkedIn244Tweet about this on TwitterShare on Google+6Email this to someonePin on Pinterest2Share on Reddit0
Isn't it Fair to Share??

40 Comments on "Lazy and Smart ABAPers"

  1. Superb!! Liked it very much.

  2. Super..

  3. Amazing! Thank you partha ,

    Regards,
    Dilem.

  4. krishnamraju | July 4, 2016 at 5:40 pm |

    Love it

  5. Saraswathi | July 4, 2016 at 5:55 pm |

    Awesome…πŸ‘ŒπŸ‘Œ

  6. Venkatesh | July 5, 2016 at 12:39 pm |

    It is very useful information.
    Thank you so much sir

  7. SANJEEVA REDDY | July 9, 2016 at 2:10 am |

    here cntl+tab also works like a time saver . because if u use tab it goes to next selection.
    but when we use cntl+tab it goes into next section. it is ery useful . try this

  8. Biji Philip | July 10, 2016 at 8:56 am |

    Very Good !!Liked it very much.

  9. Simply best

  10. Steve Oldner | July 11, 2016 at 2:38 pm |

    This is well worth reading. Now to spend an hour or so playing with colors!!!

  11. I really appreciate your efforts. Keep posting:)

    • Dear Praveen – Thank you very much for your feedback. Sure, more interesting and useful articles are there in pipeline.

      Please keep visiting and leaving your comments.

      Regards,
      Team SAPYard.

  12. Felipe Carvalho | July 12, 2016 at 1:51 pm |

    Nice!!!
    The most things I already knew, but I wish I had an article like that when I started as ABAPer.

    • Dear Felipe – Thank you very much for your encouragement.

      Hope our articles would help the freshers and new ABAPers.

      Please do visit us back and give your valuable feedback.

      Regards,
      Team SAPYard.

  13. This is great! Thanks for sharing. I like number 2 the most πŸ™‚

    • Thanks Jitendar. Yes, even I like trick 2 (selecting one column). It is little tricky but very useful.

      Welcome to our site. Please keep providing your comments and feedbacks.

      Regards,
      Team SAPYard.

  14. well described……

  15. Kumar Gourav Malik | July 13, 2016 at 5:20 pm |

    Very nice tips . Nice page for ABAPers.

    • Dear Gaurav – Thank you very much for your feedback. Gald you think our page is useful for ABAPers.

      Welcome to our site. Please keep providing your valuable feedback.

      Regards,
      Team SAPYard.

  16. Very nice Raju…keep posted this tricks for lazy ABAPer like me πŸ™‚

  17. Really interesting….

  18. Thank you for the Program Templates πŸ˜‰

  19. Very nice and useful tricks!!! Thank you very very much!!!

  20. Thank you for sharing useful and interesting things…
    Thanks.

Comments are closed.