ATRICLE
Trailing Blanks in Character String Processing
Statements for character string processing generally preserve leading
blanks for operands of data types with fixed lengths ( c , d
n , and t or character-like structures) and cut off
trailing blanks. Exceptions to this rule are explained in the affected
statements. All blanks are generally preserved for operands of the data
type string .
If the result of a statement for character string processing is assigned
to an operand, the operand is generally padded on the right with blanks
if the result is shorter than the length of the operand. String
assignments generally adapt the string length to the length of the
result. Exceptions to this rule are explained in the affected
statements.
ABAP_PGL Do not use trailing
blanks in text field literals
Notes
These rules apply particularly to the processing of byte strings in
non-Unicode programs. If the trailing bytes of a byte string contain
values that represent blanks in the current code page, then these bytes
are truncated if the results fields with fixed lengths are too short; if
the results fields are too long, they are padded with these byte values.
Truncating trailing blanks especially affects the
text field literal ' ' and
the constant space . These should therefore
never be specified in operand positions where trailing blanks are cut
off.
In long results fields, padding with blanks can produce invalid values,
if the fields have the type n , d , or t .
The preservation of trailing blanks can be forced for assignments by
using the addition RESPECTING BLANKS of the statement
CONCATENATE .
Example
The result of the following concatenation is a
string with exactly one blank. The blank characters in space and
' ' are ignored. At operand positions after SEPARATED BY
however, the blank character which is contained explicitly in ''
is not ignored. If the addition RESPECTING BLANKS is used, the
result is a string with three blanks.
DATA text TYPE string.
CONCATENATE space ' ' INTO text SEPARATED BY ''.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved