Ansicht
Dokumentation

ABENSQL_ELEM - SQL ELEM

ABENSQL_ELEM - SQL ELEM

TXBHW - Original Tax Base Amount in Local Currency   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

- sql_elem

... col
  $| literal $| @dobj $| @( expr ) ...


Effect

Elementary expression in . An elementary SQL expression represents one of the following values:

  • Value from the database

The column col can be of any elementary data type from the ABAP Dictionary, unless otherwise documented for an operand position.
  • Values of the ABAP program passed to the database system

The ABAP objects can have any non-generic elementary ABAP data type and the name of a host variable must be tagged with the escape character @. Typed literals are handled strictly according to their type. Untyped literals are restricted to the types c and i. Untyped text field literals are allowed. String literals are not allowed, neither typed nor untyped. Furthermore, no empty text field literal can be specified. An empty typed literal of type CHAR can be specified.

The result of an elementary SQL expression is the value of the specified object or the result of the specified expression. If a value from the database is specified, the data type is its dictionary type. When an ABAP object is specified, the ABAP type is mapped to a dictionary type as follows:

Numeric ABAP Type Dictionary Type
b, s, i, int8 INT1, INT2, INT4, INT8
p DEC with appropriate length and decimal places
decfloat16, decfloat34 DF16_RAW, DF34_RAW
f FLTP
Character-Like ABAP Type Dictionary Type
c CHAR with appropriate length
n NUMC with appropriate length
string STRING with appropriate length
Byte-Like ABAP Type Dictionary Type
x RAW with appropriate length
xstring RAWSTRING with appropriate length
ABAP Type for Date, Time, and Time Stamp Dictionary Type
d DATS
t TIMS
utclong UTCLONG

Untyped text field literals are handled as fields with the type CHAR of the corresponding length where trailing blanks are respected. Like the untyped numeric literals of a general ABAP, untyped numeric literals are handled either as a field with the type INT4 or the type DEC, depending on their value.

On the database, the value of an ABAP object as an elementary expression is handled according to the rules of the database in accordance with the mapped type. This is different from other operand positions of ABAP objects in , where they are not handled as elementary expressions. In these operand positions, the content is converted to the target type in accordance with the rules for lossless assignments.

Notes

  • Columns, literals, host variables, and host expressions can also occur as elementary SQL operands in operand positions in which no general SQL expressions are possible. Columns, literals, hosts variables, and host expressions can only be handled as SQL expressions in positions where SQL expressions are possible. Only there can they be specified inside parentheses. Then, the statement can only have lists separated by commas and host variables must be indicated by the escape character @.
  • If an elementary SQL expression consists of a host variable in the form of a field symbol or formal parameter, this expression must be completely typed.
  • Untyped literals, host variables, and host expressions as operands of other SQL expressions are evaluated before the statement is sent to the database system. Specifying a host variable from a SELECT list after INTO in a SELECT loop does not mean that a different value is used in each loop pass.
  • The fact that literals, host variables, and host expressions are mapped to specific dictionary types as operands of SQL expressions, whereas other operand positions allow conversions to different target types, is particularly significant for relational expressions in which the comparability of dictionary types is important.
  • An elementary expression can always be evaluated in the table buffer. If an elementary expression is specified, table buffering is not bypassed.
  • If a host expression is used as an argument of another SQL expression, the syntax check is performed in a strict mode from Release , which handles the statement more strictly than the regular syntax check.

Example

The SELECT list of the second SELECT statement contains all possible elementary SQL expressions.

Constant in the SELECT List






ABAP Short Reference   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 9007 Date: 20240508 Time: 135225     sap01-206 ( 106 ms )