ABAP Pretty Print settings

I guess you may already know about the pretty print functionality within ABAP development which helps make you code more readable, but did you know you can change the pretty print settings so that all your statement keywords are changed to upper case and everything else is changed to lowercase. You can also decide if you want it to indent or not.

Beautify, Change case and Indent your ABAP code automatically using SAP ABAP Pretty Print

To pretty print, your ABAP code you simply click the pretty print button at the top of the editor. It is also a good idea to make sure that your code syntax checks OK and activate it first.

pretty print abap code

Access and assign ABAP Pretty Print Settings

To access the pretty print settings simply choose the main menu option Utilities->Settings

abap pretty print settings

Then within the next screen, you need to choose tab ‘ABAP Editor’ and then ‘Pretty Printer’ in the subsection.

abap pretty printer settings

​Here you can select your desired code layout from the available indent and uppercase/lowercase options

Indent using pretty-printer

This option allows you to decide if you want your code to be indented or not

ABAP code with indent

loop at it_text into wa_text.
   write:/ 'hello'.
   skip 2.
   write:/ 'indented code'.
endloop.

ABAP code without indent

loop at it_text into wa_text.
write:/ 'hello'.
skip 2.
write:/ 'indented code'.
endloop.

Lowercase

If you choose the ‘Lowercase’ option then as you would expect everything will be converted to lowercase.

loop at it_text into wa_text.
  write:/ 'hello'.
  skip 2.
  write:/ 'indented code'.
endloop.

Uppercase

If you choose the ‘Uppercase’ option then the result will be that everything will be converted to Uppercase.

LOOP AT IT_TEXT INTO WA_TEXT.
  WRITE:/ 'hello'.
  SKIP 2.
  WRITE:/ 'indented code'.
ENDLOOP.

Keyword Uppercase

This is where it gets interesting because if you choose the ‘Keyword Uppercase’ option, all keywords will be converted to uppercase but this will mean that all variables will be converted to lowercase.

LOOP AT it_text INTO wa_text.
  WRITE:/ 'hello'.
  SKIP 2.
  WRITE:/ 'indented code'.
ENDLOOP.

Keyword Lowercase

Now choose the  ‘Keyword Lowercase’ option, this will then convert all keywords to lowercase but as a result, all variables will be converted to Uppercase.

loop at IT_TEXT into WA_TEXT.
  write:/ 'hello'.
  skip 2.
  write:/ 'indented code'.
endloop.

​Also, check out the Custom pretty print program for more options to automatically beautify your ABAP code listing.

Leave a Comment

Your email address will not be published. Required fields are marked *