diff --git a/01_Internal_Tables.md b/01_Internal_Tables.md index 42074e7..245de63 100644 --- a/01_Internal_Tables.md +++ b/01_Internal_Tables.md @@ -84,7 +84,7 @@ Internal Tables ... ## Basic Properties of Internal Tables
- Expand to view the details + 🟢 Click to expand for more details **Line Type** @@ -137,7 +137,7 @@ Internal Tables ... ## Table Keys (Primary, Secondary, Standard, Empty) and Table Indexes
- Expand to view the details + 🟢 Click to expand for more details **Primary table key** @@ -442,7 +442,7 @@ DATA it27 LIKE TABLE OF it25. ### Line/Table Type Options of Internal Tables -This section explores various line (i.e. structured) and table type options when declaring internal tables. Various examples have already been covered in the previous sections. Among the options are, for example: +This section explores various line and table type options when declaring internal tables. Examples have already been covered in the previous sections. Among the options are, for example: - Elementary line types based on elementary built-in ABAP types, locally declared elementary types, globally available elementary types such as DDIC data elements - Line types based on both locally declared and globally available structured types - Among the globally available line types are, for example, DDIC structures, database tables and CDS objects such as CDS view entities @@ -538,6 +538,22 @@ DATA it_struc_5 TYPE TABLE OF zdemo_abap_table_function WITH EMPTY KEY. "Globally available structured types in the public visibility section of "classes/interfaces DATA it_struc_6 TYPE TABLE OF zcl_demo_abap_amdp=>fli_struc WITH EMPTY KEY. + +"Many of the previous examples demonstrate flat line types. +"Deep line types are also possible, that is, the line type +"can include components such as strings, references, and internal +"tables. +TYPES: BEGIN OF loc_deep_struct, + key_field TYPE i, + char TYPE c LENGTH 10, + str TYPE string, + dref TYPE REF TO i, + struct TYPE zdemo_abap_flsch, + str_tab TYPE string_table, + tab TYPE TABLE OF zdemo_abap_flsch WITH EMPTY KEY, + END OF loc_deep_struct. + +DATA it_struc_7 TYPE TABLE OF loc_deep_struct WITH EMPTY KEY. ``` @@ -576,26 +592,9 @@ DATA it_tab_5 TYPE xstring_table. DATA it_tab_6 TYPE zdemo_abap_get_data_itf=>carr_tab. DATA it_tab_7 TYPE zcl_demo_abap_amdp=>flsch_tab. -"Excursion "Creating an internal table based on the table type of an existing "internal table DATA it_tab_8 LIKE it_tab_7. - -"Many of the previous examples demonstrate flat line types. -"Deep line types are also possible, that is, the line type -"can include components such as strings, references, and internal -"tables. -TYPES: BEGIN OF loc_deep_struct, - key_field TYPE i, - char TYPE c LENGTH 10, - str TYPE string, - dref TYPE REF TO i, - struct TYPE zdemo_abap_flsch, - str_tab TYPE string_table, - tab TYPE TABLE OF zdemo_abap_flsch WITH EMPTY KEY, - END OF loc_deep_struct. - -DATA it_tab_9 TYPE TABLE OF loc_deep_struct WITH EMPTY KEY. ``` @@ -638,34 +637,39 @@ it_ref_3 = VALUE #( ( NEW i( 3 ) ) "Elementary type "The examples show the copying of a table including the content "on the fly and creating the table in one step. The data type of the "declared variable is determined by the right side. -DATA(it41) = it40. -DATA(it42) = it41. +DATA string_tab TYPE string_table. + +DATA(it_a) = string_tab. +DATA(it_b) = it_a. "Using FINAL for creating immutable variables -FINAL(it43) = it40. +FINAL(it_c) = it_a. +"For example, it is not possible to modify such a table in the following position. +"Find more information in the Data Types and Data Objects cheat sheet. +"APPEND INITIAL LINE TO it_c. "As shown below and in other cheat sheets, constructor operators "are handy when creating internal tables in place. The following "examples uses the VALUE operator and an internal table type. -DATA(it44) = VALUE tt_std( ( key_field = 1 char1 = 'aaa' ) - ( key_field = 2 char1 = 'bbb' ) ). +DATA(it_d) = VALUE string_table( ( `aaa` ) + ( `bbb` ) ). "Not providing any table lines means the table is initial "and has the same effect as the declaration of it46. -DATA(it45) = VALUE tt_std( ). -DATA it46 TYPE tt_std. +DATA(it_e) = VALUE string_table( ). +DATA it_f TYPE string_table. "Excursion "Table declared inline in the context of a SELECT statement; "a prior extra declaration of an internal table is not needed. -SELECT * FROM zdemo_abap_fli INTO TABLE @DATA(it47). +SELECT * FROM zdemo_abap_fli INTO TABLE @DATA(it_g). "Instead of -DATA it48 TYPE TABLE OF zdemo_abap_fli WITH EMPTY KEY. -SELECT * FROM zdemo_abap_fli INTO TABLE @it48. +DATA it_h TYPE TABLE OF zdemo_abap_fli WITH EMPTY KEY. +SELECT * FROM zdemo_abap_fli INTO TABLE @it_h. "Using FINAL -SELECT * FROM zdemo_abap_fli INTO TABLE @FINAL(it49). +SELECT * FROM zdemo_abap_fli INTO TABLE @FINAL(it_i). ```

⬆️ back to top

@@ -729,7 +733,7 @@ and [`APPEND`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index. to add lines to internal tables.
- Notes on using APPEND and INSERT + 🟢 Click to expand for notes on using APPEND and INSERT - `APPEND` ... @@ -1224,11 +1228,11 @@ INSERT VALUE s( a = 'yyy' b = 3 ) INTO TABLE dref_tab->*. ### Example: Exploring Populating Internal Tables -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. +Expand the following collapsible section for example code. 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. The example is set up to display output in the console, but only for few data objects. You may want to set a break point at the earliest possible position and walk through the example in the debugger. This will allow you to double-click on data objects and observe how the different statements affect their contents.
- Expand to view the code + 🟢 Click to expand for a code example ```abap @@ -2021,7 +2025,7 @@ READ TABLE itab WITH KEY ... BINARY SEARCH ...
- Expand to view more information and a code snippet + 🟢 Click to expand for more information and a code example - `READ TABLE` without `BINARY SEARCH`: Table is accessed linearly @@ -2156,11 +2160,11 @@ ENDCLASS. ### Example: Exploring READ TABLE Statements and Table Expressions -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. +Expand the following collapsible section for example code. 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. The example is not set up to display output in the console. You may want to set a break point at the first position possible and walk through the example in the debugger. This will allow you to double-click on data objects and observe how the different statements affect their contents.
- Expand to view the code + 🟢 Click to expand for example code ```abap @@ -4109,10 +4113,10 @@ Notes on ... - fast and optimized for both primary and secondary table keys - consistent for large internal tables due to a special hash algorithm -Expand the following collapsible section to view the code of the example that you can copy and paste into a demo class and run choosing *F9* in ADT. Note that, when running the class, it may take a while to complete and display output in the console. +Expand the following collapsible section for example code. 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. Note that, when running the class, it may take a while to complete and display output in the console.
- Expand to view the code + 🟢 Click to expand for example code ```abap diff --git a/03_ABAP_SQL.md b/03_ABAP_SQL.md index 3049565..c2b81e4 100644 --- a/03_ABAP_SQL.md +++ b/03_ABAP_SQL.md @@ -67,7 +67,7 @@ ## Excursion: Database Tables and Views
- Expand to view the details + 🟢 Click to expand for more details
This section provides bullet points on database tables and views which contain persisted data. Note that the code snippets in this cheat sheet focus on database tables as [data source](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abendata_source_glosry.htm "Glossary Entry") for ABAP SQL statements. @@ -78,7 +78,7 @@ This section provides bullet points on database tables and views which contain p - are two-dimensional matrices consisting of rows and columns. - contain a [table key](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentable_key_glosry.htm), i. e. a field or a combination of fields uniquely identifies every row in a table. A [primary key](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenprimary_key_glosry.htm) must exist for every database table. - Note the concept of [foreign keys](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenforeign_key_glosry.htm) in which one or more columns of a database table can be primary keys of another table. See more information [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenddic_database_tables_forkey.htm). -- have a [flat structure](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenflat_structure_glosry.htm "Glossary Entry") +- have a non-[nested structure](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abennested_structure_glosry.htm) type. Plus, the definition of database tables consists of [technical](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenddic_database_tables_techstruc.htm) and [semantic](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenddic_database_tables_semastruc.htm) properties. - can be referenced as a data type and can be accessed using ABAP SQL. diff --git a/04_ABAP_Object_Orientation.md b/04_ABAP_Object_Orientation.md index 7978d1b..820e79e 100644 --- a/04_ABAP_Object_Orientation.md +++ b/04_ABAP_Object_Orientation.md @@ -189,7 +189,7 @@ ENDCLASS. The following simplified example demonstrates include programs.
- Expand to view the details + 🟢 Click to expand for more details Global class: @@ -2263,10 +2263,10 @@ i_ref = NEW class( ). ### Excursion: Example Interface -Expand the following collapsible section to view the code of an example. To try it out, create a demo interface named `zif_some_interface`, a class named `zcl_some_class`, and paste the code into the artifacts. After activation, choose *F9* in ADT to execute the class. The example is set up to display output in the console. +Expand the following collapsible section for example code. To try it out, create a demo interface named `zif_some_interface`, a class named `zcl_some_class`, and paste the code into the artifacts. After activation, choose *F9* in ADT to execute the class. The example is set up to display output in the console.
- Expand to view the details + 🟢 Click to expand for more information and example code
diff --git a/08_EML_ABAP_for_RAP.md b/08_EML_ABAP_for_RAP.md index 347e749..40df57f 100644 --- a/08_EML_ABAP_for_RAP.md +++ b/08_EML_ABAP_for_RAP.md @@ -874,12 +874,12 @@ Several BDEF derived types contain `%` components, which have a specific type an | Type | Structured Constant | Details | | -------- | ------- | ------- | -| ABP_BEHV_FLAG | IF_ABAP_BEHV=>MK | Marks and unmarks fields in ABAP EML modify and read operations, such as in %control and %element. | -| ABP_BEHV_FIELD_PERM | IF_ABAP_BEHV=>PERM-F | Used in the context of field permission results, such as a field marked as mandatory or read-only. | -| ABP_BEHV_OP_PERM | IF_ABAP_BEHV=>PERM-O | For operation permission results, such as a delete operation that is marked as enabled. | -| ABP_BEHV_FIELD_CTRL | IF_ABAP_BEHV=>FC-F | For field feature control results, such as a field marked with no restrictions. | -| ABP_BEHV_OP_CTRL | IF_ABAP_BEHV=>FC-O | For operation feature control results, such as a disabled update operation. | -| ABP_BEHV_AUTH | IF_ABAP_BEHV=>AUTH | For authorization results, such as an unauthorized operation. | +| `ABP_BEHV_FLAG` | `IF_ABAP_BEHV=>MK` | Marks and unmarks fields in ABAP EML modify and read operations, such as in `%control` and `%element`. | +| `ABP_BEHV_FIELD_PERM` | `IF_ABAP_BEHV=>PERM-F` | Used in the context of field permission results, such as a field marked as mandatory or read-only. | +| `ABP_BEHV_OP_PERM` | `IF_ABAP_BEHV=>PERM-O` | For operation permission results, such as a delete operation that is marked as enabled. | +| `ABP_BEHV_FIELD_CTRL` | `IF_ABAP_BEHV=>FC-F` | For field feature control results, such as a field marked with no restrictions. | +| `ABP_BEHV_OP_CTRL` | `IF_ABAP_BEHV=>FC-O` | For operation feature control results, such as a disabled update operation. | +| `ABP_BEHV_AUTH` | `IF_ABAP_BEHV=>AUTH` | For authorization results, such as an unauthorized operation. |

⬆️ back to top

@@ -1746,6 +1746,8 @@ contains all relevant components for the chosen scenario. >``` > In cases where different data objects of key component groups of a BDEF derived type are to be assigned to the same key component group of the same entity, a direct assignment works without a syntax warning because the content is identical. A direct assignment is recommended (`...wa1_root-%tky = wa2_root-%tky ...`). The use of the `CORRESPONDING` operator is unnecessary and less performant. This is true, for example, for key component group assignments in the context of RAP response parameters failed and reported. +

⬆️ back to top

+ ### RAP Concepts **RAP numbering** @@ -1828,6 +1830,8 @@ contains all relevant components for the chosen scenario. > keys that are to be contained in `%key`. +

⬆️ back to top

+ ### Ensuring Data Consistency in a RAP Transaction The [LUW](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenluw_glosry.htm) concept, which deals with the transfer of data from one consistent state to another, applies to applications using RAP. RAP transactions are integrated with the [SAP LUW](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensap_luw_glosry.htm), which is a prerequisite for transactional consistency. RAP provides a standardized approach and rules ([RAP BO contract](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_bo_contract_glosry.htm)) for the [RAP business object (BO)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_bo_glosry.htm) runtime to ensure that the RAP transaction is correctly implemented, data inconsistencies are avoided, and the SAP LUW is successfully completed. @@ -1958,7 +1962,6 @@ The [ABAP Unit Tests](14_ABAP_Unit_Tests.md) cheat sheet includes an example dem Note that there is a RAP-specific variant of the `CREATE OBJECT` statement available. [`CREATE OBJECT ... FOR TESTING.`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapcreate_object_for_testing.htm) enables the instantiation of RAP handler classes. Find more information in the [Development guide for the ABAP RESTful Application Programming Model](https://help.sap.com/docs/abap-cloud/abap-rap/test). -

⬆️ back to top

## More Information diff --git a/13_Program_Flow_Logic.md b/13_Program_Flow_Logic.md index 488e525..6eaa69e 100644 --- a/13_Program_Flow_Logic.md +++ b/13_Program_Flow_Logic.md @@ -655,7 +655,7 @@ CALL FUNCTION func_name PARAMETER-TABLE ptab. Expand the following section to get a simple executable example:
- Expand to view the details + 🟢 Click to expand for more information and example code The following example demonstrates a simple function module: diff --git a/14_ABAP_Unit_Tests.md b/14_ABAP_Unit_Tests.md index 029f966..0b5ba19 100644 --- a/14_ABAP_Unit_Tests.md +++ b/14_ABAP_Unit_Tests.md @@ -577,10 +577,10 @@ To run the example, follow these steps: > - Refer to the code comments, SAP Help Portal and class documentation for additional information. -Expand the following collapsible section to view the code of an example. +Expand the following collapsible section for example code.
- Expand to view the example code + 🟢 Click to expand for example code
diff --git a/16_Data_Types_and_Objects.md b/16_Data_Types_and_Objects.md index 615b72a..ef247fb 100644 --- a/16_Data_Types_and_Objects.md +++ b/16_Data_Types_and_Objects.md @@ -24,7 +24,7 @@ - [Terms Related to Data Types and Objects in a Nutshell](#terms-related-to-data-types-and-objects-in-a-nutshell) - [Notes on the Declaration Context](#notes-on-the-declaration-context) - [Excursions](#excursions) - - [Enumerated Types and Objects](#enumerated-types-and-objects) + - [ABAP Enumerated Types and Objects](#abap-enumerated-types-and-objects) - [Getting Type Information and Creating Types/Data Objects at Runtime](#getting-type-information-and-creating-typesdata-objects-at-runtime) - [Ranges Tables](#ranges-tables) - [Typed Literals in ABAP SQL](#typed-literals-in-abap-sql) @@ -481,7 +481,9 @@ CAST zcl_demo_abap_objects( )->another_string = `ABAP`. - The ABAP Dictionary (DDIC) serves as a persistent repository for type definitions represented by dictionary objects. - These objects constitute global data types that are accessible by other repository objects. +- For many of the classic DDIC objects, which are still supported in [ABAP Cloud](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_cloud_glosry.htm), CDS-based successor objects are available. - Find a high-level overview in the [ABAP Dictionary](26_ABAP_Dictionary.md) cheat sheet. +- Note that there are predefined global types available. However, in ABAP Cloud, only [released APIs](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenreleased_api_glosry.htm) can be used there.

⬆️ back to top

@@ -1143,11 +1145,11 @@ In [ABAP programs](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/in | `space` constant | It is of type type `c`, length 1, and contains a blank character. | | `me` self-reference | Used in ABAP Objects, it's a local reference variable for instance method implementations. At runtime, it points to the instance executing the method. It is primarily used to be explicit about, for exmaple, using instance attributes of the class, especially if there is a local data object with the same name.| -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. The example is set up to display output in the console. +Expand the following collapsible section for example code. 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. The example is set up to display output in the console.
- Expand to view the code + 🟢 Click to expand for example code ```abap @@ -1782,11 +1784,12 @@ The declaration context of data types (and objects) determines the validity and

⬆️ back to top

## Excursions -### Enumerated Types and Objects +### ABAP Enumerated Types and Objects - ABAP supports the concept of enumerations. - Enumerations are a mixture of types and constants. - An [enumerated type](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenenum_type_glosry.htm) specifies a value set in addition to the actual type properties. - [Enumerated objects](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenenumerated_object_glosry.htm) - data objects with an enumerated type - are mainly used to check allowed values. This usually restricts the actual parameters passed to methods to the enumerated values defined in the class. [Enumerated variables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenenumerated_variable_glosry.htm) are variable enumerated objects. They can only contain the associated enumerated values. +- [CDS enumerated types](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_enum_type_glosry.htm) are also available. Find more information in the [ABAP Dictionary (DDIC)](26_ABAP_Dictionary.md) cheat sheet. Syntax: diff --git a/17_SAP_LUW.md b/17_SAP_LUW.md index 57d006e..5fdeb09 100644 --- a/17_SAP_LUW.md +++ b/17_SAP_LUW.md @@ -388,7 +388,7 @@ After the import of the repository, proceed as follows:
- Expand to see explanations of the executable example + 🟢 Click to expand for more information
The example demonstrates the SAP LUW using dynpros and bundling techniques with update function modules and subroutines. In the dynpros, you can select various options that determine how the program runs. It covers the following aspects: diff --git a/18_Dynpro.md b/18_Dynpro.md index a79bff7..90132b7 100644 --- a/18_Dynpro.md +++ b/18_Dynpro.md @@ -745,7 +745,7 @@ After the import of the repository, proceed as follows:
- Expand to see explanations of the executable example + 🟢 Click to expand for more information
The example demonstrates dynpro-related statements. In the dynpros, you can select various options for checking out the effect of the syntax. diff --git a/21_XML_JSON.md b/21_XML_JSON.md index 3336b4e..be50e93 100644 --- a/21_XML_JSON.md +++ b/21_XML_JSON.md @@ -728,12 +728,12 @@ ENDCLASS. > - For additional information and examples, see the [ABAP and JSON](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_json.htm) section of the ABAP Keyword Documentation. -Expand the following collapsible sections to view the code of 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. This example is set up to display output in the console. +Expand the following collapsible section for example classes. 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. This example is set up to display output in the console. **Creating JSON Data using the sXML library**
- Expand to view the code + 🟢 Click to expand for example code - The `create` method from the `cl_sxml_string_writer` class is used to create a JSON writer by setting the type to `if_sxml=>co_xt_json`. @@ -833,7 +833,7 @@ ENDCLASS. **Reading JSON Data using the sXML library**
- Expand to view the code + 🟢 Click to expand for example code - An internal table is created for display purposes. This table is populated when iterating over all nodes. It includes information such as the node's value. @@ -1129,10 +1129,10 @@ DATA json_to_abap_table TYPE string_table. CHANGING data = json_to_abap_table ). ``` -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 output in the console. +Expand the following collapsible section for example code. 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 output in the console.
- Expand to view the code + 🟢 Click to expand for example code ```abap @@ -1281,10 +1281,10 @@ ENDCLASS. - 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 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 the following collapsible section for example classes. 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 + 🟢 Click to expand for example code - 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. diff --git a/22_Misc_ABAP_Classes.md b/22_Misc_ABAP_Classes.md index 983af85..034b5c9 100644 --- a/22_Misc_ABAP_Classes.md +++ b/22_Misc_ABAP_Classes.md @@ -2394,7 +2394,7 @@ To check out examples in demo classes, expand the collapsible sections below.
- 1. Read example: Getting Markdown content and sending ZIP file via email + 🟢 1. Read example: Getting Markdown content and sending ZIP file via email > **⚠️ Note/Disclaimer**
@@ -2558,7 +2558,7 @@ ENDCLASS.
- 2. Post example: Demonstrating a post request by converting Markdown to HTML using the GitHub API + 🟢 2. Post example: Demonstrating a post request by converting Markdown to HTML using the GitHub API > **⚠️ Note/Disclaimer**
@@ -2650,10 +2650,10 @@ The XCO library offers classes such as `XCO_CP_XLSX` and methods for reading and - A demo class explores a selection of XCO classes and methods. You can find the code in the expandable section. - Exporting the adapted XLSX content (not related to the XCO library; just to visualize newly created XLSX content using XCO) -Expand the following collapsible section to view the steps and code of the example. +Expand the following collapsible section for example code.
- Expand to view the details + 🟢 Click to expand for example code
diff --git a/25_Authorization_Checks.md b/25_Authorization_Checks.md index b02f738..8fca1c7 100644 --- a/25_Authorization_Checks.md +++ b/25_Authorization_Checks.md @@ -129,10 +129,10 @@ The following topic covers authorization-related terms and provides you with the > - The purpose of the example is that activities are only allowed when the *countryfr* value is *US*. This is checked by the authorization check examples in the class further down. -Expand the following collapsible section to view the implementation steps required for the executable example. +Expand the following collapsible section for the implementation steps required for the executable example.
- Expand to view the implementation steps + 🟢 Click to expand for the implementation steps
@@ -251,10 +251,10 @@ For creating a CDS access control, proceed as follows: ### Example Class -Expand the following collapsible section to view the code of an example class. Provided that the implementation steps have been walked through, the example explores explicit and implicit authorization checks. To try it out, create a demo class named `zcl_demo_abap_auth` and paste the code into it. After activation, choose *F9* in ADT to execute the class. The example is set up to display output in the console. +Expand the following collapsible section for example code. Provided that the implementation steps have been walked through, the example explores explicit and implicit authorization checks. To try it out, create a demo class named `zcl_demo_abap_auth` and paste the code into it. After activation, choose *F9* in ADT to execute the class. The example is set up to display output in the console.
- Expand to view the class code + 🟢 Click to expand for example code
diff --git a/26_ABAP_Dictionary.md b/26_ABAP_Dictionary.md index 2d51a6f..d834edf 100644 --- a/26_ABAP_Dictionary.md +++ b/26_ABAP_Dictionary.md @@ -41,14 +41,14 @@ This cheat sheet ... - These objects constitute global data types that are accessible by other repository objects. - Many of these objects can also be accessed in CDS objects and ABAP itself. - DDIC provides built-in and predefined data types, but also allows for the creation of custom data types. -- The data types that can be defined in the DDIC, similar to the ABAP language. The types include the following: +- The data types that can be defined in the DDIC, similar to the ABAP language, include the following: - Elementary types - Structured types - Table types - Reference types - They provide the same functionality as the local types that can be defined in ABAP programs with `TYPES` statements. - DDIC also enables the creation of additional objects, such as database tables, which are then created in the underlying database. -- Furthermore, the DDIC includes objects that support development in various contexts, such as lock objects related to the [SAP LUW concept](17_SAP_LUW.md). +- Furthermore, the DDIC includes objects that support development in various contexts, such as lock objects related to the [SAP LUW concept](17_SAP_LUW.md) and more. They are not outlined here. - DDIC offers many objects and functionalities particularly suited for classic ABAP technologies and user interfaces, such as dynpros. However, these are not relevant in ABAP Cloud and are not covered in this cheat sheet. For example, DDIC search helps (that are used to created value lists for input fields on dynpros) can be replaced by CDS-based search helps. - The more modern concept, ABAP CDS, is integrated into the DDIC, allowing for the creation of dedicated CDS objects that can replace DDIC objects to be used in newer concepts like RAP. - DDIC objects are transportable. @@ -80,14 +80,14 @@ DDIC supports the following data types: - In ABAP programs, the built-in dictionary types are mapped to corresponding ABAP data types. - For all available types and more details, refer to the [ABAP Keyword Documentation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenddic_builtin_types.htm). The following list shows a selection of available built-in dicitionary types: - | Built-in DDIC Type | Details | + | Built-in Dictionary Type | Details | |---|---| | `int4` | Represents 4-byte integers
Mapped to the ABAP type `i` | - | `char` | Represents strings of fixed length
Mapped to the ABAP type `c` with a dedicated length
For example, in database tables and fields of CDS entities, the maximum length is 1333 characters. | + | `char` | Represents strings of fixed length
Mapped to the ABAP type `c` with a dedicated length
For example, in database tables and fields of CDS entities, the maximum length is 1333 characters.

The built-in dictionary type `clnt` is a special character-like type and has special semantics. It denotes the [client column](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclient_column_glosry.htm) in [client-dependent](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclient_dependent_glosry.htm) DDIC database tables. The type is mapped to the ABAP type `c`, length 3. | | `string` | Represents strings of variable length
In DDIC, it is handled like a character large object/CLOB.
A maximum length can be specified, but there is no upper limit. The type cannot be used to specify key fields in database tables. In the tables, a maximum length of at least 256 can be specfied to restrict the length of database table fields.
Mapped to the identically named ABAP type `string`

Another built-in dicitionary type mapped to the ABAP type `string` is `sstring`, which represents shorter text strings having a maximum length of 1333. It is handled like `char` and can be used as type for a database table key field (unlike `string`; note that trailing blanks are removed). | | `datn`/`timn` | Represent date and time formats
Mapped to `d`/`t`

`dats`/`tims` are older types. `datn`/`timn` are preferred because `dats`/`tims` require conversion to actual date and time types. | - | `utclong` | Represents numeric text
Mapped to `n` | - | `numc` | Represents time stamps
Mapped to the identically named ABAP data type `utclong` | + | `utclong` | Represents time stamps
Mapped to the identically named ABAP data type `utclong` | + | `numc` | Represents numeric text
Mapped to `n` | | `raw` | Represents byte strings
Mapped to `x` | @@ -138,7 +138,7 @@ SELECT SINGLE ### DDIC Data Types They can be ... -- defined in the DDIC are global data types. +- defined in the DDIC and represent [global types](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenglobal_type_glosry.htm). - accessed by all repository objects (as long as the package concept allows it). - referenced in ABAP programs, for example, using `TYPES` and `DATA` statements. - used to type components in other repository objects. @@ -325,10 +325,10 @@ The following example creates two DDIC structures exploring several options: - DDIC table types ... - are complex types that describe internal tables in ABAP. - - are defined by the following properties. For additional details, refer to the Internal Tables cheat sheet. + - are defined by the following properties. For additional details, refer to the [Internal Tables](01_Internal_Tables.md) cheat sheet. - Line type (can be elementary, reference, or structured types; the latter may use DDIC database tables; note: CDS entities are not allowed) - Table category (options include standard, sorted, hashed, or generic category index for standard and sorted) - - Table key (the primary table key can be empty, standard, or consist of specific components; secondary table keys and alias names for the keys can be specified) + - Table key (the primary table key can be empty, standard, or consist of specific components; secondary table keys and an alias name an be specified) - are not to be confused with DDIC database tables, which represent tables on the database. **Example: DDIC Table Type** @@ -549,7 +549,7 @@ The following example creates two DDIC database tables exploring several options - While ABAP Cloud still supports several DDIC objects, some have ABAP CDS-based successors. These successors offer advanced functionalities and support modern concepts such as ABAP RAP, which relies on data models defined in ABAP CDS and RAP behavior definitions that determine the model behavior. > **💡 Note**
-> - This cheat sheet only emphasizes ABAP CDS objects as global types to be used in ABAP. It does not cover use cases, data modeling aspects, annotations, syntax, and more. Refer to the [documentation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds.htm) for the complete picture. The executable example of the CDS View Entities cheat sheet provides a demonstration of a selection of CDS-related syntax. +> - This cheat sheet only emphasizes ABAP CDS objects as global types to be used in ABAP. It does not cover use cases, data modeling aspects, annotations, syntax, and more. Refer to the [documentation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds.htm) for the complete picture. The executable example of the [CDS View Entities](15_CDS_View_Entities.md) cheat sheet provides a demonstration of a selection of CDS-related syntax. > - ABAP CDS objects are created in ADT from source code. ### CDS Types Usable as Elementary Types @@ -757,7 +757,7 @@ SELECT * FROM zdemo_abap_table_function INTO TABLE @itab_cds_tabfunc. ### Finding Released Repository Objects in the System -In an SAP BTP ABAP environment and using ADT, you can find released repository objects in the *Project Explorer* view under *Released Objects* +In an SAP BTP ABAP environment and using ADT, you can find released repository objects in the *Project Explorer* view under *Released Objects*: ![Released APIs](./files/released_APIs.png) @@ -775,7 +775,7 @@ SELECT ReleasedObjectType, ReleasedObjectName, ReleaseState ### Creating Repository Objects Programmatically with XCO -Using the [XCO library](https://help.sap.com/docs/btp/sap-business-technology-platform/generation-apis), you can create ABAP repository objects programmatically. The executable example of the [ABAP for Cloud Development](22_Misc_ABAP_Classes.md#generating-abap-repository-objects) cheat sheet includes demo code snippets. For more information, refer to the [documentation](https://help.sap.com/docs/btp/sap-business-technology-platform/generation-apis). +Using the [XCO library](https://help.sap.com/docs/btp/sap-business-technology-platform/generation-apis), you can create ABAP repository objects programmatically. The executable example ([zcl_demo_abap_cloud_excursion](src/zcl_demo_abap_cloud_excursion.clas.abap)) of the [ABAP for Cloud Development](19_ABAP_for_Cloud_Development.md) cheat sheet includes demo code snippets. For more information, refer to the [documentation](https://help.sap.com/docs/btp/sap-business-technology-platform/generation-apis).

⬆️ back to top

@@ -793,13 +793,13 @@ Using the [XCO library](https://help.sap.com/docs/btp/sap-business-technology-pl ## Executable Example > **💡 Note**
-> - The executable example uses both the created repository objects as described in this cheat sheet and some repository objects of the ABAP cheat sheet repository. The example explores and uses code snippets of this cheat sheets, emphasizing the use of global types in ABAP programs. +> - The executable example uses both the created repository objects as described in this cheat sheet and some repository objects of the ABAP cheat sheet repository. The example explores and uses code snippets of this cheat sheet, emphasizing the use of global types in ABAP programs. > - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) -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. The example is set up to display output in the console. +Expand the following collapsible section for example code. 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. The example is set up to display output in the console.
- Expand to view the code + 🟢 Click to expand for example code diff --git a/README.md b/README.md index 31ec81c..12155d9 100644 --- a/README.md +++ b/README.md @@ -89,11 +89,11 @@ ABAP cheat sheets[^1] ... |[Dynpro](18_Dynpro.md)|Provides a high-level overview of dynpro topics with a focus on dynpro-related statements
💡 The content of this cheat sheet and the executable example are only relevant to [classic ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclassic_abap_glosry.htm).|Program `ZDEMO_ABAP_DYNPRO`| |[Selection Screens and Classic Lists](20_Selection_Screens_Lists.md)|Provides a high-level overview of selection screens and classic lists with a focus on related statements. It includes an excursion into the SAP List Viewer (ALV).
💡 The content of this cheat sheet and the executable examples are only relevant to [classic ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclassic_abap_glosry.htm).|Program `ZDEMO_ABAP_SELSCR_LISTS_INTRO` (the "intro" program, from which the other related example programs can be started)| |[Working with XML and JSON in ABAP](21_XML_JSON.md)|Covers processing XML using class libraries, XML transformations using XSLT and Simple Transformations (ST), serializations (ABAP to XML) and deserializations (XML to ABAP), dealing with JSON data|[zcl_demo_abap_xml_json](./src/zcl_demo_abap_xml_json.clas.abap)| -|[Misc ABAP Classes](22_Misc_ABAP_Classes.md)|Contains a selection of ABAP classes, serving as a quick introduction, along with code snippets to explore the functionality in action|-| +|[Misc ABAP Classes](22_Misc_ABAP_Classes.md)|Contains a selection of ABAP classes, serving as a quick introduction, along with code snippets to explore the functionality in action|- (The cheat sheet includes copy and paste code snippets and example classes)| |[Date, Time, and Time Stamp](23_Date_and_Time.md)|Covers how to handle and process dates, times, and time stamps in ABAP|[zcl_demo_abap_date_time](./src/zcl_demo_abap_date_time.clas.abap)| -|[Misc Built-In Functions](24_Misc_Builtin_Functions.md)|Covers a variety of built-in functions in ABAP|-| -|[Authorization Checks](25_Authorization_Checks.md)|Provides a high-level overview of explicit and implicit authorization checks in ABAP|-| -|[ABAP Dictionary](26_ABAP_Dictionary.md)|Covers a selection of repository objects in the ABAP Dictionary (DDIC) that represent global types|-| +|[Misc Built-In Functions](24_Misc_Builtin_Functions.md)|Covers a variety of built-in functions in ABAP|- (The cheat sheet includes copy and paste code snippets)| +|[Authorization Checks](25_Authorization_Checks.md)|Provides a high-level overview of explicit and implicit authorization checks in ABAP|- (The cheat sheet includes a copy and paste example class)| +|[ABAP Dictionary](26_ABAP_Dictionary.md)|Covers a selection of repository objects in the ABAP Dictionary (DDIC) that represent global types|- (The cheat sheet includes a copy and paste example class)|
diff --git a/src/zbp_demo_abap_rap_ro_u.clas.locals_imp.abap b/src/zbp_demo_abap_rap_ro_u.clas.locals_imp.abap index 1b00e7f..26f7b7c 100644 --- a/src/zbp_demo_abap_rap_ro_u.clas.locals_imp.abap +++ b/src/zbp_demo_abap_rap_ro_u.clas.locals_imp.abap @@ -446,12 +446,12 @@ CLASS lhc_root IMPLEMENTATION. TO failed-root. CATCH cx_abap_lock_failure. APPEND VALUE #( %key = CORRESPONDING #( lr_key->* ) - %fail-cause = if_abap_behv=>cause-unspecific ) + %fail-cause = if_abap_behv=>cause-locked ) TO failed-root. ENDTRY. ENDLOOP. CATCH cx_abap_lock_failure. - APPEND VALUE #( %fail-cause = if_abap_behv=>cause-unspecific ) + APPEND VALUE #( %fail-cause = if_abap_behv=>cause-locked ) TO failed-root. ENDTRY. ENDMETHOD.