From 4c0fd846e5838cfd7cc7f805237bbeaff239fd31 Mon Sep 17 00:00:00 2001 From: danrega <16720986+danrega@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:41:34 +0200 Subject: [PATCH] Update --- 03_ABAP_SQL.md | 29 ++++--- 06_Dynamic_Programming.md | 4 +- 15_CDS_View_Entities.md | 7 +- 21_XML_JSON.md | 174 ++++++++++++++++++++++++++++---------- 22_Misc_ABAP_Classes.md | 4 +- 5 files changed, 156 insertions(+), 62 deletions(-) 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
-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 -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). +##### 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 -##### 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.