From d3b02d3e9b0000d8a9dfde2253e63643e2edfb09 Mon Sep 17 00:00:00 2001
From: danrega <16720986+danrega@users.noreply.github.com>
Date: Fri, 8 Dec 2023 13:30:43 +0100
Subject: [PATCH] Update
---
01_Internal_Tables.md | 5 +-
02_Structures.md | 11 +++-
03_ABAP_SQL.md | 9 ++-
04_ABAP_Object_Orientation.md | 11 +++-
05_Constructor_Expressions.md | 4 +-
06_Dynamic_Programming.md | 9 ++-
07_String_Processing.md | 11 +++-
08_EML_ABAP_for_RAP.md | 11 ++--
11_ABAP_SQL_Grouping_Internal_Tables.md | 4 +-
12_AMDP.md | 9 ++-
13_Program_Flow_Logic.md | 13 +++-
14_ABAP_Unit_Tests.md | 11 +++-
15_CDS_View_Entities.md | 28 ++++-----
16_Data_Types_and_Objects.md | 18 +++++-
17_SAP_LUW.md | 21 ++++---
18_Dynpro.md | 13 ++--
19_ABAP_for_Cloud_Development.md | 9 ++-
20_Selection_Screens_Lists.md | 7 ++-
21_XML_JSON.md | 81 +++++++++++++++++++++++--
src/zcl_demo_abap_xml_json.clas.abap | 7 +--
20 files changed, 230 insertions(+), 62 deletions(-)
diff --git a/01_Internal_Tables.md b/01_Internal_Tables.md
index a691e39..bdae800 100644
--- a/01_Internal_Tables.md
+++ b/01_Internal_Tables.md
@@ -1513,4 +1513,7 @@ Tables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?fil
## Executable Example
[zcl_demo_abap_internal_tables](./src/zcl_demo_abap_internal_tables.clas.abap)
-Follow the steps outlined [here](README.md#-getting-started-with-the-examples) to import and run the code.
\ No newline at end of file
+> **💡 Note**
+> - The executable example covers the following topics, among others: Creating, populating, reading from, sorting, modifying internal tables
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
\ No newline at end of file
diff --git a/02_Structures.md b/02_Structures.md
index 790f330..3b6fd01 100644
--- a/02_Structures.md
+++ b/02_Structures.md
@@ -514,7 +514,6 @@ diff_deep_struc = CORRESPONDING #( DEEP APPENDING BASE ( diff_struc ) deep_struc
```
⬆️ back to top
-
## Clearing Structures
@@ -710,4 +709,12 @@ TYPES END OF address_type.
## Executable Example
[zcl_demo_abap_structures](./src/zcl_demo_abap_structures.clas.abap)
-Follow the steps outlined [here](README.md#-getting-started-with-the-examples) to import and run the code.
\ No newline at end of file
+> **💡 Note**
+> - The executable example covers the following topics, among others:
+> - Creating structures and structured types
+> - Variants of structures
+> - Accessing, populating, and clearing structures
+> - Structures in the context of tables
+> - Including structures
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
\ No newline at end of file
diff --git a/03_ABAP_SQL.md b/03_ABAP_SQL.md
index 84563b4..b76b4be 100644
--- a/03_ABAP_SQL.md
+++ b/03_ABAP_SQL.md
@@ -1508,4 +1508,11 @@ DELETE dbtab FROM TABLE @( VALUE #( ( comp1 = ... )
## Executable Example
[zcl_demo_abap_sql](./src/zcl_demo_abap_sql.clas.abap)
-Note the steps outlined [here](README.md#-getting-started-with-the-examples) about how to import and run the code.
+> **💡 Note**
+> - The executable example covers the following topics, among others:
+> - Reading from database tables using `SELECT`
+> - Various additions to `SELECT` statements
+> - Changing data in database tables using `INSERT`, `UPDATE`, `MODIFY` and `DELETE`
+> - Excursions: Operands and expressions in ABAP SQL statements
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
diff --git a/04_ABAP_Object_Orientation.md b/04_ABAP_Object_Orientation.md
index 398c151..f4c2eee 100644
--- a/04_ABAP_Object_Orientation.md
+++ b/04_ABAP_Object_Orientation.md
@@ -1229,4 +1229,13 @@ in the ABAP Keyword Documentation.
## Executable Example
[zcl_demo_abap_objects](./src/zcl_demo_abap_objects.clas.abap)
-Note the steps outlined [here](README.md#-getting-started-with-the-examples) about how to import and run the code.
+> **💡 Note**
+> - The executable example covers the following topics, among others:
+> - Working with objects and components
+> - Redefining methods, inheritance
+> - Working with interfaces
+> - Upcast and downcast
+> - Concepts such as factory methods, singleton and abstract classes
+> - Events
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
diff --git a/05_Constructor_Expressions.md b/05_Constructor_Expressions.md
index 5afd961..869c7bc 100644
--- a/05_Constructor_Expressions.md
+++ b/05_Constructor_Expressions.md
@@ -935,4 +935,6 @@ DATA(a) = COND #( LET b = c IN
[zcl_demo_abap_constructor_expr](./src/zcl_demo_abap_constructor_expr.clas.abap)
-Note the steps outlined [here](README.md#-getting-started-with-the-examples) about how to import and run the code.
+> **💡 Note**
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
diff --git a/06_Dynamic_Programming.md b/06_Dynamic_Programming.md
index 3e172b4..ba9d3e3 100644
--- a/06_Dynamic_Programming.md
+++ b/06_Dynamic_Programming.md
@@ -1329,4 +1329,11 @@ generation or execution of programs at runtime. They are not part of this cheat
[zcl_demo_abap_dynamic_prog](./src/zcl_demo_abap_dynamic_prog.clas.abap)
-Note the steps outlined [here](README.md#-getting-started-with-the-examples) about how to import and run the code.
\ No newline at end of file
+> **💡 Note**
+> - The executable example ...
+> - covers the following topics, among others:
+> - Field symbols and data references as supporting elements for dynamic programming
+> - Dynamic ABAP syntax components
+> - Runtime type services (RTTS), i. e. runtime type identification (RTTI) and runtime type creation (RTTC)
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
diff --git a/07_String_Processing.md b/07_String_Processing.md
index 58bbbe0..79ef525 100644
--- a/07_String_Processing.md
+++ b/07_String_Processing.md
@@ -1668,4 +1668,13 @@ REPLACE PCRE `(.*?)PP(.*)` IN s1 WITH `$2#$1` IGNORING CASE. "pc app#ab a
[zcl_demo_abap_string_proc](./src/zcl_demo_abap_string_proc.clas.abap)
-Follow the steps outlined [here](README.md#-getting-started-with-the-examples) to import and run the code.
+> **💡 Note**
+> - The executable example ...
+> - covers the following topics:
+> - Creating strings and assigning values
+> - String templates
+> - Operations with strings operations: chaining, concatenating, splitting, modifying
+> - Searching and replacing
+> - Regular expressions
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
diff --git a/08_EML_ABAP_for_RAP.md b/08_EML_ABAP_for_RAP.md
index 06d2f05..3add1eb 100644
--- a/08_EML_ABAP_for_RAP.md
+++ b/08_EML_ABAP_for_RAP.md
@@ -1377,8 +1377,9 @@ This cheat sheet is supported by different executable examples demonstrating var
- Demo RAP scenario ("RAP calculator") with a managed, draft-enabled RAP BO, late numbering [zcl_demo_abap_rap_draft_ln_m](./src/zcl_demo_abap_rap_draft_ln_m.clas.abap)
> **💡 Note**
-> - To reduce the complexity, the executable examples are purposely kept simple and only focus on the technical side. ABAP classes play the role of a RAP BO consumer here.
->- The examples do not represent real life scenarios and are not suitable as role models for proper RAP scenarios. They rather focus on the technical side by giving an idea how the communication and data exchange between a RAP BO consumer and RAP BO provider can work. Additionally, the examples show how the methods for non-standard RAP BO operations might be self-implemented in an ABAP behavior pool.
->- Due to the simplification, the examples might not fully meet the requirements of the [RAP BO contract](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenrap_bo_contract_glosry.htm) in many respects.
->- The "RAP calculator" example can be checked out using the preview version of an SAP Fiori Elements UI. See the comments in the class for more information.
->- See the steps outlined [here](README.md#-getting-started-with-the-examples) about how to import and run the code.
+> - To reduce the complexity, the executable examples only focus on the technical side. ABAP classes play the role of a RAP BO consumer here.
+> - The examples do not represent real life scenarios and are not suitable as role models for proper RAP scenarios. They rather focus on the technical side by giving an idea how the communication and data exchange between a RAP BO consumer and RAP BO provider can work. Additionally, the examples show how the methods for non-standard RAP BO operations might be self-implemented in an ABAP behavior pool.
+> - Due to the simplification, the examples do not fully meet the requirements of the [RAP BO contract](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenrap_bo_contract_glosry.htm) in many respects.
+> - You can check out the "RAP calculator" example using the preview version of an SAP Fiori Elements UI. See the comments in the class for more information.
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
diff --git a/11_ABAP_SQL_Grouping_Internal_Tables.md b/11_ABAP_SQL_Grouping_Internal_Tables.md
index cd5fb6d..019f05c 100644
--- a/11_ABAP_SQL_Grouping_Internal_Tables.md
+++ b/11_ABAP_SQL_Grouping_Internal_Tables.md
@@ -177,4 +177,6 @@ SIZE`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file
[zcl_demo_abap_sql_group_by](./src/zcl_demo_abap_sql_group_by.clas.abap)
-Note the steps outlined [here](README.md#-getting-started-with-the-examples) about how to import and run the code.
\ No newline at end of file
+> **💡 Note**
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
\ No newline at end of file
diff --git a/12_AMDP.md b/12_AMDP.md
index 16548f7..623114f 100644
--- a/12_AMDP.md
+++ b/12_AMDP.md
@@ -441,4 +441,11 @@ relevant in the executable example.
[zcl_demo_abap_amdp](./src/zcl_demo_abap_amdp.clas.abap)
-Note the steps outlined [here](README.md#-getting-started-with-the-examples) about how to import and run the code.
\ No newline at end of file
+> **💡 Note**
+> - The executable example ...
+> - covers the following topics:
+> - AMDP procedures, calling AMDP procedures from SQLScript
+> - AMDP table functions for AMDP methods
+> - AMDP table functions for CDS table functions
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
\ No newline at end of file
diff --git a/13_Program_Flow_Logic.md b/13_Program_Flow_Logic.md
index 38becb3..887f1cf 100644
--- a/13_Program_Flow_Logic.md
+++ b/13_Program_Flow_Logic.md
@@ -658,4 +658,15 @@ ASSERT flag = abap_true.
[zcl_demo_abap_prog_flow_logic](./src/zcl_demo_abap_prog_flow_logic.clas.abap)
-Note the steps outlined [here](README.md#-getting-started-with-the-examples) about how to import and run the code.
+> **💡 Note**
+> - The executable example ...
+> - covers the following topics, among others:
+> - Control structures with `IF`, `CASE`, and `TRY`
+> - Excursions: `COND` and `SWITCH` operators
+> - Expressions and functions for conditions
+> - Predicate expression with `IS SUPPLIED`
+> - Loops with `DO`, `WHILE`, and `LOOP`
+> - Terminating loop passes
+> - Handling exceptions
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
\ No newline at end of file
diff --git a/14_ABAP_Unit_Tests.md b/14_ABAP_Unit_Tests.md
index a3a208e..7d78525 100644
--- a/14_ABAP_Unit_Tests.md
+++ b/14_ABAP_Unit_Tests.md
@@ -514,6 +514,11 @@ For more information about evaluating ABAP unit test results, see [here](https:/
[zcl_demo_abap_unit_test](./src/zcl_demo_abap_unit_test.clas.abap)
-Note ...
-- the steps outlined [here](README.md#-getting-started-with-the-examples) about how to import and run the code.
-- the comments in the executable example.
\ No newline at end of file
+> **💡 Note**
+> - The executable example ...
+> - covers the following topics:
+> - Test classes and test/special methods
+> - Implementing and injecting test doubles (constructor injection, back door injection, test seams)
+> - contains comments in the code for more information.
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
\ No newline at end of file
diff --git a/15_CDS_View_Entities.md b/15_CDS_View_Entities.md
index aef7c84..ea473bf 100644
--- a/15_CDS_View_Entities.md
+++ b/15_CDS_View_Entities.md
@@ -24,17 +24,17 @@ Core data services (CDS) are an infrastructure for defining and consuming semant
[zcl_demo_abap_cds_ve](./src/zcl_demo_abap_cds_ve.clas.abap)
-The example covers the following topics:
-- Operands, expressions, built-in functions, and input parameters in CDS view entities
- - Selecting data from CDS view entities using ABAP SQL `SELECT` statements
-- Joins
- - Note: A sample CDS view entity contains multiple joins. You can comment in/out code sections to see the effect. See the notes in the view.
- - Excursion: Joins in ABAP SQL
-- Associations
- - Defining views with associations
- - Exposing associations
- - Using exposed associations in ABAP statements
-
-Note ...
-- the comments in the example CDS view entities (`zdemo_abap_cds_ve...`) and the [class](./src/zcl_demo_abap_cds_ve.clas.abap).
-- the steps outlined [here](README.md#-getting-started-with-the-examples) about how to import and run the code.
+> **💡 Note**
+> - The executable example covers the following topics:
+> - Operands, expressions, built-in functions, and input parameters in CDS view entities
+> - Selecting data from CDS view entities using ABAP SQL `SELECT` statements
+> - Joins
+> - Note: A sample CDS view entity contains multiple joins. You can comment in/out code sections to see the effect. See the notes in the view.
+> - Excursion: Joins in ABAP SQL
+> - Associations
+> - Defining views with associations
+> - Exposing associations
+> - Using exposed associations in ABAP statements
+> - The example CDS view entities (`zdemo_abap_cds_ve...`) and the [class](./src/zcl_demo_abap_cds_ve.clas.abap) contains comments in the code for more information.
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
\ No newline at end of file
diff --git a/16_Data_Types_and_Objects.md b/16_Data_Types_and_Objects.md
index 00962cf..97889a3 100644
--- a/16_Data_Types_and_Objects.md
+++ b/16_Data_Types_and_Objects.md
@@ -1281,8 +1281,20 @@ Find more information in the [cheat sheet about dynamic programming](06_Dynamic_
[zcl_demo_abap_dtype_dobj](./src/zcl_demo_abap_dtype_dobj.clas.abap)
> **💡 Note**
-> - [Here](README.md#-getting-started-with-the-examples) are the steps to import and run the code.
-> - Compared to other ABAP cheat sheet executable examples, this one does not have as many things to be output. The focus is on syntax options and declarations. In the class, you can set breakpoints and use the debugger to check out data objects. You can also use the F2 information for the many types and data objects. Simply select a type or object in the code and press F2 in ADT to check out the information.
-> - The executable example also covers topics not covered above such as built-in data objects and formal parameters typed with generic ABAP types.
+> - The executable example ...
+> - covers, among others, the following topics:
+> - Declaring data types
+> - Declaring data objects, inline declarations
+> - Assignments
+> - Creating anonymous data objects
+> - Type conversions
+> - Getting type information (Runtime Type Information/RTTI)
+> - Constants, immutable variables
+> - Generic types
+> - Enumerated types and objects
+> - does not have as many things to be output compared to other ABAP cheat sheet executable examples. The focus is on syntax options and declarations. In the class, you can set breakpoints and use the debugger to check out data objects. You can also use the F2 information for the many types and data objects. Simply select a type or object in the code and press F2 in ADT to check out the information.
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
+
diff --git a/17_SAP_LUW.md b/17_SAP_LUW.md
index b0bc29d..d37f77f 100644
--- a/17_SAP_LUW.md
+++ b/17_SAP_LUW.md
@@ -308,14 +308,19 @@ After the import of the repository, proceed as follows:
- Run the program by choosing `F8`.
> **💡 Note**
-> - The steps about how to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
-> - The SAP LUW is demonstrated using classic dynpros to provide a self-contained example (i.e., so as not to have more artifacts, service creation, etc.) that highlights the considerations regarding implicit database commits - without putting the spotlight on dynpros. Note that classic dynpros are outdated for application programs. New developments should use web-based UIs, such as SAPUI5 or Web Dynpro.
-> - Dynpros cannot be created in ABAP Cloud. As mentioned earlier, RAP is the transactional programming model for ABAP Cloud. It comes with a well-defined transactional model and follows the rules of the SAP LUW. See the links in the *More Information* section.
-> - The example ...
-> - does not claim to include meaningful dynpros with meaningful dynpro sequences and is not intended to be a role model for proper dynpro design.
-> - is not intended to solve concrete programming tasks. You should always work out your own solution for each individual case.
-> - is only intended to demonstrate a selection of keywords and visualize SAP LUW-related syntax in action on a high level.
-> - See notes on the executable example in the expandable section below.
+> - The executable example ...
+> - demonstrates the SAP LUW using classic dynpros to provide a self-contained and simple example that highlights the considerations regarding implicit database commits, without putting the spotlight on dynpros. Note that classic dynpros are outdated for application programs. New developments should use web-based UIs, such as SAPUI5 or Web Dynpro.
+> - covers the following topics in simple contexts:
+> - Demonstrating synchronous update, asynchronous update, and local update triggered by `COMMIT WORK`, `COMMIT WORK AND WAIT`, and `SET UPDATE TASK LOCAL` using update function modules.
+> - Demonstrating the statements `PERFORM ... ON COMMIT` and `PERFORM ... ON ROLLBACK` using subroutines.
+> - does not claim to include meaningful dynpros with meaningful dynpro sequences and is not intended to be a role model for proper dynpro design.
+> - is not intended to solve concrete programming tasks. You should always work out your own solution for each individual case.
+> - is only intended to demonstrate a selection of keywords and visualize SAP LUW-related syntax in action on a high level.
+> - is explained in more detail below in the expandable section below. Click to view the details.
+> - Dynpros cannot be created in ABAP Cloud. As mentioned earlier, RAP is the transactional programming model for ABAP Cloud. It comes with a well-defined transactional model and follows the rules of the SAP LUW. See the links in the [More Information](#more-information) section.
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
+
diff --git a/18_Dynpro.md b/18_Dynpro.md
index 58a8362..22d40cc 100644
--- a/18_Dynpro.md
+++ b/18_Dynpro.md
@@ -724,15 +724,20 @@ After the import of the repository, proceed as follows:
- Run the program by choosing `F8`.
> **💡 Note**
-> - The steps about how to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
> - The executable example ...
+> - covers the following topics:
+> - Dynpro flow logic and related statements (`MODULE`, `FIELD`, `CHAIN`/`ENDCHAIN`, `LOOP`/`ENDLOOP`, `CALL SUBSCREEN`)
+> - ABAP statements for calling and leaving dynpros (`SET SCREEN`, `CALL SCREEN`, `LEAVE SCREEN`)
+> - Modifying static attributes (`LOOP AT SCREEN`, `MODIFY SCREEN`),
+> - Statements related to the GUI status and title (`GET`/`SET PF-STATUS`, `SET TITLEBAR`)
+> - Controls (table and tabstrip controls)
> - does not claim to include meaningful dynpros with meaningful dynpro sequences (branching to new dynpro sequences occur through using appropriate statements).
> - is not intended to be a role model for proper dynpro design.
> - is not intended to solve concrete programming tasks. You should always work out your own solution for each individual case.
> - is only intended to demonstrate a selection of keywords and visualize dynpro-related syntax in action on a high level.
-> - See notes on the executable example in the expandable section below.
-
-
+> - is explained in more detail below in the expandable section below. Click to view the details.
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
diff --git a/19_ABAP_for_Cloud_Development.md b/19_ABAP_for_Cloud_Development.md
index 7fe0dd7..8029cbc 100644
--- a/19_ABAP_for_Cloud_Development.md
+++ b/19_ABAP_for_Cloud_Development.md
@@ -178,5 +178,10 @@ It provides references to more detailed information on the topic.
[zcl_demo_abap_cloud_excursion](./src/zcl_demo_abap_cloud_excursion.clas.abap)
> **💡 Note**
-> - Unlike other ABAP cheat sheet examples, this one does not focus on ABAP syntax as such (see the other non-Standard-ABAP ABAP cheat sheet examples for that using ABAP syntax available in ABAP for Cloud Development), but rather emphasizes released APIs and libraries that provide predefined functionality and can be used in ABAP for Cloud Development - in particular, the Extension Components Library (XCO).
-> - The example covers an arbitrary selection for you to explore. For more detailed information and code snippets, see the SAP Help Portal documentation [here](https://help.sap.com/docs/btp/sap-business-technology-platform/sap-business-technology-platform?version=Cloud) and [here about XCO](https://help.sap.com/docs/btp/sap-business-technology-platform/xco-library?version=Cloud). In most cases, the example covers a selection of classes and methods for retrieving information about repository objects. It is more of a "playground" for exploring the APIs with a few snippets of code, and should be seen as an invitation to more in-depth exploration.
\ No newline at end of file
+> - The executable example ...
+> - does not focus - unlike other ABAP cheat sheet examples - on ABAP syntax as such (the other non-Standard-ABAP cheat sheet examples focus on ABAP syntax available in ABAP for Cloud Development), but rather emphasizes released APIs and libraries that provide predefined functionality and can be used in ABAP for Cloud Development. In particular, the Extension Components Library (XCO) is used.
+> - covers an arbitrary selection for you to explore. For more detailed information and code snippets, see the SAP Help Portal documentation [here](https://help.sap.com/docs/btp/sap-business-technology-platform/sap-business-technology-platform?version=Cloud) and [here about XCO](https://help.sap.com/docs/btp/sap-business-technology-platform/xco-library?version=Cloud). In most cases, the example covers a selection of classes and methods for retrieving information about repository objects. It is more of a "playground" for exploring the APIs with a few snippets of code, and should be seen as an invitation to more in-depth exploration.
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
+
+
diff --git a/20_Selection_Screens_Lists.md b/20_Selection_Screens_Lists.md
index bb1b652..aa79bb8 100644
--- a/20_Selection_Screens_Lists.md
+++ b/20_Selection_Screens_Lists.md
@@ -958,10 +958,11 @@ After the import of the repository, proceed as follows:
- Run the program by choosing `F8`.
> **💡 Note**
-> - The steps about how to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
> - The executable examples ...
> - do not claim to include meaningful selection screens and lists.
> - are not intended to be role models for proper selection screen and list design.
> - are not intended to solve concrete programming tasks. You should always work out your own solution for each individual case.
-> - are only intended to demonstrate a selection of keywords and visualize related syntax in action on a high level.
-> - Find comments in the program code.
\ No newline at end of file
+> - are only intended to demonstrate a selection of keywords and visualize related syntax in action on a high level.
+> - include comments in the program code.
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
\ No newline at end of file
diff --git a/21_XML_JSON.md b/21_XML_JSON.md
index 090727a..b100cf2 100644
--- a/21_XML_JSON.md
+++ b/21_XML_JSON.md
@@ -512,6 +512,7 @@ CALL TRANSFORMATION ... SOURCE ...
- You can ..
- create and read JSON data in ABAP using the readers and writers in the sXML Library. See the processing of XML data in the sXML section above. Parsing and rendering JSON data works in a similar way. However, instead of using XML readers/writers, you use JSON readers/writers.
- transform ABAP to and from JSON data using transformations. You can directly transform ABAP <-> JSON using identity transformation (ID). In this context, note the intermediate format asJSON (see the notes on asXML above).
+ - create an handle JSON data using the [XCO library](https://help.sap.com/docs/btp/sap-business-technology-platform/xco-library?version=Cloud).
The following code snippets show a selection of transformation options using the predefined identity transformation. Here, a JSON writer is specified as the target.
@@ -564,12 +565,84 @@ DATA(json_formatted) = cl_abap_conv_codepage=>create_in( )->convert( json_wr->ge
*}
```
+The following snippets demonstrate creating and handling JSON data using the XCO library. Note that unlike above, the snippets do not work with asJSON as an intermediate format.
+
+```abap
+"Creating and populating a demo structure and internal table
+DATA: BEGIN OF carrier_struc,
+ carrier_id TYPE c length 3,
+ connection_id TYPE n length 4,
+ city_from TYPE c length 20,
+ city_to TYPE c length 20,
+ END OF carrier_struc.
+
+DATA carriers_tab like TABLE OF carrier_struc WITH EMPTY KEY.
+
+carrier_struc = VALUE #( carrier_id = 'AA' connection_id = '17' city_from = 'New York' city_to = 'San Francisco' ).
+carriers_tab = VALUE #( ( carrier_id = 'AZ' connection_id = '788' city_from = 'Rome' city_to = 'Tokyo' )
+ ( carrier_id = 'JL' connection_id = '408' city_from = 'Frankfurt' city_to = 'Tokyo' ) ).
+
+"ABAP (structure) -> JSON using XCO
+DATA(struc2json_xco) = xco_cp_json=>data->from_abap( carrier_struc )->to_string( ).
+"Result: {"CARRIER_ID":"AA","CONNECTION_ID":"0017","CITY_FROM":"New York","CITY_TO":"San Francisco"}
+
+"ABAP (internal table) -> JSON using XCO
+DATA(itab2json_xco) = xco_cp_json=>data->from_abap( carriers_tab )->to_string( ).
+"Result: [{"CARRIER_ID":"AZ","CONNECTION_ID":"0788","CITY_FROM":"Rome","CITY_TO":"Tokyo"},
+" {"CARRIER_ID":"JL","CONNECTION_ID":"0408","CITY_FROM":"Frankfurt","CITY_TO":"Tokyo"}]
+
+"JSON -> ABAP (structure) using XCO
+DATA json2struc_xco LIKE carrier_struc.
+xco_cp_json=>data->from_string( struc2json_xco )->write_to( REF #( json2struc_xco ) ).
+"Result:
+"CARRIER_ID CONNECTION_ID CITY_FROM CITY_TO
+"AA 0017 New York San Francisco
+
+"JSON -> ABAP (internal table) using XCO
+DATA json2itab_xco LIKE carriers_tab.
+xco_cp_json=>data->from_string( itab2json_xco )->write_to( REF #( json2itab_xco ) ).
+"Result:
+"CARRIER_ID CONNECTION_ID CITY_FROM CITY_TO
+"AZ 0788 Rome Tokyo
+"JL 0408 Frankfurt Tokyo
+
+"Creating JSON using XCO
+"You can check out more methods that offer various options to build
+"the JSON by clicking CTRL + Space after '->' in ADT.
+"In the following example, JSON data similar to above is created.
+"First, a JSON data builder is created. Then, using different methods,
+"JSON data is created.
+DATA(json_builder_xco) = xco_cp_json=>data->builder( ).
+json_builder_xco->begin_object(
+ )->add_member( 'CarrierId' )->add_string( 'DL'
+ )->add_member( 'ConnectionId' )->add_string( '1984'
+ )->add_member( 'CityFrom' )->add_string( 'San Francisco'
+ )->add_member( 'CityTo' )->add_string( 'New York'
+ )->end_object( ).
+
+"Getting JSON data
+DATA(json_created_xco) = json_builder_xco->get_data( )->to_string( ).
+"Result: {"CarrierId":"DL","ConnectionId":"1984","CityFrom":"San Francisco","CityTo":"New York"}
+
+"Transforming the created JSON to ABAP (structure)
+"Note: The JSON was intentionally created without the underscores in the
+"name to demonstrate the 'apply' method. The following example demonstrates
+"a transformation of camel case and underscore notation. As above, check out
+"more options by clicking CTRL + Space after '...transformation->'.
+CLEAR json2struc_xco.
+xco_cp_json=>data->from_string( json_created_xco )->apply( VALUE #(
+ ( xco_cp_json=>transformation->pascal_case_to_underscore ) ) )->write_to( REF #( json2struc_xco ) ).
+"Result
+"CARRIER_ID CONNECTION_ID CITY_FROM CITY_TO
+"DL 1984 San Francisco New York
+```
+
⬆️ back to top
## Excursion: Converting string <-> xstring
In the code snippets above and in the executable example, many operations are performed using binary data.
This excursion shows the conversion of string <-> xstring using a codepage. The examples use UTF-8.
-For example, you can use the `cl_abap_conv_codepage` class and the [XCO library](https://help.sap.com/docs/SAP_S4HANA_CLOUD/0f69f8fb28ac4bf48d2b57b9637e81fa/702b5328be1a4bc4852ce29b09506b04.html?locale=en-US). The executable example also covers an excursion regarding compressing and decompressing of binary data.
+For example, you can use the `cl_abap_conv_codepage` class and the [XCO library](https://help.sap.com/docs/btp/sap-business-technology-platform/xco-library?version=Cloud). The executable example also covers an excursion regarding compressing and decompressing of binary data.
```abap
DATA(xml_string) = `ABAP`.
@@ -624,7 +697,7 @@ DATA(conv_string_xco) = xco_cp=>xstring( conv_xstring_xco
> **💡 Note**
> - The executable example ...
-> - covers the following topics in simple contexts:
+> - covers the following topics:
> - Creating/Parsing XML Data Using iXML
> - Creating/Parsing XML Data Using sXML
> - XML Transformations using XSLT and Simple Transformations
@@ -633,5 +706,5 @@ DATA(conv_string_xco) = xco_cp=>xstring( conv_xstring_xco
> - Dealing with JSON data, XCO classes for JSON
> - Excursions: Converting string <-> xstring, compressing and decompressing binary data
> - uses, apart from the predefined identity transformation (ID), demo XSLT and ST programs. They are not intended to be role models for proper XSLT/ST design.
-> - The steps to import and run the code are outlined [here](README.md#🎬-getting-started-with-the-examples).
-> - [Disclaimer](README.md#⚠️-disclaimer)
\ No newline at end of file
+> - The steps to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
+> - [Disclaimer](README.md#%EF%B8%8F-disclaimer)
\ No newline at end of file
diff --git a/src/zcl_demo_abap_xml_json.clas.abap b/src/zcl_demo_abap_xml_json.clas.abap
index cc9d65b..d9c038a 100644
--- a/src/zcl_demo_abap_xml_json.clas.abap
+++ b/src/zcl_demo_abap_xml_json.clas.abap
@@ -157,13 +157,11 @@ CLASS zcl_demo_abap_xml_json IMPLEMENTATION.
conv_string = format( conv_string ).
conv_string_xco = format( conv_string_xco ).
out->write( |\n| ).
- out->write( `Result of the xstring to string conversion:` ).
+ out->write( `Results of the xstring to string conversions:` ).
out->write( |\n| ).
out->write( conv_string ).
out->write( |\n| ).
- IF conv_string = conv_string_xco.
- out->write( `The two conversions give the same result.` ).
- ENDIF.
+ out->write( conv_string_xco ).
**********************************************************************
@@ -1502,7 +1500,6 @@ CLASS zcl_demo_abap_xml_json IMPLEMENTATION.
out->write( `JSON -> ABAP (structure) using XCO demonstrating the apply method` ).
out->write( json2struc_xco ).
- out->write( |\n| ).
************************************************************************