This commit is contained in:
danrega
2024-08-30 13:28:14 +02:00
parent 82a3b64986
commit 6c9c26d542
6 changed files with 530 additions and 84 deletions

View File

@@ -11,16 +11,16 @@
- [Copying Internal Tables](#copying-internal-tables)
- [Using INSERT and APPEND Statements to Populate Internal Tables](#using-insert-and-append-statements-to-populate-internal-tables)
- [Creating and Populating Internal Tables Using Constructor Expressions](#creating-and-populating-internal-tables-using-constructor-expressions)
- [VALUE operator](#value-operator)
- [CORRESPONDING Operator](#corresponding-operator)
- [VALUE Operator](#value-operator)
- [CORRESPONDING Operator and MOVE-CORRESPONDING Statements](#corresponding-operator-and-move-corresponding-statements)
- [FILTER Operator](#filter-operator)
- [NEW Operator](#new-operator)
- [Example: Exploring Populating Internal Tables](#example-exploring-populating-internal-tables)
- [Reading Single Lines from Internal Tables](#reading-single-lines-from-internal-tables)
- [Determining the Target Area when Reading Single Lines in READ TABLE Statements](#determining-the-target-area-when-reading-single-lines-in-read-table-statements)
- [Reading a Single Line by Index](#reading-a-single-line-by-index)
- [Reading a Single Line Using Table Keys](#reading-a-single-line-using-table-keys)
- [Reading a Single Line Using a Free Key](#reading-a-single-line-using-a-free-key)
- [Reading Single Lines by Index](#reading-single-lines-by-index)
- [Reading Single Lines Using Table Keys](#reading-single-lines-using-table-keys)
- [Reading Single Lines Using a Free Key](#reading-single-lines-using-a-free-key)
- [Examples of Addressing Individual Components of Read Lines](#examples-of-addressing-individual-components-of-read-lines)
- [Excursions with READ TABLE Statements](#excursions-with-read-table-statements)
- [System Field Setting in READ TABLE Statements](#system-field-setting-in-read-table-statements)
@@ -456,6 +456,8 @@ FINAL(itab4) = itab.
> - An assignment can trigger an uncatchable exception if, for example, the target table is assigned a duplicate of a unique primary table key or secondary table.
> - More information: [Conversion Rules for Internal Tables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenconversion_itab.htm)
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Using INSERT and APPEND Statements to Populate Internal Tables
You can use the ABAP keywords
@@ -501,7 +503,17 @@ to add lines to internal tables.
</details>
<br>
**Adding a line to an internal table**. The example shows both a structure that is created using the `VALUE` operator as well as an existing structure that is added.
<table>
<tr>
<td> Subject </td> <td> Details/Code Snippet </td>
</tr>
<tr>
<td> Adding a line to an internal table </td>
<td>
The example shows both a structure that is created using the `VALUE` operator as well as an existing structure that is added.
<br>
``` abap
APPEND VALUE #( comp1 = a comp2 = b ... ) TO itab.
@@ -511,7 +523,15 @@ INSERT VALUE #( comp1 = a comp2 = b ... ) INTO TABLE itab.
INSERT struc INTO TABLE itab.
```
**Adding an initial line** to an internal table without providing any field values.
</td>
</tr>
<tr>
<td> Adding an initial line </td>
<td>
... to an internal table without providing any field values.
<br>
``` abap
APPEND INITIAL LINE TO itab.
@@ -519,7 +539,12 @@ APPEND INITIAL LINE TO itab.
INSERT INITIAL LINE INTO TABLE itab.
```
**Adding a line and assigning the added line to a field symbol or data reference variable**.
</td>
</tr>
<tr>
<td> Adding a line and assigning the added line to a field symbol or data reference variable </td>
<td>
```abap
"When inserting single lines, you can specify the optional additions
"ASSIGNING and REFERENCE INTO. If the insertion is successful, the
@@ -533,7 +558,11 @@ INSERT INITIAL LINE INTO TABLE itab REFERENCE INTO DATA(dref).
"of the (initial) line and assign values, e.g. <fs>-comp = ... or dref->comp = ....
```
**Adding all lines** from another internal table.
</td>
</tr>
<tr>
<td> Adding all lines from another internal table </td>
<td>
``` abap
APPEND LINES OF itab2 TO itab.
@@ -541,33 +570,53 @@ APPEND LINES OF itab2 TO itab.
INSERT LINES OF itab2 INTO TABLE itab.
```
**Adding multiple lines from another internal table with a specified index range**.
</td>
</tr>
<tr>
<td> Adding multiple lines from another internal table with a specified index range </td>
<td>
- Both `FROM` and `TO` are not mandatory in one statement. it is possible to use only one of them.
- If you use only ...
- `FROM`, all lines up to the last table entry are respected.
- `TO`, all lines starting with the first table entry are respected.
<br>
``` abap
"i1/i2 represent integer values
APPEND LINES OF itab2 FROM 3 TO 5 TO itab.
APPEND LINES OF itab2 FROM i1 TO i2 TO itab.
APPEND LINES OF itab2 FROM 3 TO itab.
APPEND LINES OF itab2 FROM i1 TO itab.
APPEND LINES OF itab2 TO 7 TO itab.
APPEND LINES OF itab2 TO i2 TO itab.
INSERT LINES OF itab2 FROM i1 TO i2 INTO TABLE itab.
INSERT LINES OF itab2 FROM 5 TO 9 INTO TABLE itab.
```
**Inserting one line or multiple lines from another internal table at a specific position**.
</td>
</tr>
<tr>
<td> Inserting one line or multiple lines from another internal table at a specific position </td>
<td>
`FROM` and `TO` can be used here, too.
<br>
``` abap
INSERT struc INTO itab2 INDEX i.
INSERT LINES OF itab2 INTO itab INDEX i.
```
</td>
</tr>
</table>
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Creating and Populating Internal Tables Using Constructor Expressions
@@ -576,29 +625,46 @@ The constructor expressions can be specified in/with various positions/statement
> **💡 Note**<br>
> The following sections cover a selection. There are more constructor expressions used in the context of internal tables (e.g. for creating internal tables). Find more details in the [Constructor Expressions](05_Constructor_Expressions.md) ABAP cheat sheet.
#### VALUE operator
#### VALUE Operator
As mentioned above, table lines that are constructed inline as
arguments to the `VALUE` operator, for example, can be added to
internal tables. In the following cases, internal tables are populated
using constructor expressions in the context of
[assignments](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenassignment_glosry.htm "Glossary Entry").
<table>
<tr>
<td> Subject </td> <td> Details/Code Snippet </td>
</tr>
<tr>
<td> Populating an existing internal table by assigning an
internal table that is constructed inline </td>
<td>
In the example below, the internal table is populated by assigning an
internal table that is constructed inline with the `VALUE`
operator. The inline constructed table has two lines. `line`
represents an existing structure with a compatible line type. The
other line is constructed inline.
> **💡 Note**<br>
> The extra pair of parentheses represents a table line. The `#` character indicates that the line type can be derived from the context. The assignment deletes the existing content of the internal table on the left side.
> - The extra pair of parentheses represents a table line. The `#` character indicates that the line type can be derived from the context. The assignment deletes the existing content of the internal table on the left side.
> - The existing content of the internal table is deleted, and the new content, which is created in place, is added.
<br>
``` abap
itab = VALUE #( ( line )
                ( comp1 = a comp2 = b ...  ) ).
```
**Creating an internal table by inline declaration** and adding lines with a constructor expression.
</td>
</tr>
<tr>
<td> Creating an internal table by inline declaration and adding lines with a constructor expression </td>
<td>
``` abap
"Internal table type
TYPES it_type LIKE itab.
@@ -620,75 +686,156 @@ DATA(str_tab_b) = VALUE string_table( ).
DATA str_tab_c TYPE string_table.
```
When you use the above assignments (`itab = ...`), the internal table is initialized and the existing content is deleted. To add new lines **without deleting existing content**, use the [`BASE`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenvalue_constructor_params_itab.htm) addition.
</td>
</tr>
<tr>
<td> Adding new lines without deleting existing content </td>
<td>
When you use the above assignments to an existing internal table (`itab = ...`), the internal table is initialized and the existing content is deleted. To add new lines without deleting existing content, use the [`BASE`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenvalue_constructor_params_itab.htm) addition.
<br>
``` abap
itab = VALUE #( BASE itab ( comp1 = a comp2 = b ... )
                          ( comp1 = c comp2 = d ... ) ).
```
**Adding lines of other tables** using the `LINES OF` addition to the `VALUE` operator.
> **💡 Note**<br>
> Without the `BASE` addition, the existing content is deleted. It is assumed that the line type of the source table is compatible with that of the target table.
</td>
</tr>
<tr>
<td> Adding lines of other tables </td>
<td>
... using the `LINES OF` addition to the `VALUE` operator.
Without the `BASE` addition, the existing content is deleted. It is assumed that the line type of the source table is compatible with that of the target table. You have multiple syntax options following the `LINES OF` addition, e.g. you can further determine and restrict the lines to be added using `FROM` and `TO`.
<br>
``` abap
itab = VALUE #( ( comp1 = a comp2 = b ...)
                ( comp1 = a comp2 = b ...)
"All lines
                ( LINES OF itab2 )
"More syntax options
( LINES OF itab3 FROM 2 TO 5 )
( LINES OF itab4 FROM 3 )
( LINES OF itab5 TO 7 )
( LINES OF itab6 STEP 2 )
( LINES OF itab7 USING KEY primary_key FROM 3 TO 6 )
                ... ).
```
#### CORRESPONDING Operator
</td>
</tr>
**Copying the content of another internal table** using the
</table>
<p align="right"><a href="#top">⬆️ back to top</a></p>
#### CORRESPONDING Operator and MOVE-CORRESPONDING Statements
<table>
<tr>
<td> Subject </td> <td> Details/Code Snippet </td>
</tr>
<tr>
<td> Copying the content of another internal table </td>
<td>
... using the
[`CORRESPONDING`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenconstructor_expr_corresponding.htm) operator.
- Note that the existing content is deleted.
- As an alternative to the `CORRESPONDING` operator, you can use [`MOVE-CORRESPONDING`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmove-corresponding.htm) statements.
- The example assumes that the line types of the source and target table are not compatible. However, if the line types are compatible, the syntax will also work.
- Several additions are possible. They can also be combined. Check the ABAP Keyword Documentation.
<br>
``` abap
itab = CORRESPONDING #( itab3 ).
MOVE-CORRESPONDING itab3 TO itab.
```
**Copying content and retaining existing content** using the `CORRESPONDING` operator.
</td>
</tr>
<tr>
<td> Copying content and retaining existing content </td>
<td>
... using the `CORRESPONDING` operator.
The `KEEPING TARGET LINES` addition of the `MOVE-CORRESPONDING` statement preserves the table content.
<br>
``` abap
itab = CORRESPONDING #( BASE ( itab ) itab3 ).
MOVE-CORRESPONDING itab3 TO itab KEEPING TARGET LINES.
```
**Assigning components using mapping relationships**
</td>
</tr>
<tr>
<td> Assigning components using mapping relationships </td>
<td>
- You can use the `MAPPING` addition of the `CORRESPONDING` operator to specify components of a source table that are assigned to the components of a target table in mapping relationships.
- For elementary components, the assignment is made according to the associated assignment rules.
<br>
``` abap
itab = CORRESPONDING #( itab3 MAPPING a = c b = d ).
```
**Excluding components from the assignment** using the `EXCEPT` addition to the `CORRESPONDING` operator.
</td>
</tr>
<tr>
<td> Excluding components from the assignment </td>
<td>
... using the `EXCEPT` addition to the `CORRESPONDING` operator.
- This is particularly useful if there are identically named components in the source and target tables that are not compatible or convertible. You can avoid syntax errors or runtime errors.
- Instead of a component list, `EXCEPT` can also be followed by `*` to exclude all components that are not mentioned in a previous mapping of components.
- If `EXCEPT *` is used without the `MAPPING` addition, all components remain initial.
<br>
``` abap
itab = CORRESPONDING #( itab3 EXCEPT e ).
itab = CORRESPONDING #( itab3 EXCEPT * ).
```
**Preventing runtime errors when duplicate lines are assigned** to the target table that is defined to accept only unique keys using the `DISCARDING DUPLICATES` addition of the `CORRESPONDING` operator.
</td>
</tr>
<tr>
<td> Preventing runtime errors when duplicate lines are assigned </td>
<td>
... to the target table that is defined to accept only unique keys using the `DISCARDING DUPLICATES` addition of the `CORRESPONDING` operator.
- In this case, the duplicate line is ignored in the source table.
- The addition can also be specified with `MAPPING ...`.
<br>
``` abap
itab = CORRESPONDING #( itab2 DISCARDING DUPLICATES ).
```
**Copying data from deep internal tables**.
</td>
</tr>
<tr>
<td> Copying data from deep internal tables </td>
<td>
- The `BASE` addition does not delete the existing content.
- See also the alternative `MOVE-CORRESPONDING` statements.
<br>
``` abap
itab_nested2 = CORRESPONDING #( DEEP itab_nested1 ).
@@ -699,6 +846,16 @@ MOVE-CORRESPONDING itab_nested1 TO itab_nested2 EXPANDING NESTED TABLES.
MOVE-CORRESPONDING itab_nested1 TO itab_nested2 EXPANDING NESTED TABLES KEEPING TARGET LINES.
```
</td>
</tr>
</table>
> **💡 Note**<br>
> The `CL_ABAP_CORRESPONDING` class can be used for assignments. Find an example in the [Misc ABAP Classes](22_Misc_ABAP_Classes.md) cheat sheet.
<p align="right"><a href="#top">⬆️ back to top</a></p>
#### FILTER Operator
To create an internal table by copying data from another internal table and
@@ -1151,7 +1308,8 @@ The following code snippets include [`READ TABLE`](https://help.sap.com/doc/abap
READ TABLE itab REFERENCE INTO DATA(dref_inl) ...
```
**Which to use then?** Since all syntax options basically provide similar
> **✔️ Hint**<br>
> Which to use then? Since all syntax options basically provide similar
functionality, your use case, the
performance or readability of the code may play a role. For more information, see
the programming guidelines for the [target
@@ -1164,13 +1322,24 @@ the `TRANSPORTING` addition to restrict the fields to be copied).
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Reading a Single Line by Index
### Reading Single Lines by Index
<table>
<tr>
<td> Subject </td> <td> Details/Code Snippet </td>
</tr>
<tr>
<td> Using <code>READ TABLE</code> statements </td>
<td>
The following example shows `READ TABLE` statements to read a single line from an internal table by specifying the index. You can use the addition `USING KEY` to specify a table key and thus explicitly determine the table index to use. If the table has a sorted secondary
key, the addition can be specified and the line to be read is then determined from its secondary table index. If the primary table key is
specified by its name `primary_key`, the table must be an index table, and the behavior is the same as if `USING KEY` was
not specified.
Note that the examples only show reading into a work area. Other targets are possible as shown above.
<br>
``` abap
"Primary table index is used by default
READ TABLE itab INTO wa INDEX i.
@@ -1184,12 +1353,20 @@ READ TABLE itab INTO wa INDEX i USING KEY sec_key.
"Note: You can also use alias names for the keys if specified.
```
Using a [table
expression](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentable_expressions.htm),
</td>
</tr>
<tr>
<td> Using table expressions </td>
<td>
Using [table
expressions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentable_expressions.htm),
the read result is stored in a variable that can be declared inline.
The number in the square brackets represents the index. A line that is
not found results in an runtime error. To avoid an error, you can
use a [`TRY ... CATCH ... ENDTRY.`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abaptry.htm) block.
<br>
``` abap
"In the examples, integer values are specified for the index.
@@ -1210,21 +1387,37 @@ DATA(lv4) = VALUE #( itab[ 4 ] ).
DATA(lv5_ref) = REF #( itab[ 5 ] ).
```
</td>
</tr>
<tr>
<td> Avoiding an exception when using table expressions </td>
<td>
When you read a non-existent line using a table expression, you may not want to throw an exception. You can also embed the table expression
in a constructor expression using the `OPTIONAL` addition. This way, an unsuccessful read will not trigger the
exception. The result returned is a line with initial values.
Alternatively, you can use the `DEFAULT` addition to return a
default line in case of an unsuccessful read operation, which can also be another table expression or constructor expression.
<br>
``` abap
DATA(line1) = VALUE #( itab[ 6 ] OPTIONAL ).
DATA(line2) = VALUE #( itab[ 7 ] DEFAULT itab[ 1 ] ).
```
</td>
</tr>
</table>
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Reading a Single Line Using Table Keys
### Reading Single Lines Using Table Keys
Lines can be read by explicitly specifying the table keys or the alias names, if any.
```abap
@@ -1286,7 +1479,7 @@ READ TABLE it FROM sec_keys USING KEY sk INTO wa.
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Reading a Single Line Using a Free Key
### Reading Single Lines Using a Free Key
The specified components used as keys need not be part of a table key.
``` abap
@@ -2222,6 +2415,35 @@ you can get type information on internal tables and table types at runtime
For more information, see the [Dynamic Programming](06_Dynamic_Programming.md) ABAP cheat sheet.
RTTI example:
```abap
TYPES tab_type TYPE SORTED TABLE OF demo_struc_type
WITH UNIQUE KEY comp1
WITH NON-UNIQUE SORTED KEY sec_key ALIAS sk COMPONENTS comp2 comp3.
DATA itab TYPE tab_type.
DATA(tdo_d) = cl_abap_typedescr=>describe_by_data( itab ).
"DATA(tdo_d) = cl_abap_typedescr=>describe_by_name( 'TAB_TYPE' ).
"Cast to get more specific information
DATA(tdo_itab) = CAST cl_abap_tabledescr( cl_abap_typedescr=>describe_by_data( itab ) ).
"DATA(tdo_itab) = CAST cl_abap_tabledescr( tdo_d ).
DATA(type_category_itab) = tdo_itab->kind.
DATA(relative_name_itab) = tdo_itab->get_relative_name( ).
... "Explore more options by positioning the cursor behind -> and choosing CTRL + Space
DATA(table_kind_itab) = tdo_itab->table_kind.
DATA(table_keys_itab) = tdo_itab->key.
DATA(table_keys_more_details_itab) = tdo_itab->get_keys( ).
DATA(table_has_unique_key_itab) = tdo_itab->has_unique_key.
DATA(table_key_alias_itab) = tdo_itab->get_key_aliases( ).
DATA(line_type_itab) = tdo_itab->get_table_line_type( ).
DATA(table_component_info_itab) = CAST cl_abap_structdescr( tdo_itab->get_table_line_type( ) ).
DATA(table_components_itab) = CAST cl_abap_structdescr( tdo_itab->get_table_line_type( ) )->components.
DATA(table_comps_more_info_itab) = CAST cl_abap_structdescr( tdo_itab->get_table_line_type( ) )->get_components( ).
DATA(applies_to_data_itab) = tdo_itab->applies_to_data( VALUE tab_type( ) ).
```
<p align="right"><a href="#top">⬆️ back to top</a></p>
## Processing Multiple Internal Table Lines Sequentially
@@ -2778,7 +3000,14 @@ SELECT SINGLE comp1, comp2, comp3 FROM @itab2 AS it WHERE comp3 = sstring`ABAP`
especially with tables with standard key.
*Sorting by primary table key*
<table>
<tr>
<td> Subject </td> <td> Details/Code Snippet </td>
</tr>
<tr>
<td> Sorting by primary table key </td>
<td>
``` abap
"Implicit sorting by primary table key and in ascending order by default
SORT itab.
@@ -2801,11 +3030,18 @@ SORT it1.
```
Plus: Suppose there are only elementary numeric components in an internal table with a structured line type. In this case, sorting has no effect because the primary table key is considered empty. This is certainly also true for tables declared with `EMPTY KEY`.
*Sorting by explicitly specifying components*
</td>
</tr>
<tr>
<td> Sorting by explicitly specifying components </td>
<td>
You can sort by any component of the internal table. It is also possible to specify the sort order
(even component-wise). Explicitly specifying the components has the advantage that your code is easier to understand and you can avoid unexpected results if you accidentally use `SORT` without the `BY` addition on empty and standard table keys.
<br>
``` abap
DATA it3 TYPE TABLE OF struc WITH NON-UNIQUE KEY a.
@@ -2824,6 +3060,10 @@ SORT itab BY a b ASCENDING c DESCENDING.
SORT itab BY table_line.
```
</td>
</tr>
</table>
<p align="right"><a href="#top">⬆️ back to top</a></p>
## Modifying Internal Table Content

View File

@@ -777,6 +777,53 @@ you can ...
For more information, see the [Dynamic Programming](06_Dynamic_Programming.md) cheat sheet.
RTTI example:
```abap
TYPES: BEGIN OF demo_struc_type,
comp1 TYPE c LENGTH 3,
comp2 TYPE i,
comp3 TYPE string,
END OF demo_struc_type.
DATA demo_struc TYPE demo_struc_type.
DATA(tdo_c) = cl_abap_typedescr=>describe_by_data( demo_struc ).
"DATA(tdo_c) = cl_abap_typedescr=>describe_by_name( 'DEMO_STRUC_TYPE' ).
"Cast to get more specific information
DATA(tdo_struc) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_data( demo_struc ) ).
"DATA(tdo_struc) = CAST cl_abap_structdescr( tdo_c ).
DATA(type_category_struc) = tdo_struc->kind.
DATA(relative_name_struc) = tdo_struc->get_relative_name( ).
... "Explore more options by positioning the cursor behind -> and choosing CTRL + Space
DATA(type_of_struc) = tdo_struc->struct_kind.
DATA(struc_comps) = tdo_struc->components.
DATA(struc_comps_more_details) = tdo_struc->get_components( ).
DATA(struc_has_include) = tdo_struc->has_include.
DATA(struc_incl_view) = tdo_struc->get_included_view( ).
DATA(applies_to_data_struc) = tdo_struc->applies_to_data( `some string` ).
"Example: "Looping" across a structure
"Demo structure, all components are convertible to type string
TYPES: BEGIN OF ty_struc,
comp1 TYPE c LENGTH 3,
comp2 TYPE string,
comp3 TYPE i,
comp4 TYPE n LENGTH 4,
END OF ty_struc.
DATA(struct) = VALUE ty_struc( comp1 = 'abc' comp2 = `ABAP` comp3 = 123 comp4 = '9876' ).
DATA looped_struc TYPE string.
"In the loop, a string is populated, component by component.
LOOP AT CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_data( struct ) )->components INTO DATA(comp).
looped_struc = |{ looped_struc }{ COND #( WHEN sy-tabix <> 1 THEN ` / ` ) }Name: "{ CONV string( comp-name ) }", Value: "{ struct-(comp-name) }"|.
ENDLOOP.
"Result:
"Name: "COMP1", Value: "abc" / Name: "COMP2", Value: "ABAP" / Name: "COMP3", Value: "123" / Name: "COMP4", Value: "9876"
```
<p align="right"><a href="#top">⬆️ back to top</a></p>

View File

@@ -5,7 +5,7 @@
- [ABAP SQL](#abap-sql)
- [Introduction](#introduction)
- [Excursion: Database Tables and Views](#excursion-database-tables-and-views)
- [Retrieving Data Using SELECT](#retrieving-data-using-select)
- [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)
@@ -13,7 +13,7 @@
- [Miscellaneous Options Regarding the Result](#miscellaneous-options-regarding-the-result)
- [Additional Clauses](#additional-clauses)
- [Selecting Data by Evaluating the Content of Other Tables](#selecting-data-by-evaluating-the-content-of-other-tables)
- [Combining Data of Multiple Tables](#combining-data-of-multiple-tables)
- [Combining Data of Multiple Data Sources](#combining-data-of-multiple-data-sources)
- [Common Table Expressions (CTE)](#common-table-expressions-cte)
- [SQL Conditions](#sql-conditions)
- [SQL Operands](#sql-operands)
@@ -31,13 +31,15 @@
- [String Functions](#string-functions)
- [coalesce Function](#coalesce-function)
- [More Functions](#more-functions)
- [Changing Data in Database Tables](#changing-data-in-database-tables)
- [Create, Update, and Delete Operations](#create-update-and-delete-operations)
- [Using INSERT](#using-insert)
- [Using UPDATE](#using-update)
- [Using MODIFY](#using-modify)
- [Using DELETE](#using-delete)
- [Using Constructor Expressions in ABAP SQL Statements](#using-constructor-expressions-in-abap-sql-statements)
- [Example: Exploring ABAP SQL Statements Changing Data in Database Tables](#example-exploring-abap-sql-statements-changing-data-in-database-tables)
- [Example: Exploring Create, Update, and Delete Operations with ABAP SQL Statements](#example-exploring-create-update-and-delete-operations-with-abap-sql-statements)
- [Excursions](#excursions)
- [ABAP SQL and Client Handling](#abap-sql-and-client-handling)
- [RAP-Specific ABAP SQL Variants](#rap-specific-abap-sql-variants)
- [More Information](#more-information)
- [Executable Example](#executable-example)
@@ -143,7 +145,7 @@ Views](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm
<p align="right"><a href="#top">⬆️ back to top</a></p>
## Retrieving Data Using SELECT
## Read Operations Using SELECT
### Basic Syntax
@@ -786,9 +788,17 @@ SELECT comp1, comp2, comp3
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Combining Data of Multiple Tables
### Combining Data of Multiple Data Sources
**Using an [inner join](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abeninner_join_glosry.htm)**:
<table>
<tr>
<td> Subject </td> <td> Details/Code Snippet </td>
</tr>
<tr>
<td> Using an inner join </td>
<td>
[Inner join](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abeninner_join_glosry.htm):
- Columns of two or more data sources in a result set can be joined.
- Result set:
- Columns of the rows in the result set of the left side with the columns of the rows in the result set of the right side are joined into a single result set.
@@ -796,6 +806,9 @@ SELECT comp1, comp2, comp3
- If there are identical column names in multiple data sources, use the [column
selector](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentable_comp_selector_glosry.htm "Glossary Entry")
`~`.
<br>
``` abap
SELECT a~comp1, a~comp2, b~comp3, c~comp4
FROM dbtab1 AS a
@@ -805,13 +818,22 @@ SELECT a~comp1, a~comp2, b~comp3, c~comp4
INTO ...
```
**Using an [outer join](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenouter_join_glosry.htm)**:
</td>
</tr>
<tr>
<td> Using an outer join </td>
<td>
[Outer join](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenouter_join_glosry.htm):
- Realized by either a [left outer join](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenleft_outer_join_glosry.htm) or
a [right outer join](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenright_outer_join_glosry.htm).
- Result set:
- Same result set as the inner join.
- Difference: For each selected row on the left side as `LEFT OUTER JOIN` or on the right side as `RIGHT OUTER JOIN`, at least one row is created in the result set even if no rows on the other side meet the condition. The columns on the other side that do not meet the condition are filled with [null values](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abennull_value_glosry.htm).
<br>
``` abap
"Example for a left outer join
SELECT a~comp1, a~comp2, b~comp3,
@@ -820,11 +842,17 @@ SELECT a~comp1, a~comp2, b~comp3,
WHERE ...
INTO ...
```
> **💡 Note**<br>
> There are more join variants and syntax options available. See the ABAP Keyword Documentation on [joins](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_join.htm)
for more information.
**Merging the result sets of multiple queries into a single result set** using the [set operator](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_set_operators_glosry.htm) [`UNION`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapunion.htm#!ABAP_VARIANT_1@1@). In this case, the rows of the result set of the query after `UNION` are inserted into the result set of the query in front of `UNION`.
</td>
</tr>
<tr>
<td> Merging the result sets of multiple queries into a single result set </td>
<td>
... using the [set operator](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_set_operators_glosry.htm) [`UNION`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapunion.htm#!ABAP_VARIANT_1@1@). In this case, the rows of the result set of the query after `UNION` are inserted into the result set of the query in front of `UNION`.
<br>
``` abap
SELECT FROM dbtab1
@@ -837,8 +865,16 @@ SELECT FROM dbtab2
INTO ...
```
**Returning distinct rows of a result set (1)** of a query specified before the `INTERSECT` addition that are also available in the result set of the query after the `INTERSECT` addition.
</td>
</tr>
<tr>
<td> Returning distinct rows of a result set (1) </td>
<td>
... of a query specified before the `INTERSECT` addition that are also available in the result set of the query after the `INTERSECT` addition.
<br>
``` abap
"If you have imported the cheat sheet repository and already run an example class to fill
@@ -860,7 +896,16 @@ SELECT carrid, carrname
INTO TABLE @DATA(itab_w_intersect).
```
**Returning distinct rows of a result set (2)** of a query specified before the `EXCEPT` addition that are not available in the result set of the query after the `EXCEPT` addition.
</td>
</tr>
<tr>
<td> Returning distinct rows of a result set (2) </td>
<td>
... of a query specified before the `EXCEPT` addition that are not available in the result set of the query after the `EXCEPT` addition.
<br>
```abap
"If you have imported the cheat sheet repository and already run an example class to fill
@@ -890,8 +935,16 @@ SELECT carrid
INTO TABLE @DATA(itab_w_except).
```
</td>
</tr>
</table>
> **💡 Note**<br>
> There a more syntax options and contexts for `UNION`, `INTERSECT`, and `EXCEPT`. Find more information [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapunion.htm).
> - There are more join variants and syntax options available. See the ABAP Keyword Documentation on [joins](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_join.htm)
for more information.
> - There a more syntax options and contexts for `UNION`, `INTERSECT`, and `EXCEPT`. Find more information [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapunion.htm).
<p align="right"><a href="#top">⬆️ back to top</a></p>
@@ -1933,7 +1986,7 @@ INTO @DATA(special_functions).
<p align="right"><a href="#top">⬆️ back to top</a></p>
## Changing Data in Database Tables
## Create, Update, and Delete Operations
> **💡 Note**<br>
> The following sections include code patterns. To explore various syntax options with an executable example, see section [Example: Exploring ABAP SQL Statements Changing Data in Database Tables](#example-exploring-abap-sql-statements-changing-data-in-database-tables) below.
@@ -2091,6 +2144,8 @@ DELETE dbtab FROM @row.
"Using a host expression
DELETE dbtab FROM @( VALUE #( comp1 = ... ) ).
"Rows are deleted based on data in an internal table
DELETE dbtab FROM TABLE @itab.
"Using a host expression
@@ -2142,18 +2197,18 @@ UPDATE dbtab FROM @( VALUE #( BASE read_line comp2 = ... comp4 = ... ) ).
"The following example assumes that some_itab has a different line type than dbtab.
"I.e. some_itab may have more components that are not available in dbtab. The
"corresponding fields with identical names are used. It is assumed that the components'
"types are compatible and/or convertible.
"types are compatible or convertible.
INSERT dbtab FROM TABLE @( CORRESPONDING #( some_itab ) ).
"This example assumes that field names are not identical. Using the CORRESPONDING operator
"and its additions, you can carry out a mapping and, for example, exclude components. It is
"assumed that the components' types are compatible and/or convertible.
"assumed that the components' types are compatible or convertible.
INSERT dbtab FROM TABLE @( CORRESPONDING #( another_itab MAPPING key_field = key comp1 = compZ EXCEPT comp2 ) ).
```
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Example: Exploring ABAP SQL Statements Changing Data in Database Tables
### Example: Exploring Create, Update, and Delete Operations with ABAP SQL Statements
To try the following example out, create a demo class named `zcl_some_class` and paste the code into it. After activation, choose *F9* in ADT to execute the class. The example uses a database table of the ABAP cheat sheets repository and is set up to display output in the console.
@@ -2467,6 +2522,87 @@ ENDCLASS.
<p align="right"><a href="#top">⬆️ back to top</a></p>
## Excursions
### ABAP SQL and Client Handling
> **🌰 In brief**<br>
> - ABAP SQL features implicit [client handling](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclient_handling_glosry.htm).
> - While you can disable this in classic ABAP, it is not an option in ABAP Cloud, where you are limited to accessing your own client.
> - Unlike ABAP SQL, there is no implicit client handling in Native SQL. AMDP, which uses Native SQL, is usable in ABAP Cloud, but it is crucial to ensure that AMDP only accesses client-safe repository objects, meaning it only accesses data from your own client. For this purpose, dedicated additions are provided.
**Notes on ABAP SQL:**
- An SAP system can have multiple clients, each distinguished by a unique [client ID](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclient_identifier_glosry.htm).
- Each client can contain unique data. For instance, when you log into the system, you select a client and can only access the data within that specific client. If you log into client 000, for example, your access is restricted to the data of client 000, not any other clients.
- Client-dependent data is managed through a client column. So, if a database table has a client column, it contains client-dependent data. However, there are also client-independent data sources, which contain data not specific to any client. These are typically accessed by [system programs](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensystem_program_glosry.htm).
- ABAP SQL features implicit client handling, i.e. it automatically handles client selection. When you execute an ABAP SQL statement in a client, the system automatically uses the current client. There is no need to specify the client separately, as the compiler automatically manages client handling.
- See the following example using a SELECT statement selecting from a database table.
```abap
"Using the current client implicitly
SELECT * FROM zdemo_abap_carr INTO TABLE @DATA(itab1).
"For example, it is not possible to specify the client explicitly in a WHERE clause.
"The following statement shows a syntax error.
"SELECT * FROM zdemo_abap_carr WHERE mandt = '123' INTO TABLE @DATA(itab2).
```
- However, in classic ABAP, not in ABAP Cloud, you can use the [`USING CLIENT` (F1 docu for Standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapselect_client.htm) addition modifies this default behavior. It disables implicit client handling.
- With the addition, you can specify other clients from which to retrieve data. Find more information in the ABAP Keyword Documentation.
- You may also stumble on the `CLIENT SPECIFIED` addition. It is obsolete, only `USING CLIENT` should be used.
- The following (classic ABAP only) code shows a variety of syntax options. Note that it uses a data source of the cheat sheet repository. For exploration, you may want to use another data source. You may also want to check the commands that are passed by the [ABAP SQL Interface](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_sql_interface_glosry.htm) when activating the SQL trace (transaction ST05) to the explore the use of another client ID and more.
```abap
"---- The following code is for classic ABAP only. ----
"SQL SELECT statements turning off the implicit client handling, and
"specifying different clients to retrieve data from
"Literal containing a client ID
SELECT * FROM zdemo_abap_carr USING CLIENT '000' INTO TABLE @DATA(itab3).
"Data object containing a client ID (must be of type c length 3)
"Note: If the client does not exist, the result set is empty.
TYPES c3 LENGTH 3.
DATA client_id TYPE c3 VALUE '000'.
SELECT * FROM zdemo_abap_carr USING CLIENT @client_id INTO TABLE @DATA(itab4).
"Selecting from multiple clients
"Using a ranges table
DATA client_range TYPE RANGE OF c3.
client_range = VALUE #( ( sign = 'I' option = 'EQ' low = '000' )
( sign = 'I' option = 'BT' low = '100' high = '200' ) ).
SELECT * FROM zdemo_abap_carr USING CLIENTS IN @client_range INTO TABLE @DATA(itab5).
"Selecting data of all clients whose client IDs are in the column MANDT of the
"system table T000
SELECT * FROM zdemo_abap_carr USING CLIENTS IN t000 INTO TABLE @DATA(itab6).
"Selecting data of all clients regardless of the content of the client column
SELECT * FROM zdemo_abap_carr USING ALL CLIENTS INTO TABLE @DATA(itab7).
```
- Find more information on client handling [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_sql_client_handling.htm).
**Notes on Native SQL/AMDP**
- Unlike ABAP SQL, Native SQL does not have implicit handling, so you must explicitly pass the client.
- Native SQL is passed directly to the database.
- AMDP, which uses Native SQL, also does not support implicit client handling.
- While AMDP is permitted in ABAP Cloud, accessing client-dependent data via Native SQL is not supported.
- When using AMDP in ABAP Cloud, it is crucial to access only the current client. Client-safety must be ensured..
- AMDP methods in ABAP Cloud must be client-safe, meaning the SQLScript code should access data only in your client. Use only artifacts that limit access to a single client or those that are client-independent.
- Consequently, all objects in the `USING` list must be client-safe, including CDS table functions implemented as AMDP methods.
- There are additions to cover client-safe aspects, ensuring access only to your client data.
- Find more information about client safety in AMDP [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenamdp_client_safety.htm).
**Notes on CDS view entities**
- In CDS view entities, client handling is done implicitly and automatically.
- The client dependency is determined by the data sources used. If at least one source is client-dependent, then the entire entity is client-dependent.
- More information:
- [Client Handling in CDS View Entities](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_v2_view_client_handling.htm)
- [Client Safety of CDS View Entities](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_v2_view_client_safety.htm)
- [Client Handling in CDS Table Functions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_func_client_handling.htm)
<p align="right"><a href="#top">⬆️ back to top</a></p>
### RAP-Specific ABAP SQL Variants
There are [RAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenarap_glosry.htm)-specific variants of ABAP SQL statements that use the `MAPPING FROM ENTITY` addition. Find more information [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmapping_from_entity.htm) and in the [ABAP for RAP: Entity Manipulation Language (ABAP EML)](08_EML_ABAP_for_RAP.md#abap-sql-statements-with-bdef-derived-types) cheat sheet.

View File

@@ -1762,6 +1762,9 @@ DATA(where_clause) = VALUE string_table( ( `CARRID = 'LH'` )
( `OR` )
( `CARRID = 'AA'` ) ).
"A string as an alternative
"DATA(where_clause) = `CARRID = 'LH' OR CARRID = 'AA'`.
SELECT *
FROM zdemo_abap_fli
WHERE (where_clause)

View File

@@ -9,6 +9,7 @@
- [AMDP Procedures](#amdp-procedures)
- [AMDP Functions](#amdp-functions)
- [CDS Table Functions](#cds-table-functions)
- [Notes on Client Handling and Client Safety](#notes-on-client-handling-and-client-safety)
- [More Information](#more-information)
- [Executable Example](#executable-example)
@@ -380,31 +381,48 @@ You can then use the CDS table function as source for a
<p align="right"><a href="#top">⬆️ back to top</a></p>
## Notes on Client Handling and Client Safety
> **🌰 In brief**<br>
> - ABAP SQL features implicit [client handling](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclient_handling_glosry.htm).
> - While you can disable this in classic ABAP, it is not an option in ABAP Cloud, where you are limited to accessing your own client.
> - Unlike ABAP SQL, there is no implicit client handling in Native SQL. AMDP, which uses Native SQL, is usable in ABAP Cloud, but it is crucial to ensure that AMDP only accesses client-safe repository objects, meaning it only accesses data from your own client. For this purpose, dedicated additions are provided.
**ABAP SQL:**
- An SAP system can have multiple clients, each distinguished by a unique [client ID](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclient_identifier_glosry.htm).
- Each client can contain unique data. For instance, when you log into the system, you select a client and can only access the data within that specific client. If you log into client 000, for example, your access is restricted to the data of client 000, not any other clients.
- Client-dependent data is managed through a client column. So, if a database table has a client column, it contains client-dependent data. However, there are also client-independent data sources, which contain data not specific to any client. These are typically accessed by [system programs](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensystem_program_glosry.htm).
- ABAP SQL features implicit client handling, i.e. it automatically handles client selection. When you execute an ABAP SQL statement in a client, the system automatically uses the current client. There is no need to specify the client separately, as the compiler automatically manages client handling. Exception: The [`USING CLIENT` (F1 docu for Standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapselect_client.htm) addition modifies this default behavior. It disables implicit client handling.
- Find more information on client handling [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_sql_client_handling.htm).
**Native SQL/AMDP**
- Unlike ABAP SQL, Native SQL does not have implicit handling, so you must explicitly pass the client.
- Native SQL is passed directly to the database.
- AMDP, which uses Native SQL, also does not support implicit client handling.
- While AMDP is permitted in ABAP Cloud, accessing client-dependent data via Native SQL is not supported.
- When using AMDP in ABAP Cloud, it is crucial to access only the current client. Client-safety must be ensured..
- AMDP methods in ABAP Cloud must be client-safe, meaning the SQLScript code should access data only in your client. Use only artifacts that limit access to a single client or those that are client-independent.
- Consequently, all objects in the `USING` list must be client-safe, including CDS table functions implemented as AMDP methods.
- There are additions to cover client-safe aspects, ensuring access only to your client data.
- Find more information about client safety in AMDP [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenamdp_client_safety.htm).
<p align="right"><a href="#top">⬆️ back to top</a></p>
## More Information
**... on AMDP in ABAP for Cloud Development**
Find more information in the subtopics of the [ABAP Keyword Documentation (ABAP for Cloud Development)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenamdp.htm).
> **💡 Note**<br>
> - In ABAP for Cloud Development, AMDP methods must be client-safe. This means that the SQLScript code should only access artifacts that restrict access to a single client, such as CDS view entities, or are client-independent. Therefore, all objects used in the `USING` list must be client-safe. This also applies to CDS table functions implemented as AMDP methods. Accessing client-dependent data using Native SQL is not supported in ABAP for Cloud Development.
> - The AMDP example for ABAP for Cloud Development is designed differently compared to the AMDP example for Standard ABAP. Instead of using demo database tables, CDS view entities are used in the `USING` list. Additionally, the client handling is adjusted for the AMDP methods by including appropriate additions in the AMDP method declaration part.
**... on AMDP in Standard ABAP**
Find more information in the subtopics of the [ABAP Keyword Documentation (Standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenamdp.htm).
> **✔️ Hint**<br>
> Checking if AMDP is supported on the system:
> ```abap
> IF NOT cl_abap_dbfeatures=>use_features(
> EXPORTING requested_features =
> VALUE #( ( cl_abap_dbfeatures=>call_amdp_method ) ) ).
>
>   "Result: Current database system does not support AMDP procedures
> RETURN.
> ENDIF.
> ```
- AMDP in ABAP for Cloud Development: [ABAP Keyword Documentation (ABAP for Cloud Development)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenamdp.htm)
- AMDP in Standard ABAP: [ABAP Keyword Documentation (Standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenamdp.htm)
> **✔️ Hint**<br>
> Checking if AMDP is supported in classic ABAP:
> ```abap
> IF NOT cl_abap_dbfeatures=>use_features(
> EXPORTING requested_features =
> VALUE #( ( cl_abap_dbfeatures=>call_amdp_method ) ) ).
>
>   "Result: Current database system does not support AMDP procedures
> RETURN.
> ENDIF.
> ```
<p align="right"><a href="#top">⬆️ back to top</a></p>
@@ -417,5 +435,6 @@ Find more information in the subtopics of the [ABAP Keyword Documentation (Stand
> - AMDP procedures, calling AMDP procedures from SQLScript
> - AMDP table functions for AMDP methods
> - AMDP table functions for CDS table functions
> - The AMDP example for ABAP for Cloud Development is designed differently compared to the AMDP example for Standard ABAP. Instead of using demo database tables, CDS view entities are used in the `USING` list. Additionally, the client handling is adjusted for the AMDP methods by including appropriate additions in the AMDP method declaration part.
> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer)

View File

@@ -52,6 +52,7 @@ ABAP cheat sheets[^1] ...
- In order to have all ABAP cheat sheet documents in one place, the *main* branch (for examples to be imported into the SAP BTP ABAP environment) also contains the ABAP cheat sheet documents that are only relevant for classic ABAP.
- The example classes contained in the branches for classic ABAP mostly use syntax that is also available in ABAP for Cloud Development. Only the `TEST_ABAP_CHEAT_SHEETS_CLASSIC` subpackage contains syntax relevant to Standard ABAP and that is not available in ABAP for Cloud Development, such as dynpro-related ABAP keywords.
- The code snippets in the ABAP cheat sheet documents and the executable examples include many comments. While it is generally not recommended to overuse comments in your code, they are used here to explain and provide context directly where it is needed. In many cases, they illustrate the results of ABAP statements.
- As previously mentioned, the cheat sheet documents and examples primarily focus on syntax options. The usage and names of data objects, classes, methods etc. are nonsemantic.
</details>
<br>
@@ -218,7 +219,7 @@ Use the standalone version of the abapGit report to import the demo examples of
- Only one user on the system can import this repository because all object names must be globally unique.
- Regarding possible code check warnings, e.g. for the many strings in the code, not using an `ORDER BY` clause, or messages regarding using `SELECT *`, the code deliberately avoids [pragmas](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenpragma_glosry.htm) and [pseudo comments](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenpseudo_comment_glosry.htm) in order to focus on the available ABAP syntax. See also the [Disclaimer](#%EF%B8%8F-disclaimer).
- Regarding the examples to be imported into a system supporting classic ABAP, note the following: In most cases, the cheat sheet documents and examples focus on ABAP for Cloud Development. Therefore, the lower the [ABAP release](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_release_glosry.htm) in your system, the fewer syntax options and examples are available. For example, the RAP examples need at least ABAP version 7.56. Or, the [`FINAL` declaration operator](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenfinal_inline.htm) is not available in ABAP version 7.56. The code examples in the classic ABAP branches do not necessarily reflect all (described) syntax variations and options that are available in classic ABAP and in the particular ABAP release. For more information on new ABAP features by release, see the [ABAP Release News (Standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abennews.htm).
- If you encounter import problems with the XSLT/ST objects, try to manually paste the code from the 3 `...source.xml` files ([zdemo_abap_st_carrhtml](./src/zdemo_abap_st_carrhtml.xslt.source.xml), [zdemo_abap_st_strhtml](./src/zdemo_abap_st_strhtml.xslt.source.xml), [zdemo_abap_xslt_fl](./src/zdemo_abap_xslt_fl.xslt.source.xml)) into the improperly imported objects and activate all non-active objects.
- If you encounter import problems with the XSLT/ST objects, try to manually paste the code from the 3 `...source.xml` files ([zdemo_abap_st_carrhtml](./src/zdemo_abap_st_carrhtml.xslt.source.xml), [zdemo_abap_st_strhtml](./src/zdemo_abap_st_strhtml.xslt.source.xml), [zdemo_abap_xslt_fl](./src/zdemo_abap_xslt_fl.xslt.source.xml)) into the improperly imported objects and activate all inactive objects.
<br>