SAP SQL ELEM Get Example source ABAP code based on a different SAP table
SAP Help
ABAP_SQLEXP > - sql_elem> ABAP_SYNTAX ... col> $| literal> $| @dobj> $| @( expr )> ...> What does it do? Elementary expression in AB_SQL . An elementary SQL expression represents one of the following values: Value from the database Column col>> of a data source> 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 Literal> literal> Host variable> @dobj> Host expression> @( expr )> 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 AB_SQL , 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 >. Latest 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 AB-SQL 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. NON_V5_HINTS The column specification col> can contain a path expression> for CDS associations> or CTE associations>. If a host expression is used as an argument of another SQL expression, the syntax check is performed in a ABAP_STRICT_760 strict mode from ABAP_RELEASE ABAP_760 / , which handles the statement more strictly than the regular syntax check. ABAP_HINT_END ABAP_EXAMPLE_VX5 The SELECT> list> of the second SELECT>> statement contains all possible elementary SQL expressions. ABEXA 01271 ABAP_EXAMPLE_END ABAP_EXAMPLE_ABEXA Constant in the SELECT> List> ABAP_EXAMPLE_END