Get Example source ABAP code based on a different SAP table
• /at ABAP_ESCAPE
AB_SQL - @dobj>
ABAP_SYNTAX ... @dobj ...>
What does it do? Specifying a host variable> in an AB-SQL statement. Host variables are global or local data objects dobj> declared in the ABAP program that are used in operand positions of AB-SQL statements. Instead of the data object itself, a field symbol to which the data object is assigned can also be specified. Dereferenced data reference variables can also be specified. Depending on the operand position, the data objects can be variables> or constants>. Constant host variables are host constants>. To identify a host variable, the names of named> data objects or field symbols should always be directly prefixed by the escape character @>. The escape character can only be used in programs, in which the program property fixed point arithmetic>> is activated. BEGIN_SECTION VERSION 5 OUT When the escape character is used, the syntax check is performed in a ABAP_STRICT_740_SP05 strict mode / , which handles the statement more strictly than the regular syntax check. END_SECTION VERSION 5 OUT The content of host variables in read positions is passed to the database system together with the SQL statement before it is executed. The content of host variables in write positions is taken from the database system after the SQL statement is ended.
Read positions in which host variables are handled as elementary SQL expressions> are subject to the corresponding rules and any mappings are made to a dictionary type. The content is evaluated on the database in accordance with this type.
In operand positions in which host variables are not handled as SQL expressions, a type conversion> into the appropriate data type takes place if required. In read positions, it must be possible to convert the content of a host variable to the data type required in the operand position in a lossless > manner. Any unsuitable host constants > produce syntax warnings or syntax errors BEGIN_SECTION VERSION 5 OUT , depending on the syntax check mode> END_SECTION VERSION 5 OUT . Host variables that cannot be converted in a lossless manner produce a catchable exception of class CX_SY_OPEN_SQL_DATA_ERROR>.
Latest notes:
In some operand positions in which host variables are allowed and host expressions> are prohibited, a host variable can nevertheless be specified with the syntax @( dobj )> and is handled as a host variable and not as an expression.
ABAP data objects that are specified as enclosed dynamic tokens do not belong to the host variables and cannot be prefixed by the escape character @>.
The escape character for host variables is independent of the general escape character for names !>>. The escape character !> can also be written in front of host variables that are already prefixed by the escape character @>. However, this is not recommended.
In addition to host variables, literals> can also be specified at the respective read positions in AB-SQL statements. A literal, however, cannot and does not need to be prefixed by the escape character @>. While untyped literals> are usually handled as host variables, typed literals> are always handled as elementary SQL expressions.
If host variables are used as elementary SQL expressions>, in particular as operands of other SQL expressions, they are mapped to a fixed dictionary type and the corresponding rules apply. This is different from their use in other operand positions, for which conversions to different dictionary types are generally possible.
Host variables cannot be enumerated objects>. NON_V5_HINTS
Specifying host variables without the escape character @> is obsolete>. The escape character @> must be specified in the strict modes> of the syntax check from ABAP_RELEASE ABAP_740_SP05 .
When host variables with an escape character @> are specified, the syntax check is performed in a ABAP_STRICT_740_SP08 strict mode / , which handles the statement more strictly than the regular syntax check. ABAP_HINT_END
ABAP_EXAMPLE_VX5 Specification of different host variables, whereby the escape character @> is always used. ABEXA 01197 ABAP_EXAMPLE_END
ABAP_EXAMPLE_VX5 Use of a host variable prefix> with the type c> and a host variable name> of the type string>. The host variable name> is used on the right-hand side of the WHERE> condition. A string is possible, but not an SQL expression. ABEXA 01198 ABAP_EXAMPLE_END
ABAP_EXAMPLE_VX5 The following SELECT> statement raises an exception because the content of the host variable carrid> cannot be assigned in a lossless manner. If carrid> were a constant, there would be an additional syntax warning. ABEXA 01648 ABAP_EXAMPLE_END