Tuesday, June 4, 2024

Suppressing Blanks in SAP ABAP

 In SAP ABAP, you can control the display of extra spaces and blank lines to make the output appearance more predictable and neat. This is often referred to as “suppressing blanks.” Here’s how you can suppress blanks in ABAP:

  • Leading Blanks: To remove leading spaces at the beginning of a line when using the WRITE statement, you can use the NO-GAP addition:
WRITE: NO-GAP 'This will not have leading spaces.'.
  • Trailing Blanks: To remove trailing spaces at the end of a line when using the WRITE statement, you can use the NO-GAP addition as well:
WRITE: 'This will not have trailing spaces.' NO-GAP.
  • Suppressing Blank Lines: If you want to prevent blank lines from being inserted in the output, you can use the NO-TITLE addition with the WRITE statement:
WRITE: / 'Line 1', NO-TITLE, 'Line 2'.

This will ensure that there is no blank line inserted between “Line 1” and “Line 2.”

Blank Lines in SAP ABAP:

In SAP ABAP, “blank lines” refer to empty lines or spaces that can be inserted into the output of a program or report to improve its readability and structure. The SKIP command is used to insert Blank Lines in SAP ABAP.

Example:

WRITE: 'First line of text',
SKIP , " This inserts two blank lines
'Second line of text'.

The SKIP command allows us to control the number of blank lines inserted for better formatting.

No comments:

Post a Comment