Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Character String and Byte String Processing →  Expressions and Functions for String Processing →  string_exp - String Expressions →  string_exp - String Templates →  Examples of string templates 

Character String Templates, Alignments, and Padding

This example demonstrates how to specify an alignment and how to pad embedded expressions.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA result TYPE string.
    result = |{ 'Left'   WIDTH = 20 ALIGN = LEFT   PAD = pad }<---|.
    WRITE / result.
    result = |{ 'Center' WIDTH = 20 ALIGN = CENTER PAD = pad }<---|.
    WRITE / result.
    result = |{ 'Right'  WIDTH = 20 ALIGN = RIGHT  PAD = pad }<---|.
    WRITE / result.

Description

The alignment of three character string templates is declared statically. The character used to fill the superfluous spaces can be entered as a parameter.