Summary -

In this topic, we described about the below sections -

ABAP supports supressing blanks from the input data. It increases the readability and understandability.

CONDENCE statement used to supress the spaces from the strings. CONDENCE removes or supressing the spaces from the original data field. CONDENCE applies on only character fields.

Syntax -

CONDENCE character-field [NO-GAPS].

NO-GAPS - Removes entire blank spaces from the string. It is optional with CONDENCE.


Example -

Write a program to display string with and without CONDENCE function.


Code -

REPORT  Z_CONDENSE.

DATA: W_T1(50) TYPE C VALUE '     Leading spaces along with text'.

WRITE : 'Text before condense:',W_T1.

SKIP 2.
CONDENSE W_T1.
WRITE : 'Text after condense:',W_T1.

SKIP 2.
CONDENSE W_T1 NO-GAPS.
WRITE : 'Text after condense with NO_GAPS:',W_T1.

Output -

Suppressing blanks

Explaining Example -

W_T1(50) TYPE C VALUE ' Leading spaces along with text' - initializes W_T1 with ' Leading spaces along with text'.

WRITE : 'Text before condence:',W_T1 – displaying string before CONDENSE applied.

CONDENSE W_T1 - Supress leading spaces from the data field.

WRITE : 'Text after condense:',W_T1 - displaying string after conversion.

CONDENSE W_T1 NO-GAPS - Supress all spaces from the data field.

WRITE : 'Text after condense with NO-GAPS:',W_T1 - displaying string after conversion with NO-GAPS.