SAP FROM CLAUSE ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• FROM SELECT

SELECT, FROM
Short Reference

ABAP_SYNTAX
... FROM ${ ${data_source $[AS tabalias$]$}
$| join
$| ${(source_syntax) $[AS tabalias$]$} $}
$[ client_handling $] ...

ABAP_ALTERNATIVES:
1 ... data_source
2 ... join
3 ... (source_syntax)

ABAP Addition
... AS tabalias

What does it do?
The specifications after FROM determine whether a query accesses a DDIC database table,
BEGIN_SECTION VERSION 5 OUT a DDIC view, a
END_SECTION VERSION 5 OUT CDS entity, an SQL hierarchy, or an internal table as a data source data_source, or whether multiple data sources are accessed in a join expression. The optional addition AS defines an alias name for the data source. The optional additions client_handling affect how client handling is performed.

ABAP Alternative 1 ... data_source

What does it do?
Specification of a single data source data_source.



Latest notes:

If a data source is specified multiple times after FROM in a join expression, an alias name tabalias must be defined after AS to avoid ambiguities.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Specification of the DDIC database table SCARR as the only data source of a SELECT statement.
ABEXA 00290
ABAP_EXAMPLE_END

ABAP Alternative 2 ... join

What does it do?
Specifies a join expression that joins multiple data sources with one another.

ABAP_EXAMPLE_VX5
Specification of the DDIC database tables SCARR and SPFLI in a join expression.
ABEXA 00291
ABAP_EXAMPLE_END

ABAP Alternative 3 ... (source_syntax)
BEGIN_SECTION ID SELECT-FROM-DYN

What does it do?
Instead of static specifications, a data object source_syntax can be specified in parentheses. When the statement is executed, the data object must contain the syntax shown in the static specification. The data object source_syntax can be a character-like data object or a standard table with a character-like row type. The syntax in source_syntax is not case-sensitive. When an internal table is specified, the syntax can be distributed across multiple rows. Invalid syntax raises a catchable exception from the class CX_SY_DYNAMIC_OSQL_ERROR.
The addition AS used to specify an alias name statically can be specified only if source_syntax contains only the name of a single data source. The addition has the same meaning for this data source as when specified statically. In source_syntax, static attributes or constants of a class cannot be accessed from outside if the class has a static constructor that has not yet been executed.