This commit is contained in:
danrega
2024-10-21 16:07:56 +02:00
parent fa1f2dbdd4
commit d5879677d1
4 changed files with 762 additions and 343 deletions

View File

@@ -7,11 +7,11 @@
- [Excursion: Database Tables and Views](#excursion-database-tables-and-views)
- [Read Operations Using SELECT](#read-operations-using-select)
- [Basic Syntax](#basic-syntax)
- [SELECT List Variants](#select-list-variants)
- [Data Sources of SELECT Queries](#data-sources-of-select-queries)
- [Retrieving Single and Multiple Rows](#retrieving-single-and-multiple-rows)
- [Miscellaneous Options for the Selection Result](#miscellaneous-options-for-the-selection-result)
- [Additional Clauses](#additional-clauses)
- [Notes on Modern SELECT Statements](#notes-on-modern-select-statements)
- [Specifying the SELECT List and FIELDS Clause](#specifying-the-select-list-and-fields-clause)
- [Specifying the FROM Clause](#specifying-the-from-clause)
- [Specifying the Target and Related Additions](#specifying-the-target-and-related-additions)
- [Specifying Clauses to Order, Group and Set Conditions for the Result Set](#specifying-clauses-to-order-group-and-set-conditions-for-the-result-set)
- [Selecting Data by Evaluating the Content of Other Tables](#selecting-data-by-evaluating-the-content-of-other-tables)
- [Combining Data of Multiple Data Sources](#combining-data-of-multiple-data-sources)
- [Common Table Expressions (CTE)](#common-table-expressions-cte)
@@ -39,6 +39,8 @@
- [Using Constructor Expressions in ABAP SQL Statements](#using-constructor-expressions-in-abap-sql-statements)
- [Example: Exploring Create, Update, and Delete Operations with ABAP SQL Statements](#example-exploring-create-update-and-delete-operations-with-abap-sql-statements)
- [Excursions](#excursions)
- [Evaluating ABAP System Fields after ABAP SQL Statements](#evaluating-abap-system-fields-after-abap-sql-statements)
- [Typed Literals](#typed-literals)
- [ABAP SQL and Client Handling](#abap-sql-and-client-handling)
- [RAP-Specific ABAP SQL Variants](#rap-specific-abap-sql-variants)
- [More Information](#more-information)
@@ -64,6 +66,10 @@
ABAP SQL. The considerations there are not relevant for this cheat sheet since
the focus is on syntax options.
> **💡 Note**<br>
> The syntax options for the `SELECT` statement are extensive. Make sure that you consult the ABAP Keyword Documentation for all available options. The cheat sheet and snippets demonstrate a selection.
## Excursion: Database Tables and Views
<details>
@@ -149,66 +155,62 @@ Views](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm
### Basic Syntax
You use ABAP SQL `SELECT` statements to retrieve data from one or more data sources (such as database tables, views or internal tables). This can be done to create a multirow or single row result set by assigning the result set to a suitable data object, i. e. you can store the multirow read result in an internal table or the single row result in a structure.
The `SELECT` statement includes several clauses that serve
different purposes. The following code snippet shows the basic syntax (see the note below for a different but interchangeable syntax):
- You use ABAP SQL `SELECT` statements to retrieve data from one or more data sources (such as database tables, views or internal tables). Note that many syntax examples in this cheat sheet show a selection from `dbtab` denoting a database table as a source.
- This can be done to create a multirow or single row result set by assigning the result set to a suitable data object, i. e. you can store the multirow read result in an internal table or the single row result in a structure.
- The `SELECT` statement includes several clauses that serve different purposes.
- The following code snippet shows the basic syntax and mandatory clauses to be specified. Although its use is optional, a `WHERE` clause should be specified to further restrict the read result.
- However, there are plenty of additions and syntax variants, some of which are mentioned in the cheat sheet. In general, choose `F1` for the keywords and additions to get all the details in the ABAP Keyword Documentation.
``` abap
SELECT FROM source "What database table or view to read from
SELECT FROM source "What data source read from
FIELDS field_list "What columns should be read
WHERE condition "Specifies conditions on which a row/rows should be read
INTO @target. "Data object to which the result set is assigned (preceded by @)
INTO target. "Specifies the target of the result set
```
> **💡 Note**<br>
>- There are further clauses available of which some are dealt with
further down. In general, the recommendation is to hit `F1` for the keywords and additions to get all the details in the ABAP Keyword Documentation.
>- Especially in older ABAP programs, you will see other forms of the
`SELECT` syntax that you should no longer use. Strict syntax check modes might enforce the use
of specific ABAP SQL syntax. For example, the `INTO` clause should be placed after the other clauses. Furthermore, [host variables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenhost_variable_glosry.htm "Glossary Entry") or [host expressions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenhost_expression_glosry.htm "Glossary Entry") are required for data objects and expressions, i. e. they must be preceded by `@` or `@( ... )`. Further information: [Release-Dependent Syntax Check Modes (F1 docu for standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_sql_strict_modes.htm).
>- Regarding host variables as in `SELECT ... INTO @target.` and since they are used in most examples below: A host variable is a data object that is
> - declared in the ABAP program
> - prefixed with the `@` character and
> - specified in an [operand position](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenoperand_position_glosry.htm) of an ABAP SQL statement.
> See more information [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenhost_variable_glosry.htm).
>- The `SELECT` list, i. e. the fields that are specified, can also be specified following the `SELECT`
keyword before the `FROM` clause - without `FIELDS`. The following two `SELECT` statements are basically the same but differently arranged. The code snippets in the cheat sheet randomly use one syntax or the other.
> ``` abap
> SELECT FROM dbtab
> FIELDS comp1, comp2, comp3
> ...
>
> SELECT comp1, comp2, comp3
> FROM dbtab
> ...
> ```
>- Regarding the target into which data is read: Instead of using a
variable that is (extra) declared beforehand, you can also make use
of [inline
declarations](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abeninline_declaration_glosry.htm "Glossary Entry"),
for example `... INTO TABLE @DATA(itab).`, to comfortably
create an appropriate variable in place. Note that in case of
internal tables as targets, the resulting table is a standard table
and has an empty key which might have an impact when further
processing the internal table entries. Find more information in the
ABAP cheat sheet [Internal Tables](01_Internal_Tables.md). The declaration operator [`FINAL`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenfinal_inline.htm) can be used to declare immutable variables.
>- Many syntax examples in this cheat sheet show a selection from `dbtab` denoting a database table as a source. However, other data sources can also be specified.
>- The syntax options for the `SELECT` statement are extensive. Make sure that you consult the ABAP Keyword Documentation for all available options. The cheat sheet and snippets demonstrate a selection.
<p align="right"><a href="#top">⬆️ back to top</a></p>
### SELECT List Variants
#### Notes on Modern SELECT Statements
The following specifications can also be combined:
- `SELECT * ...`: As outlined above, the `*` character defines all columns to be read from a data source (in the order specified there).
- `SELECT col1, col2, col3 ...`: A comma-separated list of individual column names.
- `SELECT data_source~col1, data_source~col2, data_source~col3 ...`: A comma-separated list of individual column names. Here, the name of the data source is explicitly specified and precedes the column name, separated by a tilde.
- `SELECT data_source~* ...`: In this case, the name of the data source is followed by a tilde and the `*` character to specify all columns. Note that there are [special conditions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_list.htm#!ABAP_VARIANT_1@1@) when using this variant.
- `SELECT col1 AS al1, col2 AS al2, col3 AS al3 ...`:
- Defining alias names for individual columns of the result set with [`AS`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_list.htm).
- Make sure that you use an alias name only once here. In the statement, the alias name can only be used after an `ORDER BY` clause.
- As shown further down, in some cases (e. g. when using SQL expressions) the specification of an alias name is required. Setting an alias name for the data source is also possible (`SELECT FROM dbtab AS alias_name ...`). See the section on joins further down.
- Especially in [Standard ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenstandard_abap_glosry.htm), in older ABAP programs, etc. you may stumble on variants of the `SELECT` syntax (i.e. differently arranged or differently specified ABAP SQL syntax) that you should no longer use (strict syntax check modes enforce the use of specific ABAP SQL syntax) and/or are not possible in [ABAP for Cloud Development](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_for_cloud_dev_glosry.htm).
- However, in certain cases, older syntax variants are still valid and usable. An example is the `SELECT` list, that can also be specified using the more modern `FIELDS` addition.
- As mentioned, choose `F1` for the keywords and additions to get all the details in the ABAP Keyword Documentation.
- Further information in the context of Standard ABAP: [Release-Dependent Syntax Check Modes (F1 docu for standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_sql_strict_modes.htm).
- To mentioned some examples of modern ABAP SQL statements.
- The `INTO` clause should be placed after the other clauses.
- [Host variables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenhost_variable_glosry.htm "Glossary Entry") or [host expressions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenhost_expression_glosry.htm "Glossary Entry") are required for data objects and expressions, i. e. they must be preceded by `@` or `@( ... )`. Host variables represent data objects that are declared in ABAP programs. They are specified in an [operand position](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenoperand_position_glosry.htm) of an ABAP SQL statement. Also see the [SQL Operands](#sql-operands) section.
- The `SELECT` list, i. e. the fields that are specified, can also be specified following the `SELECT` keyword before the `FROM` clause - without `FIELDS`. The following two `SELECT` statements are basically the same but differently arranged. The code snippets in the cheat sheet randomly use one syntax or the other.
``` abap
SELECT FROM dbtab
FIELDS comp1, comp2, comp3
...
SELECT comp1, comp2, comp3
FROM dbtab
...
```
- Regarding the target into which data is read: Instead of using a variable that is (extra) declared beforehand, you can also make use of [inline declarations](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abeninline_declaration_glosry.htm "Glossary Entry"), for example `... INTO TABLE @DATA(itab).`, to comfortably create an appropriate variable in place. Note that in case of internal tables as targets, the resulting table is a standard table and has an empty key which might have an impact when further
processing the internal table entries. Find more information in the ABAP cheat sheet [Internal Tables](01_Internal_Tables.md). The declaration operator [`FINAL`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenfinal_inline.htm) can be used to declare immutable variables.
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Specifying the SELECT List and FIELDS Clause
- Using the `SELECT` list/`FIELDS` clause, you define the structure of the result set.
- You can do this by specifying the columns to be read from the data source individually, or by specifying `*` to read all columns.
- Syntax variants are possible.
- Note that you can specify the addition `SINGLE` after `SELECT`. With `SINGLE`, it means the result set is a single row result set. Otherwise, it is a multirow result set. An appropriate data object must be specified in the `INTO` clause.
| Syntax | Notes |
|----------|-------------|
| `SELECT * ...` <br><br> `SELECT ... FIELDS * ...` | As outlined above, the `*` character defines all columns to be read from a data source (in the order specified there). |
| `SELECT col1, col2, col3 ...` <br><br> `SELECT ... FIELDS col1, col2, col3 ...` | A comma-separated list of individual column names. |
| `SELECT data_source~col1, data_source~col2, data_source~col3 ...` <br><br> `SELECT ... FIELDS data_source~col1, data_source~col2, data_source~col3 ...` | A comma-separated list of individual column names. Here, the name of the data source is explicitly specified and precedes the column name, separated by a tilde. |
| `SELECT data_source~* ...` <br><br> `SELECT ... FIELDS data_source~* ...` | In this case, the name of the data source is followed by a tilde and the `*` character to specify all columns. Note that there are [special conditions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_list.htm#!ABAP_VARIANT_1@1@) when using this variant. |
| `SELECT col1 AS al1, col2 AS al2, col3 AS al3 ...` <br><br> `SELECT ... FIELDS col1 AS al1, col2 AS al2, col3 AS al3 ...` | Defining alias names for individual columns of the result set with [`AS`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_list.htm); make sure that you use an alias name only once here. In the statement, the alias name can only be used after an `ORDER BY` clause; as shown further down, in some cases (e. g. when using SQL expressions) the specification of an alias name is required; setting an alias name for the data source is also possible (`SELECT FROM dbtab AS alias_name ...`). See the section on joins further down. |
> **💡 Note**<br>
> You have plenty of options regarding the specification of the columns in the `SELECT` list, among them, the outlined direct specification of the column name. SQL expressions can be specified, too. See more details [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_clause_col_spec.htm) and in the sections on SQL expressions further down.
> - You have plenty of options regarding the specification of the columns in the `SELECT` list, among them, the outlined direct specification of the column name. SQL expressions can be specified, too. See more details [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_clause_col_spec.htm) and in the sections on SQL expressions further down.
``` abap
@@ -240,8 +242,8 @@ SELECT dbtab~*
"object but, for example, a name in the target is different. Provided that there will
"not be an issue regarding the type (conversion) when the values are assigned, you might
"specify an alias name for the database column to match a component's name in the target data object.
SELECT FROM dbtab
FIELDS comp1 AS comp_a, comp2 AS comp_b, comp3 AS comp_c
SELECT comp1 AS comp_a, comp2 AS comp_b, comp3 AS comp_c
FROM dbtab
WHERE ...
INTO CORRESPONDING FIELDS OF TABLE @itab.
@@ -252,40 +254,290 @@ SELECT ds~col1, ds~col2, ds~col3
INTO ...
```
<p align="right"><a href="#top">⬆️ back to top</a></p>
Example code using a demo database table from the cheat sheet repository, and using the `FIELDS` addition.
### Data Sources of SELECT Queries
```abap
"The examples do not specify a WHERE clause.
- Most of the code snippets in this cheat sheet use database tables as the source in `SELECT` statements.
- Among others, you can also use internal tables or CDS view entities as data source.
- Note that the internal table must be specified as host variable prefixed by `@`, and an alias name must be specified.
- More information and code snippets:
- Section [SELECT Queries with Internal Tables as Data Sources](01_Internal_Tables.md#select-queries-with-internal-tables-as-data-sources) in the *Internal Tables* cheat sheet and in the [ABAP Keyword Documentation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_itab.htm)
- The executable example of the [CDS View Entities](15_CDS_View_Entities.md) cheat sheet covers `SELECT` statements with CDS view entities as data sources.
"All fields
SELECT FROM zdemo_abap_carr
FIELDS *
INTO TABLE @DATA(itab).
``` abap
SELECT *
FROM @itab1 AS tab
WHERE ...
INTO ....
"Comma-separated list
SELECT FROM zdemo_abap_carr
FIELDS carrid, carrname, url
INTO TABLE @itab.
SELECT *
FROM some_cds_view
WHERE ...
INTO ....
"Comma-separated list, data source explicitly specified
SELECT FROM zdemo_abap_carr
FIELDS zdemo_abap_carr~carrid, zdemo_abap_carr~carrname, url
INTO TABLE @itab.
"Data source explicitly specified, all fields
SELECT FROM zdemo_abap_carr
FIELDS zdemo_abap_carr~*
INTO TABLE @itab.
"Alias names
SELECT FROM zdemo_abap_carr
FIELDS carrid AS comp_a, carrname AS comp_b, url AS comp_c
INTO TABLE @DATA(itab_comp_alias).
"Alias name also possible for the data source
SELECT FROM zdemo_abap_carr AS ds
FIELDS ds~carrid, ds~carrname, ds~url
INTO TABLE @DATA(itab_db_alias).
```
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Specifying the FROM Clause
### Retrieving Single and Multiple Rows
- The `FROM` clause specifies data sources from which data is read.
- The data sources include:
- DDIC database tables (which are used as data source in most of the code snippets)
- CDS entities such as [CDS view entities](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_v2_view_glosry.htm) and [CDS table functions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_table_function_glosry.htm)
- The executable example of the [CDS View Entities](15_CDS_View_Entities.md) cheat sheet covers `SELECT` statements with CDS view entities as data sources.
- Internal tables
- Note that the internal table must be specified as host variable prefixed by `@`, and an alias name must be specified.
- More information and code snippets: Section [SELECT Queries with Internal Tables as Data Sources](01_Internal_Tables.md#select-queries-with-internal-tables-as-data-sources) in the *Internal Tables* cheat sheet and in the [ABAP Keyword Documentation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_itab.htm)
``` abap
SELECT *
FROM dbtab
WHERE ...
INTO ....
SELECT FROM @itab1 AS tab
FIELDS ...
WHERE ...
INTO ....
SELECT *
FROM cds_view
WHERE ...
INTO ....
```
Example using cheat sheet repository objects and demo internal table:
``` abap
"Database table
SELECT FROM zdemo_abap_fli
FIELDS *
INTO TABLE @DATA(itab_db).
"CDS entities
"CDS view entity
SELECT *
FROM zdemo_abap_fli_ve
INTO TABLE @DATA(itab_ve).
"CDS table function
SELECT FROM zdemo_abap_table_function
FIELDS *
INTO TABLE @DATA(itab_tf).
"Internal table
TYPES: BEGIN OF s,
num TYPE i,
chars TYPE c LENGTH 3,
END OF s,
t_type TYPE TABLE OF s WITH EMPTY KEY.
DATA(itab) = VALUE t_type( ( num = 1 chars = 'aaa' )
( num = 2 chars = 'bbb' )
( num = 3 chars = 'ccc' ) ).
SELECT FROM @itab AS it
FIELDS *
INTO TABLE @DATA(itab_it).
```
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Specifying the Target and Related Additions
This section demonstrates a selection of ABAP SQL `SELECT` statement patterns for specifying target-related additions to handle query results. There is a wide range of options available, some of which have already been covered above.
Syntax options regarding the target:
<table>
<tr>
<td> Syntax </td> <td> Notes </td>
</tr>
<tr>
<td>
`... INTO TABLE ...`
</td>
<td>
An internal table is expected for the result set. It may be declared inline to automatically have a suitable type, which also applies to `... INTO ...`.
```abap
SELECT FROM dbtab
FIELDS *
WHERE ...
INTO TABLE @itab.
```
</td>
</tr>
<tr>
<td>
`... INTO ...`
</td>
<td>
Expects a structure when used without `TABLE`.
```abap
SELECT SINGLE comp1, comp2, comp3
FROM dbtab
WHERE ...
INTO @struc.
```
</td>
</tr>
<tr>
<td>
`... INTO CORRESPONDING FIELDS OF [TABLE] ...`
</td>
<td>
- Only the content of columns for which there are identically named components in the target are assigned.
- However, if you want to read data into an existing data object and particular fields are specified in the `SELECT` list or `FIELDS` clause, and if the addition is **not** specified, you might stumble on undesired results.
- The target data object must contain enough components and the content of the columns are assigned to the components of the target from left to right in the order specified. The content of surplus components of the target is not changed.
- Plus, pay attention to [assignment rules](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenselect_into_conversion.htm).
- Basic rule: Without `CORRESPONDING ...`, column names do not play a role but only the position. With `CORRESPONDING ...`, the position of the columns does not play a role but only the name.
```abap
SELECT SINGLE comp1, comp2, comp3
FROM dbtab
WHERE ...
INTO CORRESPONDING FIELDS OF @struc.
SELECT FROM dbtab
FIELDS comp1, comp2, comp3
WHERE ...
INTO CORRESPONDING FIELDS OF TABLE @itab.
```
</td>
</tr>
<tr>
<td>
`... APPENDING [CORRESPONDING FIELDS OF] TABLE ...`
</td>
<td>
The addition `INTO` initializes the target object. When using the addition `APPENDING`, you can retain existing lines in internal tables. `APPENDING` is also possible with the addition `CORRESPONDING FIELDS OF`.
```abap
SELECT * FROM dbtab
WHERE ...
APPENDING TABLE @itab.
"APPENDING is also possible with the addition CORRESPONDING FIELDS OF
SELECT * FROM dbtab
WHERE ...
APPENDING CORRESPONDING FIELDS OF TABLE @diff_itab.
```
</td>
</tr>
<tr>
<td> <code>NEW</code> addition: Specifying an anonymous data object as target object </td>
<td>
- Specifying an [anonymous data object](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenanonymous_data_object_glosry.htm) as target object using the addition [`NEW`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_into_target.htm#!ABAP_ALTERNATIVE_3@3@)
- Only to be used after `INTO` and not `APPENDING`.
<br>
``` abap
"The examples declares target objects as anonymous data objects inline.
SELECT *
FROM zdemo_abap_flsch
INTO TABLE NEW @DATA(itab_ref).
SELECT SINGLE *
FROM zdemo_abap_flsch
INTO NEW @DATA(wa_ref).
```
</td>
</tr>
<tr>
<td>
`... INTO ( dobj1, dob2, ... ) ...`
</td>
<td>
Apart from reading into structures and internal tables outlined above, you can also read into individual elementary data objects.
Here, the individual elementary data objects as target objects are specified in a comma-separated list (e. g. as existing host variables or declared inline) and put between a pair of parentheses.
Note:
- The comma-separated list must have the same number of elements as columns in the result set.
- The content of the columns in the result set is assigned to the data objects specified in the list from left to right in accordance with the order specified in the `SELECT` list.
- Note the [assignment rules](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenselect_into_conversion.htm) also in this context.
- More information [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapinto_clause.htm#!ABAP_ALTERNATIVE_1@1@).
``` abap
"Elementary data objects as target data objects
DATA id TYPE zdemo_abap_carr-carrid.
DATA name TYPE zdemo_abap_carr-carrname.
SELECT SINGLE FROM zdemo_abap_carr
FIELDS carrid, carrname
WHERE carrid = char`LH`
INTO ( @id, @name ).
"Inline declarations with DATA/FINAL and the
"creation of anonymous data objects with NEW are
"possible
SELECT SINGLE FROM zdemo_abap_carr
FIELDS carrid, carrname, url
WHERE carrid = char`LH`
INTO ( @id, @DATA(name2), NEW @FINAL(dref) ).
```
</td>
</tr>
</table>
More target-related additions:
<table>
<tr>
<td> Subject </td> <td> Details/Code Snippet </td>
</tr>
<tr>
<td> Retrieving a single row into a structure </td>
<td>
`SINGLE` addition: Retrieving a single row into a structure </td>
<td>
``` abap
@@ -317,12 +569,6 @@ SELECT SINGLE comp1, comp2, comp3 "Selected set of fields
INTO CORRESPONDING FIELDS OF @struc. "Existing structure
```
> **💡 Note**<br>
>- Although its use is optional, a `WHERE` clause should be specified to further restrict the read result.
>- Regarding the addition `CORRESPONDING FIELDS OF` in the `INTO`
clause: As mentioned, only the content of columns for which there are identically named components in the target are assigned. However, if you want to read data into an existing data object and particular fields are specified in the `SELECT` list and if the addition is **not** specified, you might stumble on undesired results. The target data object must contain enough components and the content of the columns are assigned to the components of the target from left to right in the order specified after `SELECT`. The content of surplus components of the target is not changed. Plus, pay attention to [assignment rules](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenselect_into_conversion.htm). Basic rule: Without `CORRESPONDING ...`, column names do not play a role but only the position. With `CORRESPONDING ...`, the position of the columns does not play a role but only the name.
>- Find more information regarding the addition `INTO` [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapinto_clause.htm).
</td>
</tr>
<tr>
@@ -347,6 +593,17 @@ SELECT FROM dbtab
FIELDS comp1, comp2, comp3 "Selected set of fields
WHERE ...
INTO CORRESPONDING FIELDS OF TABLE @itab.
"The addition INTO initializes the target object. When using the addition APPENDING,
"you can retain existing lines in internal tables.
SELECT * FROM dbtab
WHERE ...
APPENDING TABLE @itab.
"APPENDING is also possible with the addition CORRESPONDING FIELDS OF
SELECT * FROM dbtab
WHERE ...
APPENDING CORRESPONDING FIELDS OF TABLE @diff_itab.
```
</td>
@@ -386,7 +643,7 @@ ENDSELECT.
``` abap
"Instead of @abap_true, you could also use 'X'.
"The example uses @abap_true. Other specifications are possible, e.g. 'X'.
SELECT SINGLE @abap_true
FROM dbtab
WHERE ...
@@ -409,27 +666,30 @@ ENDIF.
<br>
``` abap
SELECT DISTINCT comp1
FROM dbtab
WHERE ...
INTO TABLE @itab.
"The following example assumes that there are multiple flights
"from a city of the specified carrier with the particular destination.
"Assume there are 5 flights available from Frankfurt (cityfrom) that
"matches the WHERE clause. The first statement only returns one entry
"in the internal table, the second 5 (all).
"Using the DISTINCT addition
SELECT DISTINCT cityfrom
FROM zdemo_abap_flsch
WHERE carrid = 'LH' AND
cityto = 'NEW YORK'
INTO TABLE @DATA(itab_distinct).
"Not using the DISTINCT addition
SELECT cityfrom
FROM zdemo_abap_flsch
WHERE carrid = 'LH' AND
cityto = 'NEW YORK'
INTO TABLE @DATA(itab_no_distinct).
```
</td>
</tr>
</table>
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Miscellaneous Options for the Selection Result
This section demonstrates different patterns of the ABAP SQL `SELECT` statement for handling query results. There is a wide range of options available, some of which have already been covered above. This section covers a selection of additions and syntax options. For complete details and syntax options, you can refer to the ABAP Keyword Documentation.
<table>
<tr>
<td> Subject </td> <td> Details/Code Snippet </td>
</tr>
<tr>
<td> <code>UP TO n ROWS</code> addition: Limiting the number of returned table rows </td>
@@ -474,53 +734,6 @@ SELECT *
</td>
</tr>
<tr>
<td> Storing the result in individual elementary data objects </td>
<td>
Apart from reading into structures and internal tables outlined above, you can also read into individual elementary data objects.
Here, the individual elementary data objects as target objects are specified in a comma-separated list (e. g. as existing host variables or declared inline with `@DATA(...)`) and put between a pair of parentheses.
Note:
- The comma-separated list must have the same number of elements as columns in the result set.
- The content of the columns in the result set is assigned to the data objects specified in the list from left to right in accordance with the order specified in the `SELECT` list.
- Note the [assignment rules](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenselect_into_conversion.htm) also in this context.
- More information [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapinto_clause.htm#!ABAP_ALTERNATIVE_1@1@).
<br>
``` abap
SELECT FROM dbtab
FIELDS comp1, comp2, comp3
WHERE ...
INTO (@res1,@res2,@res3).
"INTO (@DATA(res4),@DATA(res5),@DATA(res6)). "Using inline declarations
```
</td>
</tr>
<tr>
<td> <code>APPENDING</code> addition: Appending the result set to an existing internal table </td>
<td>
The addition `INTO` initializes the target object. When using the addition `APPENDING`, you can retain existing lines in internal tables. `APPENDING` is also possible with the addition `CORRESPONDING FIELDS OF TABLE`.
<br>
``` abap
SELECT * FROM dbtab
WHERE ...
APPENDING TABLE @itab.
SELECT * FROM dbtab
WHERE ...
APPENDING CORRESPONDING FIELDS OF TABLE @diff_itab.
```
</td>
</tr>
<tr>
<td> <code>PACKAGE SIZE n</code> addition: Storing the result in packages of a specified number of rows </td>
<td>
@@ -542,25 +755,7 @@ ENDSELECT.
</td>
</tr>
<tr>
<td> <code>NEW</code> addition: Specifying an anonymous data object as target object </td>
<td>
- Specifying an [anonymous data object](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenanonymous_data_object_glosry.htm) as target object using the addition [`NEW`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_into_target.htm#!ABAP_ALTERNATIVE_3@3@)
- Only to be used after `INTO` and not `APPENDING`.
<br>
``` abap
"Here, the target object is an anonymous data object declared inline.
SELECT FROM dbtab
FIELDS comp1, comp2, comp3
WHERE ...
INTO TABLE NEW @DATA(dref).
```
</td>
</tr>
<tr>
<td> <code>INDICATORS [NOT] NULL STRUCTURE</code> addition: Specifying null indicators </td>
@@ -630,7 +825,7 @@ SELECT tab2~key_field, tab1~char2
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Additional Clauses
### Specifying Clauses to Order, Group and Set Conditions for the Result Set
<table>
<tr>
@@ -1132,6 +1327,8 @@ SELECT id FROM @itab AS tab WHERE id NOT BETWEEN 1 AND 4 INTO TABLE @it. "5-12
"------------------------ IS [NOT] INITIAL ------------------------
SELECT id FROM @itab AS tab WHERE id IS NOT INITIAL INTO TABLE @it. "1-12
SELECT id FROM @itab AS tab WHERE id IS INITIAL INTO TABLE @it. "No entry
"------------------------ [NOT] LIKE ------------------------
"For (not) matching a specified pattern
"Note: % (any character string), _ (any character).
@@ -1140,6 +1337,10 @@ SELECT name FROM @itab AS tab
OR name LIKE '_o%'
INTO TABLE @DATA(names). "dog,deer,cheetah,donkey,sheep
SELECT name FROM @itab AS tab
WHERE name NOT LIKE '%ee%'
INTO TABLE @names. "All except deer, cheetah, sheep
"ESCAPE addition for defining a single-character escape character
"In the following example, this character is #. It is placed before
"the % character in the specification after LIKE. In this case, %
@@ -1322,11 +1523,7 @@ operands](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?f
(using the type name and content within a pair of backquotes:
<code>char\`abc\`</code>) with [built-in ABAP Dictionary
types](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenddic_builtin_types.htm)
or untyped. Typed literals are preferable for the following
reasons: Using untyped literals means extra cost in terms of
performance since they must be converted by the compiler. Plus,
their use can result in errors at runtime whereas typed literals
guarantee type compatibility at once. For more information on [typed literals](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentyped_literal_glosry.htm), refer to the [ABAP Keyword Documentation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_sql_typed_literals.htm) and the [Typed Literals in ABAP SQL](/16_Data_Types_and_Objects.md#typed-literals-in-abap-sql) section of the *Data Types and Data Objects* cheat sheet.
or untyped. See the [Typed Literals](#typed-literals) section further down.
- Regarding host expressions: Structures and internal tables are
possible as host expressions for statements modifying the
content of database tables as shown further down.
@@ -2525,6 +2722,181 @@ ENDCLASS.
## Excursions
### Evaluating ABAP System Fields after ABAP SQL Statements
As mentioned in several sections above, ABAP system fields such as `sy-subrc` and `sy-dbcnt` are set in the context of ABAP SQL statements, which can be evaluated.
| Statement | sy-subrc | sy-dbcnt |
|---|---|---|
| `SELECT` | 0 = Values were passed successfully to a target data object <br> 4 = Result set is empty. Typically, this means that there are no entries found (matching conditions specified). | The number of rows that were passed. |
| `INSERT` | 0 = Single row (work area specified) or all rows (internal table specified) inserted <br> 4 = Row not or not all rows inserted (in case of multiple rows to be inserted, `ACCEPTING DUPLICATE KEYS` was specified) | The number of rows that were inserted. |
| `MODIFY` | 0 = Single row (work area specified) or all rows (internal table specified) inserted or modified <br> 4 = Row not or not all rows inserted or modified | The number of rows that were processed. |
| `UPDATE` | 0 = Single row (work area specified) or all rows updated <br> 4 = Row not or not all rows updated | The number of rows that were updated. |
| `DELETE` | `DELETE FROM target` variant: <br> 0 = At least one row deleted (with `WHERE` clause specified), all or n rows deleted (without `WHERE` clause specified) <br> 4 = No row deleted <br><br>`DELETE target FROM` variant: <br> 0 = Row deleted (work area specified), all rows deleted (internal table specified) <br> 4 = Row not deleted (work area specified), not all specified rows deleted (internal table specified) | The number of rows that were deleted. |
The following example explores the setting of `sy-subrc` and `sy-dbcnt` by ABAP SQL statements using a demo database table from the cheat sheet repository.
```abap
"Clearing a demo database table
DELETE FROM zdemo_abap_tab1.
"--------------------- INSERT ---------------------
INSERT zdemo_abap_tab1 FROM @( VALUE #( key_field = 1 ) ).
ASSERT sy-subrc = 0.
ASSERT sy-dbcnt = 1.
INSERT zdemo_abap_tab1 FROM TABLE @( VALUE #( ( key_field = 2 )
( key_field = 3 ) ) ).
ASSERT sy-subrc = 0.
ASSERT sy-dbcnt = 2.
INSERT zdemo_abap_tab1 FROM TABLE @( VALUE #( ( key_field = 2 )
( key_field = 3 ) ) ) ACCEPTING DUPLICATE KEYS.
ASSERT sy-subrc = 4.
ASSERT sy-dbcnt = 0.
INSERT zdemo_abap_tab1 FROM TABLE @( VALUE #( ( key_field = 3 )
( key_field = 4 ) ) ) ACCEPTING DUPLICATE KEYS.
ASSERT sy-subrc = 4.
ASSERT sy-dbcnt = 1.
"--------------------- UPDATE ---------------------
UPDATE zdemo_abap_tab1 FROM @( VALUE #( key_field = 1 num1 = 1 ) ).
ASSERT sy-subrc = 0.
ASSERT sy-dbcnt = 1.
UPDATE zdemo_abap_tab1 FROM @( VALUE #( key_field = 9999 num1 = 9999 ) ).
ASSERT sy-subrc = 4.
ASSERT sy-dbcnt = 0.
UPDATE zdemo_abap_tab1 FROM TABLE @( VALUE #( ( key_field = 2 num1 = 2 )
( key_field = 3 num1 = 3 ) ) ).
ASSERT sy-subrc = 0.
ASSERT sy-dbcnt = 2.
UPDATE zdemo_abap_tab1 FROM TABLE @( VALUE #( ( key_field = 4 num1 = 4 )
( key_field = 1111 num1 = 1111 ) ) ).
ASSERT sy-subrc = 4.
ASSERT sy-dbcnt = 1.
"--------------------- MODIFY ---------------------
MODIFY zdemo_abap_tab1 FROM @( VALUE #( key_field = 1 num1 = 11 ) ).
ASSERT sy-subrc = 0.
ASSERT sy-dbcnt = 1.
MODIFY zdemo_abap_tab1 FROM TABLE @( VALUE #( ( key_field = 2 num1 = 22 ) "Entry modified
( key_field = 5 num1 = 5 ) ) ). "Entry inserted
ASSERT sy-subrc = 0.
ASSERT sy-dbcnt = 2.
"--------------------- SELECT ---------------------
SELECT *
FROM zdemo_abap_tab1
INTO TABLE @DATA(itab).
ASSERT sy-subrc = 0.
ASSERT sy-dbcnt = 5.
ASSERT sy-dbcnt = lines( itab ).
SELECT *
FROM zdemo_abap_tab1
WHERE key_field <= 3
INTO TABLE @DATA(itab2).
ASSERT sy-subrc = 0.
ASSERT sy-dbcnt = 3.
SELECT *
FROM zdemo_abap_tab1
WHERE key_field > 10
INTO TABLE @DATA(itab3).
ASSERT sy-subrc = 4.
ASSERT sy-dbcnt = 0.
"--------------------- DELETE ---------------------
DELETE zdemo_abap_tab1 FROM @( VALUE #( key_field = 1 ) ).
ASSERT sy-subrc = 0.
ASSERT sy-dbcnt = 1.
DELETE zdemo_abap_tab1 FROM TABLE @( VALUE #( ( key_field = 1 ) "Entry not existent
( key_field = 2 )
( key_field = 3 ) ) ).
ASSERT sy-subrc = 4.
ASSERT sy-dbcnt = 2.
DELETE FROM zdemo_abap_tab1 WHERE key_field >= 5.
ASSERT sy-subrc = 0.
ASSERT sy-dbcnt = 1.
"Only one entry left in the database table
DELETE FROM zdemo_abap_tab1.
ASSERT sy-subrc = 0.
ASSERT sy-dbcnt = 1.
SELECT *
FROM zdemo_abap_tab1
INTO TABLE @DATA(itab4).
ASSERT sy-subrc = 4.
ASSERT sy-dbcnt = 0.
```
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Typed Literals
- [Built-in DDIC types](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenbuiltin_ddic_type_glosry.htm) cannot be used directly in ABAP, e.g. for typing local data objects.
- However, the types can be used in ABAP SQL, and also ABAP CDS, in the context of [typed literals](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentyped_literal_glosry.htm). Note that some special types cannot be used in this context.
- Advantages of typed literals over untyped literals:
- Allow type-safe use of literals
- Eliminate the need for (implicit type) conversions and casts, which can lead to surprising or erroneous results. Also consider the conversion costs in terms of performance (typed literals are passed to the database and evaluated there without ABAP-specific type conversions).
- For better readability (you can immediately see what type is being used)
- More information:
- [Typed literals in ABAP SQL](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_sql_typed_literals.htm)
- [Typed literals in ABAP CDS](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_typed_literal_v2.htm)
- They can also be used in casts in ABAP [SQL](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensql_cast.htm) and [CDS](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_cast_expression_v2.htm).
```abap
"Miscellaneous typed literals in an ABAP SQL statement
"Note that typed literals can be specified in read
"positions where host variables are possible.
DATA(tmstamp) = CONV timestamp( '20240808112517' ).
DATA(some_string) = `Some string`.
SELECT SINGLE
FROM zdemo_abap_fli
FIELDS
carrid,
@some_string AS host_var,
char`X` AS flag,
int8`32984723948723` AS int8,
raw`11` AS raw,
numc`1234` AS numc,
utclong`2024-01-01T10:01:02,2` AS utc,
tims`101507` AS tims,
curr`173.95` AS curr,
"Multiple cast expressions splitting a time stamp into date and time parts
CAST( CAST( div( @tmstamp, 1000000 ) AS CHAR ) AS DATS ) AS date,
CAST( substring( CAST( @tmstamp AS CHAR ), 9, 6 ) AS TIMS ) AS time,
"Untyped literal
'ABAP' AS txt
WHERE fldate = datn`20240102`
INTO @DATA(misc_typed_literals).
```
<p align="right"><a href="#top">⬆️ back to top</a></p>
### ABAP SQL and Client Handling
> **🌰 In brief**<br>

View File

@@ -14,6 +14,8 @@
- [Class Attributes](#class-attributes)
- [Methods](#methods)
- [Parameter Interface](#parameter-interface)
- [Formal and Actual Parameters](#formal-and-actual-parameters)
- [Defingin Parameters as Optional](#defingin-parameters-as-optional)
- [Constructors](#constructors)
- [Example for Method Definitions](#example-for-method-definitions)
- [Working with Objects and Components](#working-with-objects-and-components)
@@ -508,6 +510,8 @@ ENDCLASS.
You declare them using `METHODS` statements in a visibility
section. Note that you must create an instance of a class first before using instance methods.
<p align="right"><a href="#top">⬆️ back to top</a></p>
#### Parameter Interface
In the simplest form, methods can have no parameter at all. Apart from that, methods can be defined with the following parameters:
@@ -524,46 +528,35 @@ In the simplest form, methods can have no parameter at all. Apart from that, met
> **💡 Note**<br>
> - Find more information [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmethods_general.htm).
> - You may find the addition `EXCEPTIONS` especially in definitions of older classes. They are for non-class-based exceptions. This addition should not be used in ABAP for Cloud Development.
> - Notes on [formal
parameter](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenformal_parameter_glosry.htm "Glossary Entry")
versus [actual
parameters](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenactual_parameter_glosry.htm "Glossary Entry"):
> - You define method parameters by specifying a name with a type which
can be a
[generic](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abengeneric_data_type_glosry.htm "Glossary Entry")
or
[complete](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencomplete_data_type_glosry.htm "Glossary Entry")
type. Examples:
> - `fp` is the formal parameter that has a complete type: `... meth IMPORTING fp TYPE string ...`
> - `gen` is the formal parameter that has a generic type: `... meth IMPORTING gen TYPE any ...`
> - Find more information about generic types also in the [Data Types and Data Objects](16_Data_Types_and_Objects.md#generic-types) cheat sheet.
> - This formal parameter includes the specification of how the
value passing should happen. Parameters can be [passed by
reference](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenpass_by_reference_glosry.htm "Glossary Entry")
(`... REFERENCE(param) ...`; note that just specifying the
parameter name `... param ...` - as a shorter syntax -
means passing by reference by default) or [by
value](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenpass_by_value_glosry.htm "Glossary Entry")
(`... VALUE(param) ...`).
> - The actual parameter represents
the data object whose content is passed to or copied from a formal
parameter as an argument when a procedure is called. If
passing by reference is used, a local data object is not created for
the actual parameter. Instead, the procedure is given a
[reference](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenreference_glosry.htm "Glossary Entry")
to the actual parameter during the call and works with the actual
parameter itself. Note that parameters that are input and passed by
reference cannot be modified in the procedure. However, the use of a
reference is beneficial regarding the performance compared to
creating a local data object.
>- Parameters can be defined as optional using the
[`OPTIONAL`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmethods_parameters.htm#!ABAP_ONE_ADD@1@)
addition. In doing so, it is not mandatory to pass an actual
parameter. The
[`DEFAULT`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmethods_parameters.htm#!ABAP_ONE_ADD@1@)
addition also makes the passing of an actual parameter optional.
However, when using this addition, as the name implies, a default
value is set.
<p align="right"><a href="#top">⬆️ back to top</a></p>
#### Formal and Actual Parameters
- [Formal parameter](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenformal_parameter_glosry.htm "Glossary Entry")
versus [actual parameters](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenactual_parameter_glosry.htm "Glossary Entry"):
- [Formal parameters](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenformal_parameter_glosry.htm "Glossary Entry"): You define method parameters by specifying a name with a type which can be a [generic](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abengeneric_data_type_glosry.htm "Glossary Entry") or [complete](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencomplete_data_type_glosry.htm "Glossary Entry")
type.
- Examples:
- `fp` is the formal parameter that has a complete type: `... meth IMPORTING fp TYPE string ...`
- `gen` is the formal parameter that has a generic type: `... meth IMPORTING gen TYPE any ...`
- Find more information about generic types also in the [Data Types and Data Objects](16_Data_Types_and_Objects.md#generic-types) cheat sheet.
- This formal parameter includes the specification of how the value passing should happen. Parameters can be passed by ...
- [reference](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenpass_by_reference_glosry.htm "Glossary Entry"): `... REFERENCE(param) ...`; note that just specifying the parameter name `... param ...` - as a shorter syntax - means passing by reference by default)
- [value](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenpass_by_value_glosry.htm "Glossary Entry"): `... VALUE(param) ...`
- The [actual parameters](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenactual_parameter_glosry.htm "Glossary Entry") represents the data object whose content is passed to or copied from a formal parameter as an argument when a procedure is called.
- If passing by reference is used, a local data object is not created for the actual parameter. Instead, the procedure is given a [reference](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenreference_glosry.htm "Glossary Entry") to the actual parameter during the call and works with the actual parameter itself.
- Note that parameters that are input and passed by reference cannot be modified in the procedure. However, the use of a reference is beneficial regarding the performance compared to creating a local data object.
<p align="right"><a href="#top">⬆️ back to top</a></p>
#### Defingin Parameters as Optional
- Parameters can be defined as optional using the `OPTIONAL` and `DEFAULT` additions:
- [`OPTIONAL`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmethods_parameters.htm#!ABAP_ONE_ADD@1@): It is then not mandatory to pass an actual
parameter.
- [`DEFAULT`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmethods_parameters.htm#!ABAP_ONE_ADD@1@): Also makes the passing of an actual parameter optional. However, when using this addition, as the name implies, a default value is set.
- In the method implementations you may want to check whether an actual parameter was passed. You can use predicate expressions using `IS SUPPLIED`. See the example further down.
<p align="right"><a href="#top">⬆️ back to top</a></p>
@@ -711,6 +704,9 @@ ref1 = NEW #( ). "Type derived from already declared ref1
DATA(ref2) = NEW some_class( ). "Reference variable declared inline, explicit type
"(class) specification
"The assumption is that this class has no mandatory importing parameters for the
"instance constructor. If a class has, actual parameters must be provided.
DATA(ref_mand_param) = NEW another_class( ip1 = ... ip2 = ... ).
"Older syntax
"CREATE OBJECT ref3. "Type derived from already declared ref3
@@ -724,11 +720,9 @@ Some examples for working with reference variables:
**Assigning Reference Variables**
To assign or copy
reference variables, use the [assignment
To assign or copy reference variables, use the [assignment
operator](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenassignment_operator_glosry.htm "Glossary Entry")
`=`. In the example below, both object reference variables have the same
type.
`=`. In the example below, both object reference variables have the same type. Note the concepts of polymorphism, upcasts and downcasts when assigning reference variables covered further down.
``` abap
DATA: ref1 TYPE REF TO some_class,
@@ -1677,7 +1671,7 @@ ENDCLASS.
The table below includes selected syntax related to inheritance in class and method declarations.
> **💡 Note**<br>
> - Some of the syntax options have already been mentioned previously.
> - Some of the syntax options have already been mentioned previously. This is to summarize.
> - Here, the emphasis is on global classes.
> - The snippets provided do not represent all possible syntax combinations. For the complete picture, refer to the ABAP Keyword Documentation. Additional syntax options are available in the context of friendship (`GLOBAL FRIENDS/FRIENDS`), testing (`FOR TESTING`), [RAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenarap_glosry.htm) (`FOR BEHAVIOR OF`; to declare [ABAP behavior pools](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenbehavior_pool_glosry.htm)), and more.
> - The order of the additions can vary.

View File

@@ -9,6 +9,7 @@
- [RAP Handler Classes and Methods](#rap-handler-classes-and-methods)
- [RAP Saver Class and Saver Methods](#rap-saver-class-and-saver-methods)
- [BDEF Derived Types](#bdef-derived-types)
- [BDEF Derived Type Syntax and Declaring Data Types and Data Objects](#bdef-derived-type-syntax-and-declaring-data-types-and-data-objects)
- [Components of BDEF Derived Types](#components-of-bdef-derived-types)
- [Constants for BDEF Derived Type Components](#constants-for-bdef-derived-type-components)
- [Secondary Table Keys of BDEF Derived Types](#secondary-table-keys-of-bdef-derived-types)
@@ -674,100 +675,193 @@ framework](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?
from CDS entities and their behavior definition in the BDEF. With these
special types, a type-safe access to RAP BOs is guaranteed.
You can create internal tables (using [`TYPE TABLE
FOR`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abaptype_table_for.htm)),
structures (using [`TYPE STRUCTURE
FOR`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abaptype_structure_for.htm))
and data types with BDEF derived types. For all operations and behavior
characteristics defined in the BDEF, types can be derived.
The syntax uses - similar to the method definitions mentioned before -
the addition `FOR` followed by the operation and the name of an
entity (and, if need be, the concrete name, e. g. in case of an action
defined in the BDEF).
Each BDEF derived type can be categorized as
[input](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_input_der_type_glosry.htm "Glossary Entry")
or [output derived
type](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_output_der_type_glosry.htm "Glossary Entry")
according to its use as importing or exporting parameters in methods of
RAP BO providers. In most cases, structures of type `TYPE STRUCTURE
FOR` can be considered as serving as [work
area](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenwork_area_glosry.htm "Glossary Entry")
and line type of the internal tables. However, there are also structured
derived types that do serve as types for handler method parameters.
The response parameters `mapped`, `failed` and
`reported` have dedicated derived types: [`TYPE RESPONSE
FOR`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abaptype_response_for.htm).
They are deep structures containing the information for the individual
entities of the RAP BO. The components of these structures are internal
tables of appropriate types with `TYPE TABLE FOR`.
Examples of BDEF derived types:
``` abap
"Data objects with input derived types (entity = name of a root entity)
"For an EML create operation
DATA create_tab TYPE TABLE FOR CREATE entity.
"For an update operation
DATA update_tab TYPE TABLE FOR UPDATE entity.
"Type for create-by-association operations specifying the name of the entity
"and the association
DATA cba_tab TYPE TABLE FOR CREATE entity\_child.
"For an action execution; the name of the action is preceded by a tilde
DATA action_imp TYPE TABLE FOR ACTION IMPORT entity~action1.
"Data objects with output derived types
"For a read operation
DATA read_tab TYPE TABLE FOR READ RESULT entity.
"For an action defined with a result
DATA action_res TYPE TABLE FOR ACTION RESULT entity~action2.
"Examples for structures and types
DATA create_wa TYPE STRUCTURE FOR CREATE entity.
"For permission retrieval
DATA perm_req TYPE STRUCTURE FOR PERMISSIONS REQUEST entity.
"For retrieving global features
DATA feat_req TYPE STRUCTURE FOR GLOBAL FEATURES RESULT entity.
"Type declaration using a BDEF derived type
TYPES der_typ TYPE TABLE FOR DELETE entity.
"Response parameters
DATA map TYPE RESPONSE FOR MAPPED entity.
DATA fail TYPE RESPONSE FOR FAILED entity.
DATA resp TYPE RESPONSE FOR REPORTED entity.
<p align="right"><a href="#top">⬆️ back to top</a></p>
### BDEF Derived Type Syntax and Declaring Data Types and Data Objects
"Typing method parameters with BDEF derived types by referencing an existing type
CLASS zcl_some_class DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
- For all operations and behavior characteristics defined in the BDEF, you can derive types. For example, if you enable create operations (using the `create` specification in the BDEF), you can create respective BDEF derived types. If you do not enable delete operations, you cannot create respective types.
- The syntax, similar to method definitions mentioned earlier, uses the addition `FOR` followed by further RAP-related additions (such as `CREATE` for create operations).
- These additions include the name of an entity and, if necessary, a specific name (e.g., the action name for a BDEF derived type related to an action).
- The following syntax options are available in the context of BDEF derived types:
PUBLIC SECTION.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES derived_type TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m.
METHODS some_meth IMPORTING itab TYPE derived_type.
ENDCLASS.
...
| Syntax | Notes |
|---|---|
| [`TYPE TABLE FOR`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abaptype_table_for.htm) | For creating internal tables with BDEF derived types. Most RAP handler method parameters use tabular BDEF derived types. |
| [`TYPE STRUCTURE FOR`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abaptype_structure_for.htm) | In many cases, structures of type `TYPE STRUCTURE FOR` serve as both the [work area](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenwork_area_glosry.htm "Glossary Entry") and the line type of the internal tables. There are also structured BDEF derived types that function as types for RAP handler method parameters. |
| [`TYPE RESPONSE FOR`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abaptype_response_for.htm) | These types refer to the RAP response parameters `mapped`, `failed`, and `reported`. They are deep structures containing information for individual RAP BO entities. The components of these structures are internal tables of appropriate types with `TYPE TABLE FOR`. |
| [`TYPE REQUEST FOR`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abaptype_request_for.htm) | The types `TYPE REQUEST FOR CHANGE` and `TYPE REQUEST FOR DELETE` are relevant for importing parameters of the save_modified RAP saver method in the context of RAP additional and unmanaged save. These BDEF derived types are deep structures containing internal tables with RAP BO instance keys and/or data for create, update, or delete operations. |
- Find an overview of available BDEF derived types [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrpm_derived_types.htm).
- You can use `TYPES` and `DATA` statements to declare data types and objects with BDEF derived types.
- Both long and short forms are available to declare data types and objects. Example:
- Create an internal table typed with a BDEF derived type for create operations in ADT: `DATA d1 TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m.`
- Position the cursor on `d1` and press F2 to get type information. The long form shows the root entity plus the concrete entity (which is the root entity itself, an alias name is specified for the root entity in the example): `d1 type table for create zdemo_abap_rap_ro_m\\root.`
- The following specification options are available:
- Long form: Specifying the name of the RAP BO root entity followed by `\\` and an entity of the composition tree.
- If an alias is defined for the entity, you must specify it; otherwise, you can specify the entity name.
- If no alias name was specified for the example entity, the long form would be: `DATA d2 TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m\\zdemo_abap_rap_ro_m.`
- Short form: For convenience, you can specify RAP BO entities such as the RAP BO root entity or other CDS entities of a CDS composition tree. Examples: `DATA d1 TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m.` (root entity), `DATA d3 TYPE TABLE FOR UPDATE zdemo_abap_rap_ch_m.` (child entity). Note that most example codes in the cheat sheet and in the executable example use the short form.
- Specifying associations defined in a BDEF preceded by `\`: For example, `DATA d4 TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m\_child.`. The long form with `\\` followed by an entity name, `\`, and an association is also possible.
```
> **💡 Note**<br>
> Certain types derived from BDEF can only be specified and used within implementation classes, not beyond. These types include the following: `FOR CHANGE`, `FOR DETERMINATION`, `FOR VALIDATION`, `FOR ... FEATURES`, `FOR ... AUTHORIZATION`.
BDEF derived type examples:
> **💡 Note**<br>
> The demo BDEF `zdemo_abap_rap_ro_m` ...
> - specifies the alias name `root` for the RAP BO root entity `zdemo_abap_rap_ro_m`.
> - specifies the association `_child`.
> - includes the child entity `zdemo_abap_rap_ch_m`, for which an alias name `child` is specified and which specifies the association `_parent`.
```abap
"---------------------------------------------------------------------
"------- BDEF derived types demonstrating long and short forms -------
"---------------------------------------------------------------------
"Short forms
"Specifying the RAP BO root entity
TYPES t1 TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m.
DATA d1 TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m.
"Specifying child entity
TYPES t2 TYPE TABLE FOR UPDATE zdemo_abap_rap_ch_m.
DATA d2 TYPE TABLE FOR UPDATE zdemo_abap_rap_ch_m.
"Long form: Specifying the name of the RAP BO root entity, followed
"by \\ and an entity of the composition tree
"Since an alias name is specified for the example entities,it must
"be specified after \\. Otherwise, the entity name can be specified.
"t3/d3 are the same as t1/d1.
TYPES t3 TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m\\root.
DATA d3 TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m\\root.
"In this example, t4/d4 are the same as t2/d2.
TYPES t4 TYPE TABLE FOR UPDATE zdemo_abap_rap_ro_m\\child.
DATA d4 TYPE TABLE FOR UPDATE zdemo_abap_rap_ro_m\\child.
"Specifying associations that are declared in the BDEF preceded by \
"with both short and long forms
"In this example, t5/d5 are the same as t6/d6.
TYPES t5 TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m\_child.
DATA d5 TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m\_child.
TYPES t6 TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m\\root\_child.
DATA d6 TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m\\root\_child.
"In this example, t7/d7 are the same as t8/d8.
TYPES t7 TYPE TABLE FOR READ IMPORT zdemo_abap_rap_ro_m\\child\_parent.
DATA d7 TYPE TABLE FOR READ IMPORT zdemo_abap_rap_ro_m\\child\_parent.
TYPES t8 TYPE TABLE FOR READ IMPORT zdemo_abap_rap_ch_m\_parent.
DATA d8 TYPE TABLE FOR READ IMPORT zdemo_abap_rap_ch_m\_parent.
"---------------------------------------------------------------------
"---------------- Miscellaneous BDEF derived types -------------------
"---------------------------------------------------------------------
"The examples show a selection of possible types. The types mostly use
"the short form.
"-------------------------- Table types ------------------------------
"Create
DATA create_tab TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m.
"Update
DATA update_tab TYPE TABLE FOR UPDATE zdemo_abap_rap_ro_m.
"Create-by-association operation specifying the name of the entity
"and the association
DATA cba_tab TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m\_child.
"Action; the name of the action is preceded by a tilde
DATA action_import TYPE TABLE FOR ACTION IMPORT zdemo_abap_rap_ro_m~multiply_by_2.
"The example action does not specify a result parameter, therefore the following
"type is not available.
"DATA action_result TYPE TABLE FOR ACTION RESULT zdemo_abap_rap_ro_m~multiply_by_2.
"Read
DATA read_import TYPE TABLE FOR READ IMPORT zdemo_abap_rap_ro_m.
DATA read_result TYPE TABLE FOR READ RESULT zdemo_abap_rap_ro_m.
"The previous examples use the RAP BO root entity. The following ones
"use a child entity specified in the example BDEF.
"Update
DATA update_tab_ch TYPE TABLE FOR UPDATE zdemo_abap_rap_ch_m.
"Which corresponds to the long form sepcifying the RAP BO root entity
"name and the (alias) name of the child entity followed by \\
DATA update_tab_ch_2 TYPE TABLE FOR UPDATE zdemo_abap_rap_ro_m\\child.
DATA delete_tab_ch TYPE TABLE FOR DELETE zdemo_abap_rap_ch_m.
"Read-by-association
DATA rba_import_child_to_parent TYPE TABLE FOR READ IMPORT zdemo_abap_rap_ch_m\_parent.
DATA rba_import_child_to_parent_2 TYPE TABLE FOR READ IMPORT zdemo_abap_rap_ro_m\\child\_parent.
DATA rba_result_child_to_parent TYPE TABLE FOR READ RESULT zdemo_abap_rap_ch_m\_parent.
DATA rba_result_child_to_parent_2 TYPE TABLE FOR READ IMPORT zdemo_abap_rap_ro_m\\child\_parent.
"-------------------------- Structured types ------------------------------
DATA create_wa TYPE STRUCTURE FOR CREATE zdemo_abap_rap_ro_m.
DATA update_wa TYPE STRUCTURE FOR UPDATE zdemo_abap_rap_ro_m.
TYPES delete_wa TYPE STRUCTURE FOR DELETE zdemo_abap_rap_ro_m.
DATA update_child_wa TYPE STRUCTURE FOR UPDATE zdemo_abap_rap_ch_m.
TYPES delete_child_wa TYPE STRUCTURE FOR DELETE zdemo_abap_rap_ch_m.
"Retrieving permissions
DATA perm_req TYPE STRUCTURE FOR PERMISSIONS REQUEST zdemo_abap_rap_ro_m.
"Retrieving global features
"... FOR ... FEATURES ... can only be used within implementation classes
"DATA feat_req TYPE STRUCTURE FOR GLOBAL FEATURES RESULT zdemo_abap_rap_ro_m.
"The same applies to validations and determinations
"DATA validate TYPE TABLE FOR VALIDATION zdemo_abap_rap_ro_m~val.
"DATA determine TYPE TABLE FOR DETERMINATION zdemo_abap_rap_ro_m~det_add_text.
"---------------------------------------------------------------------
"---- BDEF derived types relating to RAP response parameters ---------
"---------------------------------------------------------------------
"Response parameters
"Note: The addition EARLY or no addition is relevant in the context of the
"RAP interaction phase. The addition LATE is relevant in the context of the
"save phase.
DATA map TYPE RESPONSE FOR MAPPED zdemo_abap_rap_ro_m.
DATA fail TYPE RESPONSE FOR FAILED zdemo_abap_rap_ro_m.
DATA resp TYPE RESPONSE FOR REPORTED zdemo_abap_rap_ro_m.
"Same as resp
DATA resp_2 TYPE RESPONSE FOR REPORTED EARLY zdemo_abap_rap_ro_m.
"Relevant for the late RAP save phase
DATA map_late TYPE RESPONSE FOR MAPPED LATE zdemo_abap_rap_ro_m.
DATA fail_late TYPE RESPONSE FOR FAILED LATE zdemo_abap_rap_ro_m.
DATA resp_late TYPE RESPONSE FOR REPORTED LATE zdemo_abap_rap_ro_m.
"You can check the F2 information in ADT for the types. The types above
"are deep structures, containing tables typed with TYPE TABLE FOR MAPPED
"and so on.
DATA map_tab_early_1 TYPE TABLE FOR MAPPED zdemo_abap_rap_ro_m.
DATA map_tab_early_2 TYPE TABLE FOR MAPPED EARLY zdemo_abap_rap_ro_m.
DATA map_tab_late TYPE TABLE FOR MAPPED LATE zdemo_abap_rap_ro_m.
"---------------------------------------------------------------------
"---- BDEF derived types relating to the save phase in RAP -----------
"---- additional and unmanaged save scenarios ------------------------
"---------------------------------------------------------------------
"REQUEST FOR ... can only be used within implementation classes
"For create and update operations
"DATA req_change TYPE REQUEST FOR CHANGE zdemo_abap_rap_ro_m_as.
"For delete operations
"DATA req_delete TYPE REQUEST FOR DELETE zdemo_abap_rap_ro_m_as.
"---------------------------------------------------------------------
"---- Excursion: Typing method parameters with BDEF derived types ----
"---------------------------------------------------------------------
...
"TYPES tab_type TYPE TABLE FOR CREATE zdemo_abap_rap_ro_m.
"METHODS some_meth IMPORTING itab TYPE tab_type.
...
```
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Components of BDEF Derived Types

View File

@@ -6,7 +6,6 @@
- [Introduction](#introduction)
- [Data Types in DDIC](#data-types-in-ddic)
- [Built-in ABAP Dictionary Types](#built-in-abap-dictionary-types)
- [Typed Literals](#typed-literals)
- [DDIC Data Types](#ddic-data-types)
- [DDIC Data Elements](#ddic-data-elements)
- [DDIC Domains](#ddic-domains)
@@ -93,48 +92,8 @@ DDIC supports the following data types:
> **💡 Note**<br>
> There are restrictions when using strings in ABAP CDS and ABAP SQL. For more information, see [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenddic_character_byte_types.htm).
<p align="right"><a href="#top">⬆️ back to top</a></p>
#### Typed Literals
- Built-in dictionary types cannot be used directly in ABAP, e.g. for typing local data objects.
- However, the types can be used in ABAP SQL, and also ABAP CDS, in the context of [typed literals](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentyped_literal_glosry.htm). Note that some special types cannot be used in this context.
- Advantages of typed literals over untyped literals:
- Allow type-safe use of literals
- Eliminate the need for (implicit type) conversions and casts, which can lead to surprising or erroneous results. Also consider the conversion costs in terms of performance (typed literals are passed to the database and evaluated there without ABAP-specific type conversions).
- For better readability (you can immediately see what type is being used)
- More information:
- [Typed literals in ABAP SQL](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_sql_typed_literals.htm)
- [Typed literals in ABAP CDS](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_typed_literal_v2.htm)
- They can also be used in casts in ABAP [SQL](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensql_cast.htm) and [CDS](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_cast_expression_v2.htm).
```abap
"Miscellaneous typed literals in an ABAP SQL statement
"Note that typed literals can be specified in read
"positions where host variables are possible.
DATA(tmstamp) = CONV timestamp( '20240808112517' ).
DATA(some_string) = `Some string`.
SELECT SINGLE
FROM zdemo_abap_fli
FIELDS
carrid,
@some_string AS host_var,
char`X` AS flag,
int8`32984723948723` AS int8,
raw`11` AS raw,
numc`1234` AS numc,
utclong`2024-01-01T10:01:02,2` AS utc,
tims`101507` AS tims,
curr`173.95` AS curr,
"Multiple cast expressions splitting a time stamp into date and time parts
CAST( CAST( div( @tmstamp, 1000000 ) AS CHAR ) AS DATS ) AS date,
CAST( substring( CAST( @tmstamp AS CHAR ), 9, 6 ) AS TIMS ) AS time,
"Untyped literal
'ABAP' AS txt
WHERE fldate = datn`20240102`
INTO @DATA(misc_typed_literals).
```
> - There are restrictions when using strings in ABAP CDS and ABAP SQL. For more information, see [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenddic_character_byte_types.htm).
> - Built-in dictionary types cannot be used directly in ABAP, e.g. for typing local data objects. However, the types can be used in ABAP SQL, and also ABAP CDS, in the context of [typed literals](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentyped_literal_glosry.htm). Find more information in the [ABAP SQL](03_ABAP_SQL.md#typed-literals) cheat sheet.
<p align="right"><a href="#top">⬆️ back to top</a></p>