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, Date Formats

The example demonstrates the various date formats for embedded expressions.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA: land  TYPE t005x-land,
          datfm TYPE t005x-datfm.

    setup( ).

    SELECT land datfm
           FROM t005x
           INTO (land,datfm)
           WHERE land LIKE '@%'.
      result-col1 = datfm.
      READ TABLE fixvals WITH KEY low = datfm
           TRANSPORTING ddtext INTO fixval.
      IF sy-subrc = 0.
        result-col2 = fixval-ddtext.
        CLEAR result-col2.
      result-col3 = |{ sy-datum COUNTRY = land }|.
      APPEND result TO result_tab.

    teardown( ).

    display( ).


The current date is output in all possible country-specific date formats using parameter COUNTRY. For this purpose, in the setup and teardown help methods, temporary rows with the possible values of column DATFM are inserted into database table T005X and are deleted again once they have been used.