Entering content frameCondensing Field Contents Locate the document in its SAP Library structure

The CONDENSE statement deletes redundant spaces from a string:

CONDENSE <c> [NO-GAPS].

This statement removes any leading blanks in the field <c> and replaces other sequences of blanks by exactly one blank. The result is a left-justified sequence of words, each separated by one blank. If the addition NO-GAPS is specified, all blanks are removed.

Example

DATA: STRING(25) VALUE ' one two three four',
LEN TYPE I.

LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.

CONDENSE STRING.
LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.

CONDENSE STRING NO-GAPS.
LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.

Output:

one two three four !

Length:           25

one two three four !

Length:           18

onetwothreefour !

Length:           15

Note that the total length of the field STRING remains unchanged, but that the deleted blanks appear again on the right.

 

 

 

Leaving content frame