diff --git a/01_Internal_Tables.md b/01_Internal_Tables.md
index 9cbc86d..2c30dc5 100644
--- a/01_Internal_Tables.md
+++ b/01_Internal_Tables.md
@@ -167,7 +167,7 @@ Internal Tables ...
- It can be declared either explicitly or implicitly.
- Standard key of an internal table with a ...
- structured line type: The primary table key consists of all fields with character-like and byte-like data types.
- - non-structured/elementary line type: The entire table is the key (`table_line`).
+ - non-structured/elementary line type: The entire table line is the key (`table_line`).
- An internal table with no explicit key specification implicitly has the standard table key as the primary table key.
- Why respecting standard keys is important:
- Sorting of a table can produce unexpected results.
@@ -3143,7 +3143,7 @@ DATA(line_ref) = REF #( itab[ 3 ] ).
-| Specifying a default value for lines that are not found to avoid an exception |
+ Specifying a default value for lines that are not found or marking as optional to avoid an exception |
- You can specify default values for lines that are not found to avoid an exception.
@@ -3828,7 +3828,7 @@ ENDLOOP.
- During the loop, the system field `sy-tabix` is set to the number of the currently processed table
line. This is not true for hashed tables. There, `sy-tabix` is `0`.
- Note that if you want to work with the value of `sy-tabix`, you
-should do so immediately after the `LOOP` statement to avoid possible overwriting in statements contained in the loop block.
+should do so immediately after the `LOOP` statement (e.g. by storing the value in a helper variable) to avoid possible overwriting in statements contained in the loop block.
⬆️ back to top
@@ -4657,7 +4657,7 @@ LOOP AT itab1 INTO DATA(wa1).
ref->* = CORRESPONDING #( BASE ( ref->* ) VALUE #( itab2[ key2 = ref->key1 ] OPTIONAL ) ).
ENDLOOP.
"Assume the second table's shared component was also key1. In the second CORRESPONDING
-"you could then work with the EXCEPT addition to not overwrite the identicall named
+"you could then work with the EXCEPT addition to not overwrite the identically named
"component.
"Example similar to the previous one
@@ -4753,7 +4753,7 @@ DATA it2 TYPE STANDARD TABLE OF zdemo_abap_fli WITH DEFAULT KEY.
"Respecting the standard key when sorting
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`.
+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 also applies to tables declared with `EMPTY KEY`.
|
@@ -5368,6 +5368,9 @@ ASSERT seats_tab_loop_grp = seats_tab_col.
Consider a scenario where you have a standard internal table, and you frequently access its content using a free key. The table is declared without a secondary table key. You can add a secondary table key to improve read performance.
The following example creates two demo internal tables. One without a secondary table key and the other with a secondary table key. The tables are populated with a lot of data. Then, in a `DO` loop, many reads are performed on the internal tables. One example uses a free key for the read, the other uses a secondary table key that includes the components used for the free key search. Before and after the reads, the current timestamp is stored in variables, from which the elapsed time is calculated. There should be a significant delta of the elapsed time.
+> **💡 Note**
+
+
+| Component | Notes | Code Snippet |
+
+
+
+|
+
+[`%cid`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_cid.htm),
+[`%cid_ref`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_cid_ref.htm)
+
+ |
+
+
+
+- [`%cid`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_cid.htm) is a string to define a content ID.
+- Content IDs are used as a unique and preliminary identifier for
+RAP BO operations in which instances are created and especially
+in cases where the key values of RAP BO instances are not yet
+determined
+- Assume that you create a RAP BO instance with an EML create
+request and the key value has not yet been determined. In the
+same request - a save has not yet been triggered - an update is
+requested for this RAP BO instance. Using the content ID, it is
+guaranteed that the update operation happens for the desired
+instance. For this purpose, derived types for operations like
+update or delete include the component
+[`%cid_ref`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_cid_ref.htm)
+to refer to the content ID `%cid` as the name implies.
+- Note: You should always fill `%cid` even if not
+needed. The specified content ID is only valid within one ABAP
+EML request. You can use the optional addition [`AUTO FILL CID`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmodify_entity_entities_fields.htm#!ABAP_ONE_ADD@1@) in EML modify operations to create `%cid` automatically. However, if you use this addition, you cannot refer to `%cid` in subsequent operations.
+
+ |
+
+
+
+``` abap
+MODIFY ENTITIES OF zdemo_abap_rap_ro_m
+ ENTITY root
+ CREATE FROM VALUE #(
+ %control-key_field = if_abap_behv=>mk-on
+ %control-field1 = if_abap_behv=>mk-on
+ %control-field2 = if_abap_behv=>mk-on
+ %control-field3 = if_abap_behv=>mk-on
+ %control-field4 = if_abap_behv=>mk-on
+ ( %cid = 'cid5'
+ key_field = 5
+ field1 = 'iii'
+ field2 = 'jjj'
+ field3 = 50
+ field4 = 51 ) )
+ UPDATE FIELDS ( field1 field3 field4 )
+ WITH VALUE #( ( %cid_ref = 'cid5'
+ field1 = 'up_kkk'
+ field2 = 'up_lll' "Value not considered
+ field3 = 500
+ field4 = 501 ) )
+ MAPPED FINAL(mapped)
+ FAILED FINAL(failed)
+ REPORTED FINAL(reported).
+```
+
+ |
+
+
+
+|
+
+[`%key`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_key.htm), [`%tky`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_tky.htm)
+
+ |
+
+
+
+- Both are component groups summarizing all primary keys of a RAP
+ BO instance.
+- Where possible, it is recommended that you use `%tky`
+ instead of `%key`. `%tky` includes
+ `%key` and also the draft indicator
+ `%is_draft`. When using `%tky` in non-draft
+ scenarios, you are prepared for a potential, later switch to a
+ draft scenario. In doing so, you can avoid lots of adaptations
+ in your code by manually adding the indicator.
+
+ |
+
+
+
+The code snippet visualizes various specification options regarding `%key` and `%tky` as component groups, emphasizing how contained component may be accessed and that these component groups can contain further component groups.
+
+``` abap
+MODIFY ENTITY zdemo_abap_rap_ro_m
+ CREATE FROM VALUE #(
+ %control = VALUE #( key_field = if_abap_behv=>mk-on
+ field1 = if_abap_behv=>mk-on
+ field2 = if_abap_behv=>mk-on
+ field3 = if_abap_behv=>mk-on
+ field4 = if_abap_behv=>mk-on )
+ ( %cid = 'cid1' %key-key_field = 1
+ field1 = 'aaa' field2 = 'bbb' field3 = 10 field4 = 11 )
+ ( %cid = 'cid2' %key = VALUE #( key_field = 2 )
+ field1 = 'ccc' field2 = 'ddd' field3 = 20 field4 = 21 )
+ ( %cid = 'cid3' key_field = 3
+ field1 = 'eee' field2 = 'fff' field3 = 30 field4 = 31 )
+ ( %cid = 'cid4' %data-%key-key_field = 4
+ field1 = 'ggg' field2 = 'hhh' field3 = 40 field4 = 41 )
+ ( %cid = 'cid5' %data-key_field = 5
+ field1 = 'iii' field2 = 'jjj' field3 = 50 field4 = 51 ) )
+ "Other options for referring to the key besides using %key
+ "are demonstrated.
+ UPDATE FIELDS ( field2 ) WITH VALUE #(
+ ( %key-key_field = 1 field2 = 'up1' )
+ ( key_field = 2 field2 = 'up2' )
+ ( %tky-%key-key_field = 3 field2 = 'up3' )
+ ( %tky-key_field = 4 field2 = 'up4' )
+ ( %tky-%pky-%key-key_field = 5 field2 = 'up5' )
+ ( %tky-%pky-key_field = 6 field2 = 'up6' )
+ ( %pky-key_field = 7 field2 = 'up7' )
+ ( %pky-%key-key_field = 8 field2 = 'up8' )
+ ( %data-%key-key_field = 9 field2 = 'up9' )
+ ( %data-key_field = 10 field2 = 'up10' ) )
+ MAPPED FINAL(mapped)
+ FAILED FINAL(failed)
+ REPORTED FINAL(reported).
+```
+
+ |
+
+
+
+
+|
+
+[`%control`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_control.htm)
+
+ |
+
+
+
+- Structured component that is a component of many BDEF derived types. It contains the names of all key
+and data fields of a RAP BO instance, which indicate flags.
+- For example, it is used to get information on which fields are provided or set a
+flag for which fields are requested by RAP BO providers or RAP
+BO consumers respectively during the current EML request.
+- For this purpose, the value of each field in the
+`%control` structure is of type
+`ABP_BEHV_FLAG`. For the value setting,
+you can use the structured constant `mk` of interface
+`IF_ABAP_BEHV`. Note that the technical
+type is `x length 1`.
+- Example: If you want to read data from a RAP BO instance and
+particular non-key fields in `%control` are set to
+`if_abap_behv=>mk-off`, the values of these fields
+are not returned in the result.
+
+ |
+
+
+
+``` abap
+MODIFY ENTITY zdemo_abap_rap_ro_m
+ CREATE FROM VALUE #( %control-key_field = if_abap_behv=>mk-on
+ %control-field1 = if_abap_behv=>mk-on
+ %control-field2 = if_abap_behv=>mk-on
+ %control-field3 = if_abap_behv=>mk-on
+ %control-field4 = if_abap_behv=>mk-on
+ ( %cid = 'cid1'
+ key_field = 1
+ field1 = 'aaa'
+ field2 = 'bbb'
+ field3 = 10
+ field4 = 11 )
+ ( %cid = 'cid2'
+ key_field = 2
+ field1 = 'ccc'
+ field2 = 'ddd'
+ field3 = 20
+ field4 = 21 ) )
+ MAPPED FINAL(mapped)
+ FAILED FINAL(failed)
+ REPORTED FINAL(reported).
+```
+
+ |
+
+
+
+|
+
+[%is_draft](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_is_draft.htm)
+
+ |
+
+
+
+- Represents the draft indicator
+- Used in [RAP draft handling](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/ABENRAP_DRAFT_HANDLING_GLOSRY.html) and indicates whether a RAP BO instance is active or not. A RAP BO instance with the draft indicator set to true represents a [RAP draft instance](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_draft_instance_glosry.htm), e.g. created by a create operation. A commit triggers the saving of the instance to a [draft table](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abendraft_table_glosry.htm).
+- Is contained in `%tky`
+- Is of type `ABP_BEHV_FLAG`
+
+ |
+
+
+
+``` abap
+MODIFY ENTITY zdemo_abap_rap_draft_m
+ CREATE AUTO FILL CID
+ FIELDS ( num1 arithm_op num2 )
+ WITH VALUE #( ( %is_draft = if_abap_behv=>mk-on
+ num1 = 1 arithm_op = '+' num2 = 2 )
+ ( %is_draft = if_abap_behv=>mk-on
+ num1 = 2 arithm_op = '*' num2 = 4 )
+ ( %is_draft = if_abap_behv=>mk-on
+ num1 = 3 arithm_op = '-' num2 = 5 )
+ ( %is_draft = if_abap_behv=>mk-on
+ num1 = 1 arithm_op = '/' num2 = 4 )
+ ( %is_draft = if_abap_behv=>mk-on
+ num1 = 2 arithm_op = 'P' num2 = 5 ) )
+ FAILED FINAL(f)
+ REPORTED FINAL(r)
+ MAPPED FINAL(m).
+```
+
+ |
+
+
+
+|
+
+[%target](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_target.htm)
+
+ |
+
+
+
+- Used to address compositions such as child entities in create operations.
+- Includes the target's primary key and data fields.
+
+ |
+
+
+
+``` abap
+MODIFY ENTITIES OF zdemo_abap_rap_ro_m
+ ENTITY root
+ CREATE FIELDS ( key_field field1 field2 field3 field4 )
+ WITH VALUE #( ( %cid = 'cid_cba'
+ key_field = 9
+ field1 = 'qqq'
+ field2 = 'rrr'
+ field3 = 90
+ field4 = 91 ) )
+ CREATE BY \_child
+ FIELDS ( key_ch field_ch1 field_ch2 ) WITH VALUE #(
+ ( %cid_ref = 'cid_cba'
+ %target = VALUE #( ( %cid = 'cid_ch1'
+ key_ch = 9
+ field_ch1 = 'aaa_ch'
+ field_ch2 = 99 )
+ ( %cid = 'cid_ch2'
+ key_ch = 10
+ field_ch1 = 'bbb_ch'
+ field_ch2 = 100 ) ) ) )
+ MAPPED FINAL(mapped)
+ FAILED FINAL(failed)
+ REPORTED FINAL(reported).
+```
+
+ |
+
+
+
The following code snippet illustrates the importance of careful component access and value assignment with component groups in BDEF derived types:
@@ -1185,7 +1416,10 @@ derived_type = VALUE #( key_field = 1
field3 = if_abap_behv=>mk-on
field4 = if_abap_behv=>mk-off ) ).
-"-------------------- USING CONTROL addition --------------------
+*&---------------------------------------------------------------------*
+*& USING CONTROL addition
+*&---------------------------------------------------------------------*
+
"This addition respects the %control component of BDEF derived types, i.e.
"only those fields for which the %control field has been marked as enabled
"are respected by the mapping. A disabled %control field means that the
@@ -1199,7 +1433,10 @@ some_other_type = CORRESPONDING #( derived_type USING CONTROL ).
*KEY_FIELD FIELD1 FIELD2 FIELD3 FIELD4
*1 bbb 2 0
-"-------------------- CHANGING CONTROL addition --------------------
+*&---------------------------------------------------------------------*
+*& CHANGING CONTROL addition
+*&---------------------------------------------------------------------*
+
"This variant fills the %control structure of a BDEF-derived type based on
"a non-BDEF-derived type that does not include control information.
"In the example, two components are not assigned (i.e. they remain initial).
@@ -1220,7 +1457,10 @@ derived_type = CORRESPONDING #( some_other_type CHANGING CONTROL ).
The ABAP SQL statements `INSERT`, `UPDATE`, `MODIFY`, and `DELETE` offer the [`MAPPING FROM ENTITY`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmapping_from_entity.htm) addition to handle BDEF derived types.
```abap
-"--------------- INSERT ---------------
+*&---------------------------------------------------------------------*
+*& INSERT
+*&---------------------------------------------------------------------*
+
"Populating a BDEF derived type
DATA cr_der_type TYPE STRUCTURE FOR CREATE zdemo_abap_rap_ro_m.
"%control is not relevant in this example
@@ -1235,7 +1475,10 @@ INSERT zdemo_abap_rapt1 FROM @cr_der_type MAPPING FROM ENTITY.
*KEY_FIELD FIELD1 FIELD2 FIELD3 FIELD4
*1 aaa bbb 2 3
-"--------------- MODIFY ---------------
+*&---------------------------------------------------------------------*
+*& MODIFY
+*&---------------------------------------------------------------------*
+
cr_der_type = VALUE #( BASE cr_der_type
field1 = 'YYY'
field2 = 'ZZZ' ).
@@ -1245,7 +1488,10 @@ MODIFY zdemo_abap_rapt1 FROM @cr_der_type MAPPING FROM ENTITY.
*KEY_FIELD FIELD1 FIELD2 FIELD3 FIELD4
*1 YYY ZZZ 2 3
-"--- UPDATE with the INDICATORS SET STRUCTURE %control addition ---
+*&---------------------------------------------------------------------*
+*& UPDATE with the INDICATORS SET STRUCTURE %control addition
+*&---------------------------------------------------------------------*
+
"Populating a BDEF derived type
"%control is relevant in this example. Some %control values are enabled,
"some are not.
@@ -1266,7 +1512,10 @@ UPDATE zdemo_abap_rapt1 FROM @cr_der_type
*KEY_FIELD FIELD1 FIELD2 FIELD3 FIELD4
*1 ### ZZZ 2 200
-"--------------- DELETE ---------------
+*&---------------------------------------------------------------------*
+*& DELETE
+*&---------------------------------------------------------------------*
+
DELETE zdemo_abap_rapt1 FROM @cr_der_type MAPPING FROM ENTITY.
```
@@ -2197,18 +2446,27 @@ GET PERMISSIONS ONLY GLOBAL ENTITY zdemo_abap_rap_ro_m
- [Business Events](https://help.sap.com/docs/abap-cloud/abap-rap/business-events) in the SAP Help Portal
```abap
-"---- Syntax for the declaration part of a global RAP event handler class ----
+*&---------------------------------------------------------------------*
+*& Syntax for the declaration part of a global RAP event handler class
+*&---------------------------------------------------------------------*
+
CLASS cl_event_handler DEFINITION PUBLIC FOR EVENTS OF some_bdef.
...
ENDCLASS.
-"---- Syntax for the declaration part of a local event handler class ----
-"---- in the CCIMP include of a RAP event handler class ----
+*&---------------------------------------------------------------------*
+*& Syntax for the declaration part of a local event handler class
+*& in the CCIMP include of a RAP event handler class
+*&---------------------------------------------------------------------*
+
CLASS lhe_event DEFINITION INHERITING FROM cl_abap_behavior_event_handler.
...
ENDCLASS.
-"---- RAP event handler method definition ----
+*&---------------------------------------------------------------------*
+*& RAP event handler method definition
+*&---------------------------------------------------------------------*
+
"Notes:
"- Must be defined as instance methods in the private visibility section.
"- The input parameter par is an internal table of type TYPE TABLE FOR EVENT.
@@ -2217,8 +2475,11 @@ ENDCLASS.
"- The methods do not contain RAP response parameters.
METHODS meth FOR ENTITY EVENT par FOR some_bdef~some_evt.
-"---- RAISE ENTITY EVENT statement in an ABP, e.g. the save_modified method ----
-"---- in managed scenarios with additional save ----
+*&---------------------------------------------------------------------*
+*& RAISE ENTITY EVENT statement in an ABP, e.g. the save_modified method
+*& in managed scenarios with additional save
+*&---------------------------------------------------------------------*
+
...
CLASS lsc IMPLEMENTATION.
METHOD save_modified.
diff --git a/19_ABAP_for_Cloud_Development.md b/19_ABAP_for_Cloud_Development.md
index 186b388..c14ccfe 100644
--- a/19_ABAP_for_Cloud_Development.md
+++ b/19_ABAP_for_Cloud_Development.md
@@ -34,7 +34,7 @@ It provides references to more detailed information on the topic.
- Based on the ABAP technology without restrictions regarding the ...
- ABAP language versions, i.e. you can use both [Standard ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenstandard_abap_glosry.htm) (the unrestricted ABAP language version) and ABAP for Cloud Development
- usage of tools (ADT and/or SAP GUI)
- - access to repository objects (i.e. also objects provided by SAP can be accessed).
+ - access to repository objects (i.e. objects provided by SAP, beyond released APIs, can be accessed).
- Supported in [SAP S/4HANA](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensap_s4hana_glosry.htm)