SAP ABAP SQL HOST EXPRESSIONS



Get Example source ABAP code based on a different SAP table
  


• /at( ) ABAP_ESCAPE

AB_SQL - @( expr )

ABAP_SYNTAX
... @( expr ) ...

What does it do?
Specification of a host expression in an AB-SQL statement. Host expressions are ABAP expressions expr that can be specified in operand positions in AB_SQL . expr is a general expression position. Any expressions or calls possible here, as well as individual data objects, can be specified.
Host expressions can be specified as elementary SQL expressions in all operand positions in which SQL expressions are possible. They can also occur in the following read positions in which no SQL expressions are possible:
Operand n after UP TO.
Operand n after PACKAGE SIZE.
Right sides of SQL conditions except LIKE and IN.
Actual parameters for input parameters of CDS views or CDS table functions.
Work areas wa and the internal tables itab of the statements INSERT, UPDATE, MODIFY and DELETE.
Right side of a SET expression in UPDATE.
The relevant restrictions apply in operand positions in which host variables are handled like SQL expressions.
The host expressions of an AB-SQL statement are evaluated from left to right and the results are passed to the database, like the content of host variables. Conversions of the result of a host expression to the data type required in the operand position must be possible and be lossless. The following additional restrictions apply:
Host expressions cannot be used in dynamic tokens.
In a host expression of a SELECT list, it is not possible to derive a data type from the operand position for the character # for a constructor expression.



Latest notes:

In the operand positions where host expressions can be specified, it is also always possible to specify host variables but not vice versa.
In some operand positions in which host expressions are forbidden, but literals and host variables are allowed, the syntax @( literal ) and @( dobj ) can be used. It is handled as a literal or host variable rather than as an expression.
NON_V5_HINTS
When host expressions are specified, the syntax check is performed in a ABAP_STRICT_760 strict mode / , which handles the statement more strictly than the regular syntax check.
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Determination of the right side of a comparison in a WHERE condition using a functional method call in a host expression. Within the host expression, the instance operator NEW is used here to create a temporary object.
ABEXA 01196
ABAP_EXAMPLE_END

ABAP_EXAMPLES_ABEXA
Host Expressions in the WHERE Condition
SQL Expressions in the WHERE Condition
ABAP_EXAMPLE_END