Ansicht
Dokumentation

ABENSTRING_TEMPLATES_EXPRESSIONS - STRING TEMPLATES EXPRESSIONS

ABENSTRING_TEMPLATES_EXPRESSIONS - STRING TEMPLATES EXPRESSIONS

General Data in Customer Master   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

- embedded_expressions

{ embd_exp $[format_options$] }

Effect

Within a string template, an opening and a closing curly bracket { ... } define a general expression position, embd_exp, at which the following can be specified in ABAP syntax:

At least one blank must be included on the right of the opening bracket and one the left of the closing bracket. An embedded expression must be complete within the current string template. An embedded expression within the curly brackets is handled in accordance with regular ABAP syntax:

  • Tokens must be separated by at least one blank or line break.
  • In other cases, blanks and line breaks between tokens are not significant.
  • No distinction is made between uppercase and lowercase letters.

The data type of the expression must be an elementary data type and the value of the expression must be character-like or be convertible to a character string. When a string template is evaluated, the value of each embedded expression is converted to a character string and inserted at the corresponding position. The string is formatted either using

The embedded expressions in a string template are evaluated from left to right. If functional methods are specified, they are executed during the analysis.

Notes

  • To display the curly brackets { and } in the literal text of a string template, they must be prefixed with the escape character \.
  • Curly brackets cannot be nested directly. If embd_expr is itself a string expression, or contains a string expression, it can also contain embedded expressions.
  • String functions with character-like return values are particularly suited when embedded functions are specified.
  • Unlike arithmetic expressions and bit expressions, embedded functional methods are not executed before the entire expression is evaluated. If an embedded functional method modifies the value of data objects that are also used as embedded operands, the change only affects data objects on the right of the method.

Example

The string template in the method main uses embedded expressions to represent the text "Hello world!". The first embedded expression is the attribute attr of the class. The return value of the method func is used in the second embedded expression. The third embedded expression is again the attribute attr, whose value has been changed in the method func in the meantime. The second embedded expression includes a line break and a comment is specified.






ABAP Short Reference   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 5057 Date: 20240424 Time: 003031     sap01-206 ( 68 ms )