+
+| Syntax | Notes |
+
+
+
+|
+
+`... INTO TABLE ...`
+ |
+
+
+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.
+```
+
+ |
+
+
+
+|
+
+`... INTO ...`
+ |
+
+
+Expects a structure when used without `TABLE`.
+
+```abap
+SELECT SINGLE comp1, comp2, comp3
+ FROM dbtab
+ WHERE ...
+ INTO @struc.
+```
+
+ |
+
+
+
+|
+
+`... INTO CORRESPONDING FIELDS OF [TABLE] ...`
+ |
+
+
+- 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.
+```
+
+ |
+
+
+
+|
+
+`... APPENDING [CORRESPONDING FIELDS OF] TABLE ...`
+ |
+
+
+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.
+```
+
+ |
+
+
+
+ NEW addition: Specifying an anonymous data object as target object |
+
+
+- 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`.
+
+
+
+``` 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).
+```
+
+ |
+
+
+
+
+|
+
+`... INTO ( dobj1, dob2, ... ) ...`
+ |
+
+
+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) ).
+```
+
+
+ |
+
+
+
+
+
+
+More target-related additions:
| Subject | Details/Code Snippet |
+
+
-| Retrieving a single row into a structure |
+
+
+`SINGLE` addition: Retrieving a single row into a structure |
``` abap
@@ -317,12 +569,6 @@ SELECT SINGLE comp1, comp2, comp3 "Selected set of fields
INTO CORRESPONDING FIELDS OF @struc. "Existing structure
```
-> **💡 Note**
->- 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).
-
|
@@ -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.
```
@@ -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.
``` 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).
```
-
-
-
-
-| Subject | Details/Code Snippet |
-
UP TO n ROWS addition: Limiting the number of returned table rows |
@@ -474,53 +734,6 @@ SELECT *
-
-| Storing the result in individual elementary data objects |
-
-
-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@).
-
-
-
-
-``` abap
-SELECT FROM dbtab
- FIELDS comp1, comp2, comp3
- WHERE ...
- INTO (@res1,@res2,@res3).
- "INTO (@DATA(res4),@DATA(res5),@DATA(res6)). "Using inline declarations
-```
-
- |
-
-
-
- APPENDING addition: Appending the result set to an existing internal table |
-
-
-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`.
-
-
-
-``` abap
-SELECT * FROM dbtab
- WHERE ...
- APPENDING TABLE @itab.
-
-SELECT * FROM dbtab
- WHERE ...
- APPENDING CORRESPONDING FIELDS OF TABLE @diff_itab.
-```
-
- |
-
-
PACKAGE SIZE n addition: Storing the result in packages of a specified number of rows |
@@ -542,25 +755,7 @@ ENDSELECT.
|
-
- NEW addition: Specifying an anonymous data object as target object |
-
-- 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`.
-
-
-
-``` 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).
-```
-
- |
-
INDICATORS [NOT] NULL STRUCTURE addition: Specifying null indicators |
@@ -630,7 +825,7 @@ SELECT tab2~key_field, tab1~char2
⬆️ back to top
-### Additional Clauses
+### Specifying Clauses to Order, Group and Set Conditions for the Result Set
@@ -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:
char\`abc\`) 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
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
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
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
4 = Row not or not all rows updated | The number of rows that were updated. |
+| `DELETE` | `DELETE FROM target` variant:
0 = At least one row deleted (with `WHERE` clause specified), all or n rows deleted (without `WHERE` clause specified)
4 = No row deleted
`DELETE target FROM` variant:
0 = Row deleted (work area specified), all rows deleted (internal table specified)
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.
+```
+
+⬆️ back to top
+
+### 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).
+```
+
+⬆️ back to top
+
### ABAP SQL and Client Handling
> **🌰 In brief**
diff --git a/04_ABAP_Object_Orientation.md b/04_ABAP_Object_Orientation.md
index fcdb69f..74404a9 100644
--- a/04_ABAP_Object_Orientation.md
+++ b/04_ABAP_Object_Orientation.md
@@ -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.
+⬆️ back to top
+
#### 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**
> - 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.
+
+⬆️ back to top
+
+#### 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.
+
+⬆️ back to top
+
+#### 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.
⬆️ back to top
@@ -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**
-> - 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.
diff --git a/08_EML_ABAP_for_RAP.md b/08_EML_ABAP_for_RAP.md
index 3e49c45..fc10844 100644
--- a/08_EML_ABAP_for_RAP.md
+++ b/08_EML_ABAP_for_RAP.md
@@ -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.
+⬆️ back to top
+### 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**
> 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**
+> 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.
+...
+```
+
+
⬆️ back to top
### Components of BDEF Derived Types
diff --git a/26_ABAP_Dictionary.md b/26_ABAP_Dictionary.md
index a0ab6cb..b51e49f 100644
--- a/26_ABAP_Dictionary.md
+++ b/26_ABAP_Dictionary.md
@@ -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**
-> 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).
-
-⬆️ back to top
-
-#### 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.
⬆️ back to top