From 4a0fe907de7905532dacb9d60b9b69896f1193f2 Mon Sep 17 00:00:00 2001 From: danrega <16720986+danrega@users.noreply.github.com> Date: Fri, 3 Nov 2023 13:05:42 +0100 Subject: [PATCH] Update --- 03_ABAP_SQL.md | 24 +++++++++++++++++++++++- 04_ABAP_Object_Orientation.md | 4 ++-- 07_String_Processing.md | 2 ++ 08_EML_ABAP_for_RAP.md | 6 ++++-- 16_Data_Types_and_Objects.md | 2 +- 19_ABAP_for_Cloud_Development.md | 7 ++++--- README.md | 1 + 7 files changed, 37 insertions(+), 9 deletions(-) diff --git a/03_ABAP_SQL.md b/03_ABAP_SQL.md index c487197..ebf3150 100644 --- a/03_ABAP_SQL.md +++ b/03_ABAP_SQL.md @@ -128,7 +128,6 @@ Views](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm

⬆️ back to top

- ## Reading Data Using SELECT ### Basic Syntax @@ -349,6 +348,8 @@ SELECT ds~col1, ds~col2, ds~col3 INTO ... ``` +

⬆️ back to top

+ **Reading data from a database table in another client** ([classic ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclassic_abap_glosry.htm) only ). Note that there are several variants of the `USING ...` addition for switching the [implicit client handling (F1 docu for standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_sql_client_handling.htm) from the current client to other clients. See more information [here (F1 docu for standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapselect_client.htm). ``` abap "Some examples; not available in ABAP for Cloud Development @@ -376,6 +377,7 @@ SELECT * INTO TABLE @DATA(itab2). ``` +

⬆️ back to top

`INTO` **clause**: @@ -614,6 +616,8 @@ SELECT FROM zdemo_abap_flsch "UP TO @( 10 - 7 ) ROWS. "Host expression ``` +

⬆️ back to top

+ #### SQL Expressions - Expressions in an ABAP SQL statement that are passed to the database @@ -682,6 +686,8 @@ SELECT SINGLE INTO @DATA(numeric_functions). ``` +

⬆️ back to top

+ Example: [String functions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensql_string_func.htm) ``` abap @@ -801,6 +807,8 @@ SELECT SINGLE INTO @DATA(string_functions). ``` +

⬆️ back to top

+ Example: [Special functions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_sql_special_functions.htm) ``` abap @@ -850,6 +858,8 @@ FROM zdemo_abap_carr INTO @DATA(special_functions). ``` +

⬆️ back to top

+ [Aggregate expressions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_aggregate.htm) - Consist of [aggregate @@ -896,6 +906,8 @@ SELECT INTO TABLE @DATA(agg_exp). ``` +

⬆️ back to top

+ ##### More SQL Expressions - [Arithmetic @@ -965,6 +977,8 @@ WHERE carrid = 'AA' INTO @DATA(more_sql_expr). ``` +

⬆️ back to top

+ ##### Window Expressions How [window expressions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenwindow_expression_glosry.htm "Glossary Entry") work: @@ -1062,6 +1076,8 @@ SELECT carrid, currency, fldate, INTO TABLE @DATA(result). ``` +

⬆️ back to top

+ ### SQL Conditions You can formulate conditions in ABAP SQL statements, i. e. [logical @@ -1135,6 +1151,8 @@ SELECT * INTO TABLE @DATA(itab_where). ``` +

⬆️ back to top

+ ### Selecting Data by Evaluating the Content of Other Tables [`FOR ALL ENTRIES`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenwhere_all_entries.htm) @@ -1173,6 +1191,8 @@ SELECT comp1, comp2, comp3 INTO ... ``` +

⬆️ back to top

+ ### Combining Data of Multiple Database Tables **Using an [inner join](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abeninner_join_glosry.htm)**: @@ -1226,6 +1246,8 @@ UNION INTO ... ``` +

⬆️ back to top

+ #### Common Table Expressions (CTE) When to use [Common Table Expressions (CTE)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencommon_table_expression_glosry.htm): diff --git a/04_ABAP_Object_Orientation.md b/04_ABAP_Object_Orientation.md index 1f556d8..398c151 100644 --- a/04_ABAP_Object_Orientation.md +++ b/04_ABAP_Object_Orientation.md @@ -253,7 +253,7 @@ Declaring attributes in visibility sections. In the code snippet below, all attr CLASS local_class DEFINITION. PUBLIC SECTION. - TYPES: some_type TYPE c LENGTH 3. "Type declaration + TYPES some_type TYPE c LENGTH 3. "Type declaration DATA: inst_number TYPE i, "Instance attributes inst_string TYPE string, @@ -262,7 +262,7 @@ CLASS local_class DEFINITION. CLASS-DATA: stat_number TYPE i, "Static attributes stat_char TYPE c LENGTH 3. - CONSTANTS: const_num TYPE i VALUE 123. "Non-changeable constant + CONSTANTS const_num TYPE i VALUE 123. "Non-changeable constant PROTECTED SECTION. "Here go more attributes if needed. diff --git a/07_String_Processing.md b/07_String_Processing.md index 924f677..938d58e 100644 --- a/07_String_Processing.md +++ b/07_String_Processing.md @@ -143,6 +143,8 @@ DATA char(4) TYPE c. "Just a TYPE c specification without length means LENGTH 1. DATA char_len_one TYPE c. +"No type and length specification: TYPE c LENGTH 1 by default +DATA char_no_type_len. ```

⬆️ back to top

diff --git a/08_EML_ABAP_for_RAP.md b/08_EML_ABAP_for_RAP.md index 8a37be5..021764c 100644 --- a/08_EML_ABAP_for_RAP.md +++ b/08_EML_ABAP_for_RAP.md @@ -752,6 +752,7 @@ MODIFY ENTITIES OF root_ent "full name of root entity creating a root entity instance and related instances of a child entity in one EML request). Long and short forms are also available for other EML statements. +>- The [`SET FIELDS WITH`](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapmodify_entity_entities_fields.htm#!ABAP_VARIANT_4@4@) addition is available as another field specification option. However, it has limitations that you should be aware of. It can cause syntax warnings. Check the documentation. It is recommended that you use `FIELDS ... WITH` and `FROM`. The following EML statement combines multiple operations in one EML request. It demonstrates the use of `%cid` and @@ -1342,11 +1343,12 @@ The following restrictions apply to operations and/or statements in the individu |[bgRFC](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenbgrfc_glosry.htm) (`CALL FUNCTION ... IN BACKGROUND UNIT`)

(unrestricted ABAP language scope)| -| -| X| | |[tRFC](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abentrfc_2_glosry.htm), [qRFC](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenqrfc_glosry.htm) (`CALL FUNCTION ... IN BACKGROUND TASK`)

(unrestricted ABAP language scope)| -| -| - |Obsolete technologies. | |`PERFORM ON COMMIT`, `PERFORM ON ROLLBACK`

(unrestricted ABAP language scope)|(X) |(X) |X |Basically possible in all phases, but should be reserved for the late save. Note: The use of these statements indicates improper integration with RAP. It is especially important to check draft scenarios when calling legacy code and using these statements. Instead, ABAP EML or procedure calls that do not include a `COMMIT WORK` should be used. | -|Transaction control `COMMIT WORK`, `ROLLBACK WORK` |-| -| - |Not allowed in ABAP behavior implementations. The use of these statements is always up to the RAP BO consumer, i.e. outside the ABAP behavior implementation. | +|Transaction control `COMMIT WORK`, `ROLLBACK WORK` |X/-| X/-| X/- |When a transactional phase has been explicitly set by methods of the `CL_ABAP_TX` class, the transaction owner is allowed to execute a commit or rollback statement. In the contexts of RAP (that is, where RAP is the transaction owner, for example, in handler and saver methods), local consumption of [RAP business events](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_entity_event_glosry.htm), [bgPF](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenbgpf_glosry.htm), and [classified APIs](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclassified_api_glosry.htm), commit or rollback statements are not allowed. | |[Dynpro](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abendynpro_glosry.htm) processing (e.g. `SET SCREEN`, `CALL SCREEN`, `LEAVE SCREEN`, `CALL DIALOG`, `SUPPRESS DIALOG`, `MESSAGE` without `INTO`, `WRITE`, `STOP`)

(unrestricted ABAP language scope)|- |- |- |Not allowed in ABAP behavior implementations. Results in a runtime error. | |Transaction processing (`CALL TRANSACTION`, `LEAVE TRANSACTION`)

(unrestricted ABAP language scope)| -| -| - |Not allowed to prevent (unwanted) integration of other LUWs. | |Raising an exception (`RAISE EXCEPTION`) |-| -| - |It is not allowed to leave a RAP transaction this way. | -|Report processing (`SUBMIT ...`)

(unrestricted ABAP language scope)|- |- |- |Not allowed in ABAP behavior implementations. Results in a runtime error. `SUBMIT ... AND RETURN` does not currently return an error, but it leads to potentially unwanted screen processing, and because of the missing return channel, there is no proper error handling. | +|Report processing (`SUBMIT ...`)

(unrestricted ABAP language scope)|- |- |- |Not allowed in transactional contexts. Results in a syntax or runtime error. +`SUBMIT ... AND RETURN` does not currently return an error, but it leads to potentially unwanted screen processing, and because of the missing return channel, there is no proper error handling. | diff --git a/16_Data_Types_and_Objects.md b/16_Data_Types_and_Objects.md index f9a4bea..00962cf 100644 --- a/16_Data_Types_and_Objects.md +++ b/16_Data_Types_and_Objects.md @@ -1271,7 +1271,7 @@ Find more information on enumerated types in the (commented code of the) cheat s ### Getting Type Information and Creating Types at Runtime Using [Runtime Type Identification (RTTI)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrun_time_type_identific_glosry.htm "Glossary Entry"), you can get type information on data objects, data types or [instances](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abeninstance_glosry.htm "Glossary Entry") at runtime ([Runtime Type Identification (RTTI)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrun_time_type_identific_glosry.htm "Glossary Entry")). -Using [Runtime Type Creation (RTTC)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrun_time_type_creation_glosry.htm "Glossary Entry"), you an define and create new data types as [type description objects](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentype_object_glosry.htm) at runtime. +Using [Runtime Type Creation (RTTC)](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrun_time_type_creation_glosry.htm "Glossary Entry"), you can define and create new data types as [type description objects](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentype_object_glosry.htm) at runtime. Find more information in the [cheat sheet about dynamic programming](06_Dynamic_Programming.md#runtime-type-services-rtts). diff --git a/19_ABAP_for_Cloud_Development.md b/19_ABAP_for_Cloud_Development.md index 6482d19..c89fcb2 100644 --- a/19_ABAP_for_Cloud_Development.md +++ b/19_ABAP_for_Cloud_Development.md @@ -21,7 +21,7 @@ It provides references to more detailed information on the topic. - The available ABAP language version is [ABAP for Cloud Development](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_for_cloud_dev_glosry.htm) that presents a [restricted ABAP language version](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrestricted_version_glosry.htm). - [Released APIs](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenreleased_api_glosry.htm): - Access to SAP-delivered repository objects is restricted to objects released for ABAP for Cloud Development - - For example, most of the database tables provided by SAP cannot be read directly (although there are abstractions for many that can be accessed). + - For example, most of the database tables provided by SAP cannot be read directly (although there are abstractions/CDS view entities for many that can be accessed). - Libraries are available with predefined functionality. - Note that repository objects can be classified by a [release contract](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrelease_contract_glosry.htm) (e.g. C0, C1 etc.). - Tools: @@ -116,7 +116,8 @@ It provides references to more detailed information on the topic. ref2 = REF #( num1 ). DATA str_itab TYPE string_table. - "The following statements are invalid + "The following statements are invalid (the pointless WRITE statement here + "just represents invalid classic ABAP UI-related statements) READ REPORT 'ZCL_DEMO_ABAP_UNIT_TEST=======CCAU' INTO str_itab. WRITE 'hi'. BREAK-POINT. @@ -124,7 +125,7 @@ It provides references to more detailed information on the topic. ENDCLASS. ``` -2) If available to you, you have accessed an on-premise ABAP system using ADT. +2) If available to you, you have accessed an on-premise ABAP system using ADT. It is assumed that the latest ABAP release is available. a) Check API Status information - Choose `CTRL + SHIFT + A` to open the search in ADT. Search the class `CL_ABAP_RANDOM_INT`. Once you have opened the class, check the *Properties* tab and find the API status information. diff --git a/README.md b/README.md index 7f405e8..8408bba 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ ABAP cheat sheets[^1] ... - Check the [Known Issues](#-known-issues) and [Disclaimer](#%EF%B8%8F-disclaimer). - The cheat sheets provide links to glossary entries and topics in the ABAP Keyword Documentation. Note that unlike the classic ABAP-only cheat sheets, in most cases these links refer to ABAP for Cloud Development. - [Here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrestricted_abap_elements.htm) is an overview of the different ABAP language elements in the different ABAP versions, i.e. what is allowed in ABAP Cloud and what is not. See also the released APIs [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenreleased_apis.htm). +- In order to have all ABAP cheat sheet documents in one place, the *main* branch (for ABAP Cloud examples) also contains the ABAP cheat sheet documents that are only relevant for classic ABAP.