Recently, I saw some questions in this community related to the structure of your ABAP coding: "How can I navigate to the end-statement of an IF-Block?" or "Where does my current ABAP code blocks start or end?"
I would like to show you in this blog how ABAP Block Highlighting can help you to answer these questions.
What is ABAP Block Highlighting?
ABAP Block Highlighting is a nice way to highlight ABAP code blocks in the ABAP editor.
Here are some examples of ABAP Code Blocks
- CLASS ... ENDCLASS
- METHOD ... ENDMETHOD
- FORM ... ENDFORM
- IF ... ELSE ... ENDIF
- CASE ... WHEN ... ENDCASE
- LOOP ... ENDLOOP
- WHILE ... ENDWHILE
- TRY ... CATCH ... ENDTRY
"How can I navigate to the end-statement of an IF-Block?"
The highlighting of ABAP blocks is realized as Eclipse annotations. This helps you to use some Eclipse standard functionality to navigate through the various parts of the current ABAP block: Just use the buttons Next and Previous Annotation in the toolbar or the shortcuts Ctrl+. or Ctrl+,.
Ensure that you have enabled the annotation ABAP Block Highlighting as navigation target. Just click on the button's drop-down icon to reach the following selection:
BTW: You can use this navigation also for other annotations (e.g., ABAP Occurrences, Errors and/or Warnings listed by the ABAP syntax check).
"Where does my current ABAP code blocks start or end?"
In the preferences (Windows > Preferences > General > Editors > Text Editors > Annotations > ABAP Block Highlighting) you can also enable the option Overview ruler.
This will show you the current ABAP block also in the editor's overview ruler. This gives you a nice overview about the structure of your current ABAP block and you can also use the ruler to navigate by clicking on the marker.