Skip to Content

Block Selection Mode in Eclipse

Recently, I did some pair programming with one of my colleagues. My colleague showed me the block selection mode. This is a small feature provided by Eclipse which I would like to share with you, today.

I knew this feature for selecting and copying some blocks from my ABAP source code. You can compare it to the short-cut CTRL+Y in SAP GUI. I guess you know this one.


This functionality on its own is already very helpful, but I didn’t know that you can use this mode also to edit source code in an Eclipse editor. Therefore, here is the whole story…

We were in the following situation: We wanted to write an ABAP Unit test that has to add some source code to an internal table that has to be processed by the test. We just copied the source code for the test in our test method.


In the past, I changed the coding manually by going through each line and adding APPEND ‘ in the front and ‘ TO SOURCE_CODE. at the end of each line. Sometimes I created a small macro to save some time. But still than, I had to surround each source code line with the quote sign.

Block selection mode in Eclipse allowed us to make this change in a much easier way…

We just started block selection mode by using the short-cut Alt+Shift+A. Than we were able to select all lines in front of my source code as shown in the following screenshot.


After that we added my APPEND ‘ in front of each source code line in one shot…


… and did the same with ‘ TO SOURCE_CODE. at the end of each source code line.


Done! In this situation this saved us a lot of time, because we had to do it not just for one test!

Maybe it will save you some time in the future, too!

P.S.: To disable block selection mode you just press the short-cut Alt+Shift+A, again.

You must be Logged on to comment or reply to a post.
  • For those unaware, this is how to do it in New ABAP Editor.

    Method 1: Using regular expression and replace in selection.

    (.*) means select entire line, $1 in replace means insert the found text.

    Method 2: Block selection using ALT + MouseDrag

    Type append ‘ and use Ctrl+D to duplicate lines.

    Alt+MouseDrag to block select the text to be inserted.

    Drag the selected text to where it needs to be inserted (start of line 8).

    • Additon to Method 2:

      You can do this directly by marking lines via ALT + Shift + UP/Down and then typing append ‘.

      I think multiple cursors are one of the most useful and little-known features in the New ABAP Editor. Once you know it, it can really boost your productivity.

      Regards Christian

      • I am on SAP Logon 720. Which SAP GUI version are you using?

        Alt Mousedrag is same as Alt Shift up/down.

        When I type something after selecting multiple lines, it gets inserted only at first line of block, not all.

  • Thanks for sharing!

    I’m a huge fanboy of the hidden gems of the ABAP-editor and as such I got to love the ALT + Mousedrag a lot. Missing this feature in AiE hurt – up to now. Though in one aspect the AiE Editor behaves differently: I used the block selection particularly in order to align e. g. data-declarations for multiple rows. When using the TAB in AiE block selection this affects the whole line though (and not the block marked). Is there any setting I’m missing which changes this behaviour?



  • I knew this block-selection mode (Alt+Shift+A) yes, but after only asking internally – thanks @ Daniel!
    But I think it’s a bit ‘clunky’ in AdT – in the use case you describe, I’d probably still copy the source overt to notepad++, do the editing there and the copy it back.

    The block mode in notepad++ it’s just:

    -> With this ‘hack’, I especially like being able to do it without a mouse, #keyboardOnly.