diff --git a/03_ABAP_SQL.md b/03_ABAP_SQL.md
index 17db4c3..e46c4b6 100644
--- a/03_ABAP_SQL.md
+++ b/03_ABAP_SQL.md
@@ -14,8 +14,11 @@
- [SQL Operands](#sql-operands)
- [SQL Expressions](#sql-expressions)
- [Elementary Expressions](#elementary-expressions)
- - [SQL Functions](#sql-functions)
- - [More SQL Expressions](#more-sql-expressions)
+ - [Numeric Functions](#numeric-functions)
+ - [String Functions](#string-functions)
+ - [Special Functions](#special-functions)
+ - [Aggregate Expressions](#aggregate-expressions)
+ - [Arithmetic, Cast, String Expressions, and Case Distinctions](#arithmetic-cast-string-expressions-and-case-distinctions)
- [Window Expressions](#window-expressions)
- [SQL Conditions](#sql-conditions)
- [Selecting Data by Evaluating the Content of Other Tables](#selecting-data-by-evaluating-the-content-of-other-tables)
@@ -623,6 +626,7 @@ SELECT FROM zdemo_abap_flsch
on SQL expressions
[here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapsql_expr.htm)
and the subtopics there.
+- Built-in functions are available in ABAP SQL. The result is a value with the associated dictionary type. The arguments of the functions can cover one or more SQL expressions. Find more information [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_sql_builtin_functions.htm).
##### Elementary Expressions
@@ -634,15 +638,10 @@ SELECT FROM zdemo_abap_flsch
- See more information
[here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensql_elem.htm).
-##### SQL Functions
+##### Numeric Functions
-- You can use built-in functions in ABAP SQL.
-- Result: Value with the associated dictionary type.
-- Arguments of the functions: Cover one or more SQL expressions.
-- See more information
- [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_sql_builtin_functions.htm).
+[Numeric functions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensql_arith_func.htm)
-Example: [Numeric functions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensql_arith_func.htm)
``` abap
SELECT SINGLE
carrname,
@@ -683,7 +682,9 @@ SELECT SINGLE
⬆️ back to top
-Example: [String functions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensql_string_func.htm)
+##### String Functions
+
+[String functions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensql_string_func.htm)
``` abap
SELECT SINGLE
@@ -804,7 +805,9 @@ SELECT SINGLE
⬆️ back to top
-Example: [Special functions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_sql_special_functions.htm)
+##### Special Functions
+
+[Special functions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_sql_special_functions.htm)
``` abap
SELECT SINGLE
@@ -855,6 +858,8 @@ INTO @DATA(special_functions).
⬆️ back to top
+##### Aggregate Expressions
+
[Aggregate expressions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_aggregate.htm)
- Consist of [aggregate
@@ -903,7 +908,7 @@ SELECT
⬆️ back to top
-##### More SQL Expressions
+##### Arithmetic, Cast, String Expressions, and Case Distinctions
- [Arithmetic
expressions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensql_arith.htm)
diff --git a/06_Dynamic_Programming.md b/06_Dynamic_Programming.md
index 5a16641..805753b 100644
--- a/06_Dynamic_Programming.md
+++ b/06_Dynamic_Programming.md
@@ -582,13 +582,13 @@ is required to access objects and their components. That means objects are not d
- Using [`CREATE OBJECT`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapcreate_object.htm) statements, you can create an object as an instance of a class and assign the reference to the object to an [object reference variable](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenobject_refer_variable_glosry.htm).
- The instance operator [`NEW`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenconstructor_expression_new.htm) basically replaces `CREATE OBJECT` statements.
- However, `CREATE OBJECT` statements are still required and they are the only option for creating objects dynamically (`NEW` is not possible in that context) as shown further down.
-- Note the use of the built-in generic ABAP type `object` (`TYPE REF TO object`) that is used for the generic typing of object references. It is for any object type. `object` stands for the root class of the inheritance hierarchy. More information: [Generic ABAP Types](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenbuilt_in_types_generic.htm)
+- In the example, note the the built-in generic ABAP type `object` (`TYPE REF TO object`) that is used for the generic typing of object references. It is for any object type. `object` stands for the root class of the inheritance hierarchy. More information: [Generic ABAP Types](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenbuilt_in_types_generic.htm)
- Find more information in the [ABAP Keyword Documentation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapcreate_object.htm) and the [ABAP Object Orientation](04_ABAP_Object_Orientation.md) cheat sheet
```abap
DATA oref_a TYPE REF TO zcl_some_class.
oref_a = NEW #( ).
-"Using Inline declaration
+"Using inline declaration
DATA(oref_b) = NEW zcl_some_class( ).
"Generic type
DATA oref_c TYPE REF TO object.
diff --git a/15_CDS_View_Entities.md b/15_CDS_View_Entities.md
index f5691ba..54c3c50 100644
--- a/15_CDS_View_Entities.md
+++ b/15_CDS_View_Entities.md
@@ -43,11 +43,14 @@ The following links take you to the source code of the cheat sheet artifacts to
## More Information
+- [ABAP Data Models Guide](https://help.sap.com/docs/abap-cloud/abap-data-models/abap-data-models)
+- [ABAP Core Data Services in the ABAP Keyword Documentation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds.htm)
+- [ABAP CDS Development Tools: User Guide](https://help.sap.com/docs/abap-cloud/abap-cds-tools-user-guide/about-abap-cds-development-tools-user-guide?version=sap_btp)
+- [ABAP CDS Feature Tables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_language_elements.htm)
+- [ABAP CDS Glossary](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_glossary.htm)
- Blogs:
- [Feature Matrix: Data Modeling with ABAP Core Data Services](https://blogs.sap.com/2022/10/24/feature-matrix-data-modeling-with-abap-core-data-services/)
- [ABAP CDS Cheat Sheet: Amounts and Quantities in ABAP CDS](https://blogs.sap.com/2022/07/07/abap-cds-cheat-sheet-amounts-and-quantities-in-abap-cds/)
- - [ABAP Data Models Guide](https://blogs.sap.com/2023/05/09/abap-data-models-guide/) (includes a link to the guide on the SAP Help Portal)
-- ABAP Keyword Documentation: [ABAP - Core Data Services (ABAP CDS)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds.htm)
## Executable Example
diff --git a/21_XML_JSON.md b/21_XML_JSON.md
index 185ba5e..e5f2b61 100644
--- a/21_XML_JSON.md
+++ b/21_XML_JSON.md
@@ -11,7 +11,7 @@
- [CALL TRANSFORMATION Syntax](#call-transformation-syntax)
- [Working with JSON](#working-with-json)
- [Excursions](#excursions)
- - [Serializing and Deserializing Instances of Classes](#serializing-and-deserializing-instances-of-classes)
+ - [Serializing and Deserializing Objects](#serializing-and-deserializing-objects)
- [Converting string \<-\> xstring](#converting-string---xstring)
- [Compressing and Decompressing Binary Data](#compressing-and-decompressing-binary-data)
- [More Information](#more-information)
@@ -676,19 +676,110 @@ xco_cp_json=>data->from_string( json_created_xco )->apply( VALUE #(
## Excursions
-### Serializing and Deserializing Instances of Classes
+### Serializing and Deserializing Objects
-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.
+- To serialize and deserialize objects (i.e. instances of classes), you can use `CALL TRANSFORMATION` statements. As a prerequisite, the classes must implement the `IF_SERIALIZABLE_OBJECT` interface.
+- Find more information and examples [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.
-Expand the following collapsible section to view the code of an example. To try it out, create a demo class named `zcl_some_class` and paste the code into it. After activation, choose *F9* in ADT to execute the class. This example is set up to display the results in the console.
+
+Expand the following collapsible section to view the code of two simplified examples. To try them out, create a demo class named `zcl_some_class` and paste the code into it. After activation, choose *F9* in ADT to execute the class. The examples are set up to display output in the console.
Expand to view the details
-When running the class, three instances of this class are created, and two instance attributes are assigned values for output purposes. The current UTC timestamp
-and a random number are retrieved and assigned. Then, the instances are serialized.
-The instances are deserialized again, and the instance attributes are accessed. Their values are stored in an internal table, which is then displayed.
+- When the class runs, it creates three instances, and three instance attributes are assigned values for each instance: the current UTC timestamp, a random number, and a UUID.
+- These instances are then serialized and subsequently deserialized.
+- The instance attributes are accessed, and their values are stored in an internal table and displayed.
+
+
+**Example 1:**
+
+- The example class implements the `IF_SERIALIZABLE_OBJECT` interface, using the standard behavior to serialize and deserialize all instance attributes (i.e. the helper methods mentioned below are not implemented).
+- The values of of all deserialized instance attributes are displayed.
+
+```abap
+CLASS zcl_some_class DEFINITION
+ PUBLIC
+ FINAL
+ CREATE PUBLIC .
+
+ PUBLIC SECTION.
+ INTERFACES: if_oo_adt_classrun,
+ if_serializable_object.
+ PROTECTED SECTION.
+ PRIVATE SECTION.
+ DATA timestamp TYPE utclong.
+ DATA random_number TYPE i.
+ DATA uuid TYPE sysuuid_x16.
+
+ENDCLASS.
+
+
+
+CLASS zcl_some_class IMPLEMENTATION.
+
+ METHOD if_oo_adt_classrun~main.
+
+ DATA serialized_obj_tab TYPE string_table.
+ TYPES: BEGIN OF deserialized_obj_struc,
+ timestamp TYPE utclong,
+ random_number TYPE i,
+ uuid TYPE sysuuid_x16,
+ END OF deserialized_obj_struc.
+ DATA deserialized_obj_tab TYPE TABLE OF deserialized_obj_struc WITH EMPTY KEY.
+
+ "Creating objects, assigning values to instance attributes, and serializing objects
+ DO 3 TIMES.
+ DATA(oref) = NEW zcl_some_class( ).
+ oref->timestamp = utclong_current( ).
+ oref->random_number = cl_abap_random_int=>create( seed = cl_abap_random=>seed( )
+ min = 1
+ max = 100 )->get_next( ).
+
+ TRY.
+ oref->uuid = cl_system_uuid=>create_uuid_x16_static( ) .
+ CATCH cx_uuid_error.
+ ENDTRY.
+
+ DATA serialized_obj TYPE string.
+ CALL TRANSFORMATION id SOURCE obj = oref
+ RESULT XML serialized_obj.
+
+ APPEND serialized_obj TO serialized_obj_tab.
+ ENDDO.
+
+ "Deserializing objects
+ LOOP AT serialized_obj_tab INTO DATA(wa).
+ DATA deserialized_obj TYPE REF TO zcl_some_class.
+ CALL TRANSFORMATION id SOURCE XML wa
+ RESULT obj = deserialized_obj.
+
+ "Addressing instance attributes after deserialization
+ DATA(deserialized_timestamp) = deserialized_obj->timestamp.
+ DATA(deserialized_random_number) = deserialized_obj->random_number.
+ DATA(deserialized_uuid) = deserialized_obj->uuid.
+
+ "Adding deserialized instance attribute values to an internal table
+ APPEND VALUE #( timestamp = deserialized_timestamp
+ random_number = deserialized_random_number
+ uuid = deserialized_uuid
+ ) TO deserialized_obj_tab.
+ ENDLOOP.
+
+ out->write( deserialized_obj_tab ).
+ ENDMETHOD.
+
+ENDCLASS.
+```
+
+**Example 2:**
+
+- The example class implements the `IF_SERIALIZABLE_OBJECT` interface, along with the `SERIALIZE_HELPER` and `DESERIALIZE_HELPER` methods.
+- These methods allow you to modify the standard behavior. Both methods must be implemented together, or not at all. If neither is implemented, the standard behavior applies.
+- The methods must be declared as private instance methods. The `SERIALIZE_HELPER` method only has output parameters, while `DESERIALIZE_HELPER` only has input parameters. Any parameter specified for the `SERIALIZE_HELPER` method must have an identically named and typed parameter in the `DESERIALIZE_HELPER` method.
+- For example, you can implement these methods if you want to exclude certain attributes from (de)serialization.
+- In the given example, one of the instance attributes is excluded from (de)serialization. As a result, the output only includes initial values for one of the attributes.
```abap
@@ -699,32 +790,19 @@ CLASS zcl_some_class DEFINITION
PUBLIC SECTION.
INTERFACES: if_oo_adt_classrun,
- if_serializable_object.
+ if_serializable_object.
PROTECTED SECTION.
PRIVATE SECTION.
-
DATA timestamp TYPE utclong.
DATA random_number TYPE i.
- DATA serialized_obj_tab TYPE TABLE OF xstring WITH EMPTY KEY.
-
- TYPES: BEGIN OF deserialized_obj_struc,
- timestamp TYPE utclong,
- random_number TYPE i,
- END OF deserialized_obj_struc.
- DATA deserialized_obj_tab TYPE TABLE OF deserialized_obj_struc WITH EMPTY KEY.
+ DATA uuid TYPE sysuuid_x16.
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.
- "The example uses two instance attributes that are specified in the private
- "visibility section.
serialize_helper EXPORTING timestamp TYPE utclong
random_number TYPE i,
- "This method can only have input parameters.
deserialize_helper IMPORTING timestamp TYPE utclong
random_number TYPE i.
+
ENDCLASS.
@@ -733,11 +811,15 @@ CLASS zcl_some_class IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
- "For demonstration purposes, 3 instances of the class are created and serialized.
- "Two instance attributes are assigned values for output purposes (the current UTC timestamp
- "and a random number are retrieved and assigned). The assigned values are also serialized and
- "can be addressed after deserialization. The serialized instances of the class are added to an
- "internal table which is processed below.
+ DATA serialized_obj_tab TYPE string_table.
+ TYPES: BEGIN OF deserialized_obj_struc,
+ timestamp TYPE utclong,
+ random_number TYPE i,
+ uuid TYPE sysuuid_x16,
+ END OF deserialized_obj_struc.
+ DATA deserialized_obj_tab TYPE TABLE OF deserialized_obj_struc WITH EMPTY KEY.
+
+ "Creating objects, assigning values to instance attributes, and serializing objects
DO 3 TIMES.
DATA(oref) = NEW zcl_some_class( ).
oref->timestamp = utclong_current( ).
@@ -745,47 +827,51 @@ CLASS zcl_some_class IMPLEMENTATION.
min = 1
max = 100 )->get_next( ).
- DATA serialized_obj TYPE xstring.
+ TRY.
+ oref->uuid = cl_system_uuid=>create_uuid_x16_static( ) .
+ CATCH cx_uuid_error.
+ ENDTRY.
+
+ DATA serialized_obj TYPE string.
CALL TRANSFORMATION id SOURCE obj = oref
RESULT XML serialized_obj.
APPEND serialized_obj TO serialized_obj_tab.
ENDDO.
- "Deserializing instances of classes from above
- "For output purposes, the values of the instance attributes are added to an
- "internal table.
+ "Deserializing objects
LOOP AT serialized_obj_tab INTO DATA(wa).
- DATA deserialized_oref TYPE REF TO zcl_some_class.
+ DATA deserialized_obj TYPE REF TO zcl_some_class.
CALL TRANSFORMATION id SOURCE XML wa
- RESULT obj = deserialized_oref.
+ RESULT obj = deserialized_obj.
"Addressing instance attributes after deserialization
- DATA(deserialized_timestamp) = deserialized_oref->timestamp.
- DATA(deserialized_random_number) = deserialized_oref->random_number.
+ DATA(deserialized_timestamp) = deserialized_obj->timestamp.
+ DATA(deserialized_random_number) = deserialized_obj->random_number.
+ DATA(deserialized_uuid) = deserialized_obj->uuid.
+ "Adding deserialized instance attribute values to an internal table
APPEND VALUE #( timestamp = deserialized_timestamp
random_number = deserialized_random_number
+ uuid = deserialized_uuid
) TO deserialized_obj_tab.
ENDLOOP.
- "The output is intended to visualize the deserialized instance of a class
- "and the values of its instance attributes that should differ from line to
- "line.
out->write( deserialized_obj_tab ).
ENDMETHOD.
+ METHOD serialize_helper.
+ timestamp = me->timestamp.
+ random_number = me->random_number.
+ ENDMETHOD.
+
METHOD deserialize_helper.
me->timestamp = timestamp.
me->random_number = random_number.
ENDMETHOD.
- METHOD serialize_helper.
- timestamp = me->timestamp.
- random_number = me->random_number.
- ENDMETHOD.
ENDCLASS.
-```
+```
diff --git a/22_Misc_ABAP_Classes.md b/22_Misc_ABAP_Classes.md
index 5fcfce1..39d5cfc 100644
--- a/22_Misc_ABAP_Classes.md
+++ b/22_Misc_ABAP_Classes.md
@@ -841,7 +841,7 @@ ENDIF.
## Time and Date
> **💡 Note**
-> 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` and `sy-uzeit`, and others. User-related time and date values (such as `sy-timlo` and `sy-datlo`) can be retrieved using the XCO library. For code snippets, see the [Date, Time, and Time Stamp](23_Date_and_Time.md) cheat sheet.
+> 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` and `sy-uzeit`, and others. User-related time and date values can be retrieved using the XCO library. For code snippets, see the [Date, Time, and Time Stamp](23_Date_and_Time.md) cheat sheet.
@@ -1363,7 +1363,7 @@ CLASS zcl_demo_test IMPLEMENTATION.
out->write( comp_res3 ).
ENDIF.
CATCH cx_abap_diff INTO DATA(error3).
- out->write( error2->get_text( ) ).
+ out->write( error3->get_text( ) ).
ENDTRY.
ENDMETHOD.
ENDCLASS.