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 

String Templates, Number Formats

The example demonstrates the various number formats for embedded expressions.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA number TYPE p DECIMALS 2 VALUE '1234567.89'.

    DATA: BEGIN OF result,
            xdezp  TYPE string,
            format TYPE string,
          END OF result,
          results LIKE TABLE OF result.

    setup( ).

    SELECT land, xdezp
           FROM t005x
           WHERE land LIKE '@%'
           ORDER BY PRIMARY KEY
           INTO (@DATA(land),@DATA(xdezp)).
      results = VALUE #( BASE results
        ( xdezp  = xdezp
          format = |{ number COUNTRY = land }| ) ).
    ENDSELECT.

    teardown( ).

    cl_demo_output=>display( results ).

Description

Represents a number in all possible country-specific number formats using the parameter COUNTRY. To do this, the setup and teardown utility methods insert temporary rows with the possible values of the column XDEZP into the database table T005X and delete them again once they have been used.