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, Uppercase/Lowercase
The example demonstrates how uppercase/lowercase is specified for embedded expressions.
Other versions: 7.31 | 7.40 | 7.54
Source Code
DATA: output TYPE TABLE OF string,
formats TYPE abap_attrdescr_tab,
format LIKE LINE OF formats.
FIELD-SYMBOLS <case> LIKE cl_abap_format=>c_raw.
formats =
CAST cl_abap_classdescr(
cl_abap_classdescr=>describe_by_name( 'CL_ABAP_FORMAT' )
)->attributes.
DELETE formats WHERE name NP 'C_*' OR is_constant <> 'X'.
LOOP AT formats INTO format.
ASSIGN cl_abap_format=>(format-name) TO <case>.
APPEND |{ format-name WIDTH = 20 }| &
|{ `UPPER CASE, lower case ` CASE = (<case>) }|
TO output.
ENDLOOP.
cl_demo_output=>display( output ).
Description
The three possible settings for uppercase/lowercase in a string template are specified dynamically.