diff --git a/03_ABAP_SQL.md b/03_ABAP_SQL.md
index 5559e3b..13481fa 100644
--- a/03_ABAP_SQL.md
+++ b/03_ABAP_SQL.md
@@ -39,6 +39,7 @@
- [Using Constructor Expressions in ABAP SQL Statements](#using-constructor-expressions-in-abap-sql-statements)
- [Example: Exploring Create, Update, and Delete Operations with ABAP SQL Statements](#example-exploring-create-update-and-delete-operations-with-abap-sql-statements)
- [Dynamic ABAP SQL Statements](#dynamic-abap-sql-statements)
+ - [CRUD Operations Using CDS Artifacts](#crud-operations-using-cds-artifacts)
- [Excursions](#excursions)
- [Evaluating ABAP System Fields after ABAP SQL Statements](#evaluating-abap-system-fields-after-abap-sql-statements)
- [Typed Literals](#typed-literals)
@@ -68,7 +69,8 @@
the focus is on syntax options.
> **💡 Note**
-> The syntax options for the `SELECT` statement are extensive. Make sure that you consult the ABAP Keyword Documentation for all available options. The cheat sheet and snippets demonstrate a selection.
+> - The syntax options for the `SELECT` statement are extensive. Make sure that you consult the ABAP Keyword Documentation for all available options. The cheat sheet and snippets demonstrate a selection.
+> - The code examples in the cheat sheet primarily use DDIC database tables for [CRUD operations](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencrud_glosry.htm). Note that there are also CDS artifacts that allow not only reading but also creating, updating, and deleting. See [this section](#crud-operations-using-cds-artifacts).
## Excursion: Database Tables and Views
@@ -148,6 +150,7 @@ Views](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm
editor).
- are, in contrast to external views, supported by all database
systems (that support the ABAP CDS characteristics).
+ - Note that there are also CDS artifacts that allow not only reading but also creating, updating, and deleting. See [this section](#crud-operations-using-cds-artifacts).
| ABAP repository object | Notes/Code | +
| + +Table entity + + | + ++ + +```abap +@ClientHandling.type: #CLIENT_INDEPENDENT +@AbapCatalog.deliveryClass: #APPLICATION_DATA +@AccessControl.authorizationCheck: #NOT_REQUIRED +@EndUserText.label: 'CDS table entity' +define table entity zdemo_abap_animals_te +{ + key id : abap.int4; + animal_name : abap.char(20); + species : abap.char(20); + age : abap.int4; + country_of_origin : abap.char(20); + arrival_date : abap.datn; + is_carnivore : abap_boolean; +} +``` + + | +
| + +Writable CDS view entity + + | + ++ +```abap +@AccessControl.authorizationCheck: #NOT_REQUIRED +@EndUserText.label: 'Writable CDS view entity' +@Metadata.ignorePropagatedAnnotations: true +define writable view entity zdemo_abap_animals_we + as select from zdemo_abap_animals_te +{ + key id, + animal_name, + species, + age, + country_of_origin, + arrival_date, + is_carnivore +} +``` + + | +
| + +Class + + | + ++ + +```abap +CLASS zcl_demo_abap DEFINITION + PUBLIC + FINAL + CREATE PUBLIC . + + PUBLIC SECTION. + INTERFACES if_oo_adt_classrun. + PROTECTED SECTION. + PRIVATE SECTION. +ENDCLASS. + + +CLASS zcl_demo_abap IMPLEMENTATION. + METHOD if_oo_adt_classrun~main. + +*&---------------------------------------------------------------------* +*& Using table entities and writable CDS view entities as data types +*& in ABAP +*&---------------------------------------------------------------------* + + DATA struc_table_entity TYPE zdemo_abap_animals_te. + TYPES struc_type_table_entity TYPE zdemo_abap_animals_te. + DATA(another_struc_table_ent) = VALUE zdemo_abap_animals_te( id = 1 animal_name = 'Zeus' ). + + DATA struc_writable_ve TYPE zdemo_abap_animals_we. + TYPES struc_type_writable_ve TYPE zdemo_abap_animals_we. + DATA(another_struc_writable_ve) = VALUE zdemo_abap_animals_we( id = 2 animal_name = 'Leo' ). + +*&---------------------------------------------------------------------* +*& Performing CRUD operations using a table entity and ABAP SQL +*&---------------------------------------------------------------------* + + out->write( `---- Performing CRUD operations on table entities using ABAP SQL ----` ). + out->write( |\n| ). + + DELETE FROM zdemo_abap_animals_te. + + "DATA animals_table type table of zdemo_abap_animals_te with empty key. + + INSERT zdemo_abap_animals_te FROM TABLE @( VALUE #( + ( id = 1 animal_name = 'Zeus' species = 'Lion' age = 5 country_of_origin = '' arrival_date = '20220115' is_carnivore = abap_true ) + ( id = 2 animal_name = 'Leo' species = 'Lion' age = 7 country_of_origin = '' arrival_date = '20241205' is_carnivore = abap_true ) + ( id = 3 animal_name = 'Jumbo' species = 'Elephant' age = 10 country_of_origin = 'India' arrival_date = '20190526' is_carnivore = abap_false ) + ( id = 4 animal_name = 'Little' species = 'Elephant' age = 4 country_of_origin = 'India' arrival_date = '20240314' is_carnivore = abap_false ) + ( id = 5 animal_name = 'Daisy' species = 'Zebra' age = 4 country_of_origin = 'South Africa' arrival_date = '20220207' is_carnivore = abap_false ) + ( id = 6 animal_name = 'Buddy' species = 'Owl' age = 3 country_of_origin = 'Canada' arrival_date = '20210111' is_carnivore = abap_true ) + ( id = 7 animal_name = 'Sunny' species = 'Dolphin' age = 7 country_of_origin = 'Australia' arrival_date = '20190527' is_carnivore = abap_false ) + ( id = 8 animal_name = 'Nala' species = 'Giraffe' age = 6 country_of_origin = 'Tanzania' arrival_date = '20210807' is_carnivore = abap_false ) + ( id = 9 animal_name = 'Oscar' species = 'Tiger' age = 8 country_of_origin = 'Russia' arrival_date = '20191018' is_carnivore = abap_true ) + ( id = 10 animal_name = 'Charlie' species = 'Chimpanzee' is_carnivore = abap_false ) + ( id = 12 ) ) ). + out->write( |sy-dbcnt after 1st INSERT: { sy-dbcnt }| ). + + SELECT COUNT(*) FROM zdemo_abap_animals_te INTO @DATA(number_of_entries). + out->write( |Number of data entries after 1st INSERT: { number_of_entries }| ). + + INSERT zdemo_abap_animals_te FROM TABLE @( VALUE #( + ( id = 1 animal_name = 'Lora' species = 'Parrot' age = 2 country_of_origin = 'Mexico' arrival_date = '20240712' is_carnivore = abap_false ) + ( id = 11 animal_name = 'Teddy' species = 'Koala' age = 4 country_of_origin = 'Australia' arrival_date = '20240225' is_carnivore = abap_false ) ) ) + ACCEPTING DUPLICATE KEYS. + out->write( |sy-dbcnt after 2nd INSERT: { sy-dbcnt }| ). + + SELECT COUNT(*) FROM zdemo_abap_animals_te INTO @number_of_entries. + out->write( |Number of data entries after 1st INSERT: { number_of_entries }| ). + + MODIFY zdemo_abap_animals_te FROM TABLE @( VALUE #( + ( id = 12 animal_name = 'Peanut' species = 'Penguin' age = 6 country_of_origin = 'Antarctica' arrival_date = '20200410' is_carnivore = abap_false ) + ( id = 13 animal_name = 'Lora' species = 'Parrot' age = 2 country_of_origin = 'Mexico' arrival_date = '20240712' is_carnivore = abap_false ) + ( id = 14 animal_name = 'Jumpy' species = 'Kangaroo' age = 4 country_of_origin = 'Australia' arrival_date = '20211117' is_carnivore = abap_false ) ) ). + out->write( |sy-dbcnt after MODIFY: { sy-dbcnt }| ). + + SELECT COUNT(*) FROM zdemo_abap_animals_te INTO @number_of_entries. + out->write( |Number of data entries after MODIFY: { number_of_entries }| ). + + SELECT SINGLE * FROM zdemo_abap_animals_te WHERE id = 10 INTO @DATA(data_set). + UPDATE zdemo_abap_animals_te FROM @( VALUE #( BASE data_set age = 3 country_of_origin = 'Uganda' arrival_date = '20231214' ) ). + out->write( |sy-dbcnt after 1st UPDATE: { sy-dbcnt }| ). + + UPDATE zdemo_abap_animals_te SET country_of_origin = 'Kenya' WHERE country_of_origin IS INITIAL. + out->write( |sy-dbcnt after 2nd UPDATE: { sy-dbcnt }| ). + + SELECT * FROM zdemo_abap_animals_te ORDER BY id INTO TABLE @DATA(itab_te). + out->write( `Table entries retrieved from table entity:` ). + out->write( itab_te ). + + DELETE FROM zdemo_abap_animals_te WHERE id > 10. + out->write( |sy-dbcnt after DELETE: { sy-dbcnt }| ). + + SELECT COUNT(*) FROM zdemo_abap_animals_te INTO @number_of_entries. + out->write( |Number of data entries after DELETE: { number_of_entries }| ). + + out->write( |\n| ). + out->write( repeat( val = '_' occ = 100 ) ). + out->write( |\n| ). + +*&---------------------------------------------------------------------* +*& Performing CRUD operations using a writable CDS view entities and ABAP SQL +*&---------------------------------------------------------------------* + + out->write( `---- Performing CRUD operations on a writable CDS view entity using ABAP SQL ----` ). + out->write( |\n| ). + + SELECT COUNT(*) FROM zdemo_abap_animals_we INTO @DATA(we_number_of_entries). + out->write( |Number of data entries accessed via writable CDS view entity: { we_number_of_entries }| ). + + INSERT zdemo_abap_animals_we FROM TABLE @( VALUE #( + ( id = 15 ) + ( id = 16 animal_name = 'Fuzz' species = 'Polar bear' ) ) ). + out->write( |sy-dbcnt after INSERT: { sy-dbcnt }| ). + + SELECT COUNT(*) FROM zdemo_abap_animals_we INTO @we_number_of_entries. + out->write( |Number of data entries after INSERT: { we_number_of_entries }| ). + + MODIFY zdemo_abap_animals_we FROM @( + VALUE #( id = 15 animal_name = 'Hunter' species = 'Jaguar' age = 3 country_of_origin = 'Brazil' arrival_date = '20230423' is_carnivore = abap_true ) ). + out->write( |sy-dbcnt after MODIFY: { sy-dbcnt }| ). + + SELECT SINGLE * FROM zdemo_abap_animals_we WHERE id = 16 INTO @DATA(entry). + UPDATE zdemo_abap_animals_we FROM @( + VALUE #( BASE entry animal_name = 'Fuzzy' age = 7 country_of_origin = 'Canada' arrival_date = '20190223' is_carnivore = abap_true ) ). + out->write( |sy-dbcnt after UPDATE: { sy-dbcnt }| ). + + DELETE zdemo_abap_animals_we FROM @( VALUE #( id = 10 ) ). + out->write( |sy-dbcnt after 1st DELETE: { sy-dbcnt }| ). + + SELECT COUNT(*) FROM zdemo_abap_animals_we INTO @we_number_of_entries. + out->write( |Number of data entries after 1st DELETE: { we_number_of_entries }| ). + + DELETE FROM zdemo_abap_animals_we WHERE id <= 5. + out->write( |sy-dbcnt after 2nd DELETE: { sy-dbcnt }| ). + + SELECT COUNT(*) FROM zdemo_abap_animals_we INTO @we_number_of_entries. + out->write( |Number of data entries after 2nd DELETE: { we_number_of_entries }| ). + + SELECT * FROM zdemo_abap_animals_we ORDER BY id INTO TABLE @DATA(itab_we). + out->write( `Table entries retrieved via writable CDS view entity:` ). + out->write( itab_we ). + ENDMETHOD. + +ENDCLASS. +``` + + | +