diff --git a/01_Internal_Tables.md b/01_Internal_Tables.md
index 6fc24f6..e2d0b3a 100644
--- a/01_Internal_Tables.md
+++ b/01_Internal_Tables.md
@@ -25,7 +25,7 @@
- [Checking the Existence of a Line in an Internal Table](#checking-the-existence-of-a-line-in-an-internal-table)
- [Checking the Index of a Line in an Internal Table](#checking-the-index-of-a-line-in-an-internal-table)
- [Checking How Many Lines Exist in an Internal Table](#checking-how-many-lines-exist-in-an-internal-table)
- - [Getting Table (Type) Information and Creating Internal Tables and Types at Runtime](#getting-table-type-information-and-creating-internal-tables-and-types-at-runtime)
+ - [Getting Table (Type) Information at Runtime](#getting-table-type-information-at-runtime)
- [Processing Multiple Internal Table Lines Sequentially](#processing-multiple-internal-table-lines-sequentially)
- [Restricting the Area of a Table to Be Looped Over](#restricting-the-area-of-a-table-to-be-looped-over)
- [Iteration Expressions](#iteration-expressions)
@@ -45,6 +45,7 @@
- [Searching and Replacing Substrings in Internal Tables with Character-Like Data Types](#searching-and-replacing-substrings-in-internal-tables-with-character-like-data-types)
- [Ranges Tables](#ranges-tables)
- [Comparing Content of Compatible Internal Tables](#comparing-content-of-compatible-internal-tables)
+ - [BDEF Derived Types (ABAP EML)](#bdef-derived-types-abap-eml)
- [More Information](#more-information)
- [Executable Example](#executable-example)
@@ -53,13 +54,14 @@
Internal Tables ...
+- are tables that temporarily store variable data (i.e. any number of table lines of a fixed structure) in the working memory in ABAP.
- are [dynamic data objects](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abendynamic_data_object_glosry.htm), i.e. all properties apart from the memory consumption are determined statically by the [data type](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abendata_type_glosry.htm).
- consist of a variable sequence of lines of the same data type.
- have a [table type](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentable_type_glosry.htm) as its data type (it is a [complex data type](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencomplex_data_type_glosry.htm)), which defines the following properties:
- [line type](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrow_type_glosry.htm)
- [table category](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentable_category_glosry.htm)
- [table key](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentable_key_glosry.htm)
-- are used when a variable data set of a random data type needs to be processed in a structured way.
+- are used when a variable data set of a random data type needs to be processed in a structured way, for example, storing and processing [database table](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abendatabase_table_glosry.htm) content within an [ABAP program](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_program_glosry.htm).
- allow access to individual table lines via a [table index](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentable_index_glosry.htm) or a [table key](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentable_key_glosry.htm).
⬆️ back to top
@@ -88,7 +90,7 @@ Internal Tables ...
| Category | Internally managed by | Access | Primary table key | When to use | Hints |
|---|---|---|---|---|---|
-|`STANDARD`|Primary table index (that's why these tables are called [index tables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenindex_table_glosry.htm))||- Always non-unique, i.e. duplicate entries are always allowed
- Definition of an empty key is possible if the key is not relevant(`WITH EMPTY KEY`)
|- If you primarily access the table content for sequential processing or via the table index.
- Response time for accessing the table using the primary key: This kind of table access is optimized only for sorted and hashed tables. For standard tables, primary key access uses a linear search across all lines. That means that large standard tables (more than 100 lines) are not ideal if the you primarily access the table using the table key.>
|- There is no particular sort order, but the tables can be sorted using `SORT`.
- Populating this kind of table: Lines are either appended at the end of the table or inserted at a specific position.
- [Secondary table keys](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensecondary_table_key_glosry.htm) can be defined to make key access to standard tables more efficient.
- Standard and sorted tables have the least [administration costs (F1 docu for standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenadmin_costs_dyn_mem_obj_guidl.htm).
|
+|`STANDARD`|Primary table index (that's why these tables are called [index tables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenindex_table_glosry.htm))||- Always non-unique, i.e. duplicate entries are always allowed
- Definition of an empty key is possible if the key is not relevant(`WITH EMPTY KEY`)
|- If you primarily access the table content for sequential processing or via the table index.
- Response time for accessing the table using the primary key: This kind of table access is optimized only for sorted and hashed tables. For standard tables, primary key access uses a linear search across all lines. That means that large standard tables (more than 100 lines) are not ideal if the you primarily access the table using the table key.
|- There is no particular sort order, but the tables can be sorted using `SORT`.
- Populating this kind of table: Lines are either appended at the end of the table or inserted at a specific position.
- [Secondary table keys](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensecondary_table_key_glosry.htm) can be defined to make key access to standard tables more efficient.
- Standard and sorted tables have the least [administration costs (F1 docu for standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenadmin_costs_dyn_mem_obj_guidl.htm).
|
|`SORTED`|Primary table index (that's why these tables are called [index tables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenindex_table_glosry.htm))||- Non-unique
- Unique
... used to sort the table in ascending order.
|- Enables an optimized access to table content using table key and index.
- If access via table key is the main access method, but no unique key can be defined.
|- Sorting is done automatically when lines are inserted or deleted. As a consequence, the table index must usually be reorganized.
- The response time for accessing the table using the primary key depends logarithmically on the number of table entries, since a binary search is used.
- Standard and sorted tables have the least administration costs.
|
|`HASHED`|Hash algorithm |- Table key
- [Secondary table index](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensecondary_table_index_glosry.htm)
|Always unique|- For large internal tables.
- Optimized for key access. Access to table content via table key is the main access method and a unique key can be defined.
|- The response time for primary key access is constant and independent of the number of entries in the table.
- Hashed tables have the highest administration costs.
|
@@ -206,7 +208,8 @@ DATA itab4 LIKE itab1 ... "Based on an existing in
```
> **💡 Note**
-> If the table category is not specified (`... TYPE TABLE OF ...`), it is automatically `... TYPE STANDARD TABLE OF ...`.
+> - If the table category is not specified (`... TYPE TABLE OF ...`), it is automatically `... TYPE STANDARD TABLE OF ...`.
+> - Using [Runtime Type Creation (RTTC)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrun_time_type_creation_glosry.htm "Glossary Entry"), you can define and create new internal tables and table types as [type description objects](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentype_object_glosry.htm) at runtime. For more information, see the [Dynamic Programming](06_Dynamic_Programming.md) ABAP cheat sheet.
The following code snippet contains various internal table declarations. It is intended to demonstrate a selection of the rich variety of possible internal tables mentioned in the previous sections, e.g. in *Table Keys in Internal Tables*.
In the examples, the internal tables are created using the structured type of a demo database table in the DDIC. The line type of the database table is automatically used when defining an internal table.
@@ -424,7 +427,7 @@ SELECT * FROM zdemo_abap_fli INTO TABLE @FINAL(it_inline6).
### Copying Internal Tables
-A simple assignment without a constructor expression that **copies the content of another internal table** (note that the existing content in `itab` are deleted). The example below assumes that the source and target table have compatible line types. Using inline declaration is helpful to avoid an additional internal table declaration with an appropriate type.
+To copy internal table content from one table to another, you can use the assignment operator. Such an assignment (without a constructor expression) deletes the existing content in the target internal table. The example below assumes that the source and target table have compatible line types. Using inline declaration is helpful to avoid an additional internal table declaration with an appropriate type.
``` abap
itab = itab2.
@@ -553,6 +556,9 @@ INSERT LINES OF itab2 INTO itab INDEX i.
### Creating and Populating Internal Tables Using Constructor Expressions
The constructor expressions can be specified in/with various positions/statements in ABAP. In most of the following snippets, simple assignments are demonstrated.
+> **💡 Note**
+> 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
As mentioned above, table lines that are constructed inline as
arguments to the `VALUE` operator, for example, can be added to
@@ -1189,18 +1195,15 @@ DATA(number_of_lines) = lines( itab ).
⬆️ back to top
-### Getting Table (Type) Information and Creating Internal Tables and Types at Runtime
+### Getting Table (Type) Information at Runtime
-Using [Runtime Type Services (RTTS)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrun_time_type_services_glosry.htm "Glossary Entry")
-you can ...
-- get type information on internal tables and table types at runtime ([Runtime Type Identification (RTTI)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrun_time_type_identific_glosry.htm "Glossary Entry")).
-- define and create new internal tables and table types as [type description objects](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentype_object_glosry.htm) at runtime ([Runtime Type Creation (RTTC)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrun_time_type_creation_glosry.htm "Glossary Entry")).
+Using [Runtime Type Identification (RTTI)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrun_time_type_identific_glosry.htm "Glossary Entry"),
+you can get type information on internal tables and table types at runtime
-For more information, see the [Dynamic Programming](06_Dynamic_Programming.md) cheat sheet.
+For more information, see the [Dynamic Programming](06_Dynamic_Programming.md) ABAP cheat sheet.
⬆️ back to top
-
## Processing Multiple Internal Table Lines Sequentially
If you are interested not only in single table lines, but in the entire
@@ -2765,6 +2768,26 @@ Find ...
⬆️ back to top
+### BDEF Derived Types (ABAP EML)
+
+In the context of [ABAP RAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenarap_glosry.htm), the operands of [ABAP EML](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_eml_glosry.htm) statements and parameters of [RAP handler methods](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabp_handler_method_glosry.htm) and [RAP saver methods](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabp_saver_method_glosry.htm) are mainly special messenger tables for passing data and receiving results or messages: [BDEF derived types](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_derived_type_glosry.htm) - special ABAP types (internal tables and structures) that are tailor-made for RAP purposes.
+
+```abap
+"Example declarations
+"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 declaration using a BDEF derived type
+TYPES der_typ TYPE TABLE FOR DELETE entity.
+```
+
+Find more information in the [ABAP for RAP: Entity Manipulation Language (ABAP EML)](08_EML_ABAP_for_RAP.md) ABAP cheat sheet.
+
+⬆️ back to top
+
## More Information
Topic [Internal Tables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenitab.htm) in the ABAP Keyword Documentation.
diff --git a/03_ABAP_SQL.md b/03_ABAP_SQL.md
index 98e9ae1..17db4c3 100644
--- a/03_ABAP_SQL.md
+++ b/03_ABAP_SQL.md
@@ -11,7 +11,7 @@
- [Clause Variations and Additions in SELECT Statements](#clause-variations-and-additions-in-select-statements)
- [More Clauses](#more-clauses)
- [Operands and Expressions in ABAP SQL Statements](#operands-and-expressions-in-abap-sql-statements)
- - [SQL operands](#sql-operands)
+ - [SQL Operands](#sql-operands)
- [SQL Expressions](#sql-expressions)
- [Elementary Expressions](#elementary-expressions)
- [SQL Functions](#sql-functions)
@@ -547,7 +547,7 @@ overview of important operand positions in ABAP SQL
[here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensql_operand_positions_oview.htm).
Due to the rich variety of options, the cheat sheet covers a selection.
-#### SQL operands
+#### SQL Operands
- Are elementary operands in an ABAP SQL statement
- Can be database table or view columns, a
diff --git a/04_ABAP_Object_Orientation.md b/04_ABAP_Object_Orientation.md
index e2799c5..22c9e0c 100644
--- a/04_ABAP_Object_Orientation.md
+++ b/04_ABAP_Object_Orientation.md
@@ -1165,7 +1165,7 @@ CLASS zcl_demo_test IMPLEMENTATION.
DATA(a) = inst_attr.
DATA(b) = stat_attr.
- "The following is also possible inside the class (it the only option outside of
+ "The following is also possible inside the class (it is the only option outside of
"this class):
DATA(c) = oref->inst_attr.
DATA(d) = zcl_demo_test=>stat_attr.
@@ -1686,7 +1686,7 @@ DATA(oref_sub2) = NEW lcl_sub2( ).
TRY.
oref_sub = CAST #( oref_super ).
- CATCH CX_SY_MOVE_CAST_ERROR INTO DATA(e).
+ CATCH cx_sy_move_cast_error INTO DATA(e).
...
ENDTRY.
diff --git a/06_Dynamic_Programming.md b/06_Dynamic_Programming.md
index f01cbef..1c8a7e2 100644
--- a/06_Dynamic_Programming.md
+++ b/06_Dynamic_Programming.md
@@ -707,13 +707,13 @@ tdo_gen_obj = cl_abap_typedescr=>describe_by_data( some_string ).
"Without catching the exception, the runtime error MOVE_CAST_ERROR
"occurs. There is no syntax error at compile time. The static type of
-"tdo_gen_obj is more generic than the static type of the target variable.
+"tdo_gen_obj is more general than the static type of the target variable.
"The error occurs when trying to downcast, and the dynamic type is used.
TRY.
tdo_table = CAST #( tdo_gen_obj ).
CATCH cx_sy_move_cast_error.
ENDTRY.
-"Note: tdo_table sill points to the reference as assigned above after trying
+"Note: tdo_table still points to the reference as assigned above after trying
"to downcast in the TRY control structure.
"Using CASE TYPE OF and IS INSTANCE OF statements, you can check if downcasts
@@ -2186,7 +2186,7 @@ CLASS zcl_demo_test IMPLEMENTATION.
"If you have such a use case, and deal with generic/dynamic types, note
"the general rules for typing in the ABAP Keyword Documentation.
- "A prior downcast (i.e. from the more generic type 'object' to the less
+ "A prior downcast (i.e. from the more general type 'object' to the less
"specific type zcl_demo_abap_objects) can be done. In this context, note
"that upcasts are possible (and implicitly done) when assigning the parameters,
"but downcasts must always be done explicitly, for example, using the CAST
@@ -2821,8 +2821,8 @@ CLASS zcl_some_class IMPLEMENTATION.
"... absolute name
CREATE DATA dyn_dobj TYPE (absolute_name).
dyn_dobj->* = type->*.
- "... type description object
+ "... type description object
CREATE DATA dyn_dobj TYPE HANDLE tab.
dyn_dobj->* = type->*.
INSERT |{ tabix } Dynamic data objects created, assignments done| INTO TABLE str_tab.
diff --git a/13_Program_Flow_Logic.md b/13_Program_Flow_Logic.md
index 2f70685..73a10bd 100644
--- a/13_Program_Flow_Logic.md
+++ b/13_Program_Flow_Logic.md
@@ -313,7 +313,7 @@ ENDIF.
- The conditional operator [`COND`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenconditional_expression_cond.htm) can also be used to implement branches in operand positions that are based on logical expressions.
- Such conditional expressions have a result that is dependent on the logical expressions.
-- The result's data type is specified after `COND` right before the first parenthesis. It can also be the `#` character as a symbol for the operand type if the type can be derived from the context. See the ABAP Keyword Documentation and the cheat sheet on constructor expressions for more information.
+- The result's data type is specified after `COND` right before the first parenthesis. It can also be the `#` character as a symbol for the operand type if the type can be derived from the context.
- All operands specified after `THEN` must be convertible to the result's data type.
- See also the [Constructor Expressions](05_Constructor_Expressions.md) cheat sheet for more information and examples.
@@ -641,7 +641,7 @@ DATA(func_name) = 'SOME_FUNCTION_MODULE_C'.
CALL FUNCTION func_name ...
-"For parmeters in a parameter table ,use the addition ... PARAMETER-TABLE ptab ...
+"For parameters in a parameter table, use the addition ... PARAMETER-TABLE ptab ...
"ptab: Sorted table of type abap_func_parmbind_tab (line type abap_func_parmbind)
"For exceptions, use the addition ... EXCEPTION-TABLE ...
DATA(ptab) = VALUE abap_func_parmbind_tab( ... ).
@@ -670,15 +670,15 @@ To get started quickly with copiable code snippets, you can proceed as follows.
- Make entries in the *Name* (e.g. `Z_DEMO_ABAP_TEST_FUNC_P`) and *Description Field* (e.g. *Demo function group*) fields, and choose *Next*.
- If prompted, select a transport request and choose *Finish*.
2. Create a function module.
- - In ADT, you can, for example, right-click the package in which you have created function pool.
+ - In ADT, you can, for example, right-click the package in which you have created the function pool.
- Choose *New -> Other ABAP Repository Object*.
- In the input field, enter *function*, select *ABAP Function Module*, and choose *Next*.
- Make entries in the *Name* (e.g. `Z_DEMO_ABAP_TEST_FUNC_M`), *Description Field* (e.g. *Demo function module*), and *Function Group* (e.g. the previously created `Z_DEMO_ABAP_TEST_FUNC_P`) fields and choose *Next*.
- If prompted, select a transport request and choose *Finish*.
- The function module is created and can be filled with an implementation.
- You can copy and paste the code below to have a sample implementation.
-3. To test the function module, you can create a class, for example, with the name `ZCL_DEMO_ABAP_FUNC_TEST`, and copy and paste the code below.
- - In ADT, you can run the class by choosing *F9*. Some output is displayed in the ADT console, demonstrating the result of the function module calls.
+3. To demonstrate the function module, you can create a class, for example, with the name `ZCL_DEMO_ABAP_FUNC_TEST`, and copy and paste the code below.
+ - In ADT, you can run the class by choosing *F9*. Some output is displayed in the ADT console, demonstrating the result of function module calls.
Code for the function module `Z_DEMO_ABAP_TEST_FUNC_M`:
@@ -735,8 +735,8 @@ ENDCLASS.
CLASS zcl_demo_abap_func_test IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
- "Handling class-based exception
- "For handling a possible wrong operator, you may want to implement
+ "Calling a function module
+ "For handling a possible wrong operator in the example, you may want to implement
"a separate exception. The simple example just catches calculation errors
"and uses a data object of type string for storing the calculation result.
DATA calculation_result TYPE string.
@@ -836,6 +836,359 @@ Special function modules exist in [Standard ABAP](https://help.sap.com/doc/abapd
- The newer background Processing Framework ([bgPF](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenbgpf_glosry.htm)) encapsulates bgRFC to execute time-consuming methods asynchronously. Find more information [here](https://help.sap.com/docs/abap-cloud/abap-concepts/background-processing-framework).
+**sRFC Example**
+
+Expand the collapsible section below to view descriptions and the code examples. The example includes two repository objects: a remote-enabled function module and a class. You can copy and paste the code examples into a demo class and demo function module in your system supporting classic ABAP. Run the class by choosing F9 in ADT.
+Note that it is a [nonsensical](./README.md#%EF%B8%8F-disclaimer) example designed for experimentation and exploration of syntax ⚠️.
+
+
+ Expand to view the details
+
+
+"Purpose":
+- Making synchronous RFC calls to an RFC-enabled function module and demonstrate the `CALL FUNCTION` syntax with the `DESTINATION` addition.
+- Checking if two random data objects can be assigned. The focus is on exploring various conversion rules when assigning values from a source data object to a target data object. If there is no conversion rule, meaning the two data objects are neither compatible nor convertible, an assignment cannot be performed. In many cases, an uncatchable exception is raised during the assignment, which is performed when executing the function module implementation.
+- The calling program is not terminated due to the "delegated check" to an RFC-enabled function module (however, a system message is displayed in ADT informing about the exception).
+- As a result of a method call (which includes a call to the RFC-enabled function module), it is determined whether ...
+ - the assignment of the source to the target object is possible at all, and if so, perform the assignment.
+ - the two data objects are type compliant (all the technical properties of the data objects' types are identical).
+ - a [lossless assignment](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenlossless_assignment_glosry.htm) is possible when assigning the source to the target data object.
+
+The example implementation is as follows:
+- A class contains declarations of several demo data objects. These data objects include elementary types such as `c`, `string`, `d`, `t`, `i`, as well as a structure and an internal table. They are assigned demo values, which are then used for further demo assignments.
+- When the class is run, an instance of the class is created initially.
+- All demo data objects are then assigned to each other, with the assignment being *delegated* to the remote-enabled function module. Note that many of these assignments are nonsensical, as the focus is on the function module call and exploring conversion rules.
+- The assignment check is performed as follows:
+ - The method responsible for the assignment check retrieves type information using RTTI. As a first step, it checks the type compatibility of the data objects, i.e. if they have identical technical properties.
+ - The actual assignment of the two data objects occurs in the remote-enabled function module:
+ - To enable this in the example implementation, the class has the interface `if_serializable_object` defined, which allows instances of the class to be serialized.
+ - The content of the two data objects is assigned to public instance attributes of the class.
+ - Then, the instance of the class is serialized using a `CALL TRANSFORMATION` statement.
+ - The remote-enabled function module is called using a `CALL FUNCTION ... DESTINATION 'NONE'` statement, with the instance of the class passed as a parameter. `'NONE'` is a predefined destination that indicates the remote function will run in the same system as the calling class.
+ - In the function module implementation, the instance of the class is deserialized, and the two data objects are assigned to each other. If the assignment is successful, the value `abap_true` is set for the `is_assignable` exporting parameter. If the assignment fails, an exception is raised, resulting in `is_assignable` remaining `abap_false`. Note that for certain assignments, exceptions cannot be caught. However, since the class calls the remote-enabled function module, the execution of the class is not terminated. Therefore, in cases where data objects are not assignable, you will receive notifications about runtime errors. If a runtime error occurs, the exception message is also returned and added to a structure containing information.
+- The structure returned by the check method in the class includes various pieces of information, such as whether the two data objects are are assignable at all, whether they are type compliant, or whether a lossless assignment is possible. When the two data objects are indeed assignable (based on the `is_assignable` flag returned by the function call), the two data objects are assigned once again in the method to add the assignment result to the information structure that is returned. The lossless assignment is also performed at this stage.
+
+Notes:
+- Running the example class will take some time to complete and display output in the console.
+- The feed reader in your ADT will display numerous error messages related to runtime errors triggered by invalid data object assignments when the example class is run.
+- For more information on the assignment results and conversion rules, see the topic [Assignment and Conversion Rules](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenconversion_rules.htm) in the ABAP Keyword Documentation.
+- Information about RFC in the [SAP Help Portal](https://help.sap.com/docs/ABAP_PLATFORM_NEW/753088fc00704d0a80e7fbd6803c8adb/4888068ad9134076e10000000a42189d.html?locale=en-US).
+- Examples of calling the example class (externally and separately):
+ ```abap
+ DATA a TYPE abap_boolean VALUE abap_true.
+ DATA b TYPE c LENGTH 1 VALUE 'Z'.
+ DATA(assignm_check1) = zcl_demo_abap_check_assignment=>get_instance( )->check_assignment(
+ source = b target = a comment = `c length 1 -> abap_boolean` ).
+
+ *ASSIGNM_CHECK1:
+ *IS_TYPE_COMPLIANT IS_EXACT_MOVE_POSSIBLE IS_ASSIGNABLE ASSIGNMENT_RESULT->* COMMENT
+ *X X X Z c length 1 -> abap_boolean
+
+ DATA c TYPE string VALUE `hallo`.
+ DATA(d) = VALUE string_table( ( `X` ) ).
+ "An exception is raised in the function module for the nonsensical assignment.
+ DATA(assignm_check2) = zcl_demo_abap_check_assignment=>get_instance( )->check_assignment(
+ source = c target = d comment = `string -> internal table` ).
+
+ *ASSIGNM_CHECK2:
+ *IS_TYPE_COMPLIANT IS_EXACT_MOVE_POSSIBLE IS_ASSIGNABLE ASSIGNMENT_RESULT->* COMMENT
+ * initial reference string -> internal table (Error: Conversion of type STRING to type STRING_TABLE not supported.)
+ ```
+
+To check the example, follow these steps in your system that supports classic ABAP:
+
+- Create a demo class named `ZCL_DEMO_ABAP_CHECK_ASSIGNMENT` and insert the provided example code.
+- Create a function module named `Z_DEMO_ABAP_ASSIGNM_CHECK_FM` (for example, as part of function pool `Z_DEMO_ABAP_TEST_FUNC_P` - *ABAP Function Group* in ADT; refer to the function module example for details).
+ - In ADT, right-click within the code and select *Open With -> SAP GUI* to open the Function Builder in SAP GUI.
+ - In the Function Builder, select *Display <-> Change* (CTRL + F1) to enable modification.
+ - Go to the *Attributes* tab and check the *Remote-Enabled Module* checkbox.
+ - Select *Activate* (CTRL + F3). Take note of the security aspects related to remote-enabled function modules that can be called from outside SAP systems. Also, refer to the disclaimer in the repository's *README*. The example is only meant to illustrate the syntax functionality.
+ - Close the tab.
+ - Insert the provided example code into the function module.
+- After activation, press *F9* in ADT to execute the class. The example is designed to display output in the console.
+- Running the example class may take some time to complete and display the content. You will see multiple runtime error notifications in ADT (also check the Feed Reader tab in ADT) due to impossible assignments.
+
+
+Example code of the class:
+```abap
+CLASS zcl_demo_abap_check_assignment DEFINITION
+ PUBLIC
+ FINAL
+ CREATE PUBLIC .
+
+ PUBLIC SECTION.
+ INTERFACES: if_oo_adt_classrun,
+ if_serializable_object.
+ DATA target TYPE REF TO data.
+ DATA source TYPE REF TO data.
+
+ TYPES: BEGIN OF type_check_str,
+ is_type_compliant TYPE abap_boolean,
+ is_exact_move_possible TYPE abap_boolean,
+ is_assignable TYPE abap_boolean,
+ assignment_result TYPE REF TO data,
+ comment TYPE string,
+ END OF type_check_str.
+
+ CLASS-METHODS: get_instance RETURNING VALUE(ref) TYPE REF TO zcl_demo_abap_check_assignment.
+ METHODS: check_assignment IMPORTING target TYPE any
+ source TYPE any
+ comment TYPE string OPTIONAL
+ RETURNING VALUE(check_result) TYPE type_check_str.
+ PROTECTED SECTION.
+ PRIVATE SECTION.
+
+ METHODS:
+ "The following method can only have output parameters.
+ "For each output parameter of the serialize_helper method, you must specify
+ "an identically named input parameter of the deserialize_helper method
+ "with the same type.
+ serialize_helper EXPORTING target TYPE REF TO data
+ source TYPE REF TO data,
+ "This method can only have input parameters.
+ deserialize_helper IMPORTING target TYPE REF TO data
+ source TYPE REF TO data.
+
+ENDCLASS.
+
+
+
+CLASS zcl_demo_abap_check_assignment IMPLEMENTATION.
+ METHOD if_oo_adt_classrun~main.
+
+ DATA(oref) = zcl_demo_abap_check_assignment=>get_instance( ).
+
+ "Example data objects
+ "--- Elementary types ---
+ DATA a TYPE abap_boolean VALUE 'X'.
+ DATA b TYPE c LENGTH 1 VALUE 'Y'.
+ DATA c TYPE c LENGTH 3 VALUE '123'.
+ DATA d TYPE c LENGTH 5 VALUE 'vwxy1'.
+ DATA e TYPE n LENGTH 4 VALUE '9876'.
+ DATA f TYPE string VALUE `hallo`.
+ DATA g TYPE d VALUE '20240101'.
+ DATA h TYPE t VALUE '123456'.
+ DATA i TYPE i VALUE 99.
+ DATA j TYPE p LENGTH 8 DECIMALS 2 VALUE '8.91'.
+
+ "--- Structure ---
+ TYPES: BEGIN OF s,
+ a TYPE c LENGTH 3,
+ b TYPE c LENGTH 3,
+ END OF s.
+ DATA k TYPE s.
+ k = VALUE #( a = 'abc' b = 'def' ).
+
+ "--- Internal table ---
+ DATA l TYPE string_table.
+ l = VALUE #( ( `abc` ) ).
+
+ TYPES: BEGIN OF st,
+ ref TYPE REF TO data,
+ comment TYPE string,
+ END OF st.
+
+ DATA itab TYPE TABLE OF st WITH EMPTY KEY.
+ itab = VALUE #( ( ref = REF #( a ) comment = `abap_boolean` )
+ ( ref = REF #( b ) comment = `c LENGTH 1` )
+ ( ref = REF #( c ) comment = `c LENGTH 3` )
+ ( ref = REF #( d ) comment = `c LENGTH 5` )
+ ( ref = REF #( e ) comment = `n LENGTH 4` )
+ ( ref = REF #( f ) comment = `string` )
+ ( ref = REF #( g ) comment = `d` )
+ ( ref = REF #( h ) comment = `t` )
+ ( ref = REF #( i ) comment = `i` )
+ ( ref = REF #( j ) comment = `p LENGTH 8 DECIMALS 2` )
+ ( ref = REF #( k ) comment = `structure (2 components of type c)` )
+ ( ref = REF #( l ) comment = `string table` )
+ ).
+
+ DATA itab2 LIKE itab.
+ itab2 = itab.
+
+ DATA itab_res TYPE TABLE OF zcl_demo_abap_check_assignment=>type_check_str.
+ LOOP AT itab INTO DATA(wa_1).
+ DATA(tabix1) = sy-tabix.
+ LOOP AT itab2 INTO DATA(wa_2).
+ DATA(tabix2) = sy-tabix.
+ IF tabix1 <> tabix2.
+ "Method call for the actual assignment check
+ "Note: 'target' means the value on the left-hand side of an assignment, 'source' is the
+ "data object specified on the right-hand side (target = source.).
+ DATA(res) = oref->check_assignment( target = wa_1-ref->* source = wa_2-ref->* comment = |{ tabix1 }: { wa_2-comment } -> { wa_1-comment }| ).
+ APPEND res TO itab_res.
+ ENDIF.
+ ENDLOOP.
+ ENDLOOP.
+ out->write( itab_res ).
+ ENDMETHOD.
+
+ METHOD deserialize_helper.
+ me->target = target.
+ me->source = source.
+ ENDMETHOD.
+
+ METHOD serialize_helper.
+ target = me->target.
+ source = me->source.
+ ENDMETHOD.
+
+ METHOD get_instance.
+ ref = NEW #( ).
+ ENDMETHOD.
+
+ METHOD check_assignment.
+ "The returning parameter of this method is a structure that
+ "contains information about the assignment. Throughout the
+ "method implementation, the structure's components are populated
+ "with various pieces of information.
+ check_result-comment = comment.
+
+ "Getting type description objects for checking type compliance (i.e.
+ "whether the type properties are identical)
+ "The example is designed to work only with elementary, structured and
+ "table types.
+ DATA(tdo1) = cl_abap_typedescr=>describe_by_data( target ).
+ DATA(tdo2) = cl_abap_typedescr=>describe_by_data( source ).
+
+ IF tdo1 IS INSTANCE OF cl_abap_refdescr
+ OR tdo2 IS INSTANCE OF cl_abap_refdescr
+ OR tdo1 IS INSTANCE OF cl_abap_enumdescr
+ OR tdo2 IS INSTANCE OF cl_abap_enumdescr.
+ check_result-comment = `The example implementation is designed to only work with elementary, structured and table types.`.
+ RETURN.
+ ENDIF.
+
+ "Checking type compliance
+ CASE TYPE OF tdo1.
+ WHEN TYPE cl_abap_elemdescr.
+ DATA(applies_to) = CAST cl_abap_elemdescr( tdo1 )->applies_to_data( source ).
+ WHEN TYPE cl_abap_structdescr.
+ applies_to = CAST cl_abap_structdescr( tdo1 )->applies_to_data( source ).
+ WHEN TYPE cl_abap_tabledescr.
+ applies_to = CAST cl_abap_tabledescr( tdo1 )->applies_to_data( source ).
+ WHEN OTHERS.
+ check_result-comment = `The example implementation is designed to only work with elementary, structured and table types.`.
+ RETURN.
+ ENDCASE.
+
+ check_result-is_type_compliant = applies_to.
+
+ "Assigning the passed values to the public instance attributes
+ CREATE DATA me->target LIKE target.
+ CREATE DATA me->source LIKE source.
+ me->target->* = target.
+ me->source->* = source.
+
+ "Serializing the instance
+ DATA xml TYPE xstring.
+ TRY.
+ CALL TRANSFORMATION id SOURCE oref = me
+ RESULT XML xml.
+ CATCH cx_xslt_serialization_error INTO DATA(tr_err).
+ check_result-comment = |Transformation error: { tr_err->get_text( ) }|.
+ RETURN.
+ ENDTRY.
+
+ "Calling RFC-enabled function module
+ "In the function module, the instance is deserialized, and one
+ "public instance attribute is assigned to the other. If the
+ "assignment is successful, the value of 'is_assignable' is 'X'
+ "because the assignment to the parameter happens after the
+ "actual assignment. If the assignment does not work, and an
+ "exception is raised, the 'is_assignable' value assignment
+ "is not reached in the function module implementation, and
+ "remains initial. Note that not all exceptions that are
+ "raised by assignments are catchable - which is the purpose
+ "of this example: Avoiding a termination of the executed class.
+ "In case of an assignment error, the 'msg' variable is populated
+ "with an error message. This message is added to the structure
+ "containing information about the assignment.
+ DATA msg TYPE c LENGTH 255.
+ DATA is_assignable TYPE abap_boolean.
+ CALL FUNCTION 'Z_DEMO_ABAP_ASSIGNM_CHECK_FM'
+ DESTINATION 'NONE'
+ EXPORTING
+ serialized_obj = xml
+ IMPORTING
+ is_assignable = is_assignable
+ EXCEPTIONS
+ system_failure = 1 MESSAGE msg
+ communication_failure = 2 MESSAGE msg
+ OTHERS = 3.
+
+ IF sy-subrc <> 0.
+ check_result-comment = check_result-comment && ` (Error: ` && msg && `)`.
+ ENDIF.
+
+ "Performing further assignments if there is no runtime error
+ "in the function module
+ IF is_assignable = abap_true.
+ check_result-is_assignable = abap_true.
+
+ "Since the assignment indeed works (as checked in the function
+ "module), performing the assignment. The result of the
+ "assignment is added to the information structure.
+ me->target->* = me->source->*.
+
+ check_result-assignment_result = me->target.
+
+ "Checking whether a lossless assignment is possible
+ "In this case, an assignment is only made if no values are lost.
+ "Otherwise, an error occurs.
+ "Example:
+ "- There are two data objects: A is of type c length 1, B having type c 3
+ "- An exact move of A to B is possible as no values are lost.
+ " However, an exact move of B to A is not possible. There are
+ " more characters. A 'regular' assignment (e.g. just A = B) would
+ " work even though. The overlapping characters are truncated in this case.
+ TRY.
+ me->target->* = EXACT #( me->source->* ).
+ check_result-is_exact_move_possible = abap_true.
+ CATCH cx_root.
+ check_result-is_exact_move_possible = abap_false.
+ ENDTRY.
+ ENDIF.
+ ENDMETHOD.
+ENDCLASS.
+```
+
+Example code for the function module:
+```abap
+FUNCTION z_demo_abap_assignm_check_fm
+ IMPORTING
+ VALUE(serialized_obj) TYPE xstring
+ EXPORTING
+ VALUE(is_assignable) TYPE abap_boolean.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DATA deserialized_oref TYPE REF TO zcl_demo_abap_check_assignment.
+ CALL TRANSFORMATION id SOURCE XML serialized_obj
+ RESULT oref = deserialized_oref.
+
+ deserialized_oref->target->* = deserialized_oref->source->*.
+
+ "If the prvious assignment does not work, the exeuction is terminated, and the
+ "following assignment is not done, i.e. is_assignable remains abap_false.
+ is_assignable = abap_true.
+
+ENDFUNCTION.
+```
+
+
+
⬆️ back to top
### Subroutines in Standard ABAP
diff --git a/21_XML_JSON.md b/21_XML_JSON.md
index c2b8327..8c59762 100644
--- a/21_XML_JSON.md
+++ b/21_XML_JSON.md
@@ -414,13 +414,14 @@ Possible transformations, some of which are covered in the example:
| ABAP <-> ABAP | X | - |
> **💡 Note**
-> asXML:
-> - *ABAP Serialization XML*
-> - Describes a format of XML data created when serializing ABAP data (ABAP -> XML) with the identity transformation
-> - This format is a prerequisite for deserializations (XML -> ABAP) using identity transformations.
-> - Used as an intermediate format that defines a mapping between ABAP data and XML
-> - Therefore, if you want to deserialize XML data in ABAP, you must first transform it to the asXML format.
-> Make sure that you use appropriate exception classes for potential errors in transformations. See the section [Catchable Exceptions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapcall_transformation.htm) in the `CALL TRANSFORMATION` topic.
+> - asXML:
+> - *ABAP Serialization XML*
+> - Describes a format of XML data created when serializing ABAP data (ABAP -> XML) with the identity transformation
+> - This format is a prerequisite for deserializations (XML -> ABAP) using identity transformations.
+> - Used as an intermediate format that defines a mapping between ABAP data and XML
+> - Therefore, if you want to deserialize XML data in ABAP, you must first transform it to the asXML format.
+> - Make sure that you use appropriate exception classes for potential errors in transformations. See the section [Catchable Exceptions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapcall_transformation.htm) in the `CALL TRANSFORMATION` topic.
+> - For serializing instances of classes, find more information [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenasxml_class_instances.htm) in the ABAP Keyword Documentation. The classes must implement the `IF_SERIALIZABLE_OBJECT` interface (find a demo in the executable example).
⬆️ back to top
diff --git a/22_Misc_ABAP_Classes.md b/22_Misc_ABAP_Classes.md
index 247d88b..56a102c 100644
--- a/22_Misc_ABAP_Classes.md
+++ b/22_Misc_ABAP_Classes.md
@@ -3,7 +3,7 @@
# Misc ABAP Classes
- [Misc ABAP Classes](#misc-abap-classes)
- - [Excursion: Available Classes in ABAP Cloud](#excursion-available-classes-in-abap-cloud)
+ - [Excursion: Available Classes in ABAP for Cloud Development](#excursion-available-classes-in-abap-for-cloud-development)
- [Creating UUIDs](#creating-uuids)
- [Displaying Output in the ADT Console](#displaying-output-in-the-adt-console)
- [RAP](#rap)
@@ -39,7 +39,7 @@ This ABAP cheat sheet contains a selection of available ABAP classes, serving as
> - In the cheat sheet, the focus is on a selected set of classes that are available in [ABAP for Cloud Development](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_for_cloud_dev_glosry.htm).
> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer)
-## Excursion: Available Classes in ABAP Cloud
+## Excursion: Available Classes in ABAP for Cloud Development
If available to you, you have accessed an [SAP BTP ABAP Environment](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensap_btp_abap_env_glosry.htm) using the [ABAP development tools for Eclipse (ADT)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenadt_glosry.htm).
Access to SAP-provided repository objects is restricted to objects that have been released for [ABAP for Cloud Development](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_for_cloud_dev_glosry.htm) ([released APIs](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenreleased_api_glosry.htm)). You can find the released repository objects in the *Project Explorer* view in ADT under *Released Objects*. The classes are located in the *Source Code Library* folder:
diff --git a/23_Date_and_Time.md b/23_Date_and_Time.md
index 30e00f4..80e9439 100644
--- a/23_Date_and_Time.md
+++ b/23_Date_and_Time.md
@@ -1251,8 +1251,8 @@ INTO @DATA(wa).
## More Information
-- [Date and Time Processing](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abendate_time_processing.htm)
-- In [ABAP for Cloud Development](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_for_cloud_dev_glosry.htm), do not use the date and time-related system fields such as `sy-datum`, `sy-uzeit`, `sy-timlo`, and `sy-datlo`.
+[Date and Time Processing](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abendate_time_processing.htm) in the ABAP Keyword Documentation.
+
⬆️ back to top
diff --git a/README.md b/README.md
index 4e5e471..081618f 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,12 @@ ABAP cheat sheets[^1] ...
- provide a **collection of information on selected ABAP topics** in a nutshell for your reference.
- focus on **ABAP syntax**.
- include **code snippets**.
-- are supported by easy-to-consume **demonstration examples** that you can import into your [SAP BTP ABAP environment](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensap_btp_abap_env_glosry.htm) (*main* branch; ABAP language version: [ABAP for Cloud Development](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_for_cloud_dev_glosry.htm)) or your system supporting [classic ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclassic_abap_glosry.htm) (the repository branches other than *main*; ABAP language version: [Standard ABAP](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenstandard_abap_glosry.htm)) using [abapGit](https://abapgit.org/) to run and check out ABAP syntax in action in simple contexts.
+- are supported by easy-to-consume **demonstration examples** that you can import into your system using [abapGit](https://abapgit.org/) to run and check out ABAP syntax in action in simple contexts:
+ | Environment | Branch | ABAP language version |
+ | -------- | ------- | ------- |
+ | [SAP BTP ABAP environment](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensap_btp_abap_env_glosry.htm) | *main* branch | [ABAP for Cloud Development](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_for_cloud_dev_glosry.htm) |
+ | System that supports [classic ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclassic_abap_glosry.htm) | The repository branches other than *main*. Check the available ABAP releases. |[Standard ABAP](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenstandard_abap_glosry.htm) |
+
- are enriched by links to glossary entries and chapters of the **ABAP Keyword Documentation** (the *F1 help*) and more for you to deep dive into the respective ABAP topics and get more comprehensive information.
@@ -46,6 +51,7 @@ ABAP cheat sheets[^1] ...
- [Here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrestricted_abap_elements.htm) is an overview of the different ABAP language elements in the different ABAP versions, i.e. what is allowed in ABAP Cloud and what is not. See also the released APIs [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenreleased_apis.htm).
- 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 educate, explain, and provide context directly where it is needed. In some cases, they illustrate the results of ABAP statements.