From deef64ad0ae5d15be9babe10ae0a9d89dcf68778 Mon Sep 17 00:00:00 2001 From: danrega <16720986+danrega@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:58:19 +0200 Subject: [PATCH] Update --- 01_Internal_Tables.md | 81 ++++++++++++++++---------------- 03_ABAP_SQL.md | 4 +- 04_ABAP_Object_Orientation.md | 2 +- 05_Constructor_Expressions.md | 2 +- 06_Dynamic_Programming.md | 4 +- 07_String_Processing.md | 2 +- 08_EML_ABAP_for_RAP.md | 2 +- 11_Internal_Tables_Grouping.md | 2 +- 12_AMDP.md | 2 +- 13_Program_Flow_Logic.md | 4 +- 14_ABAP_Unit_Tests.md | 2 +- 15_CDS_View_Entities.md | 2 +- 16_Data_Types_and_Objects.md | 27 +---------- 17_SAP_LUW.md | 6 +-- 18_Dynpro.md | 2 +- 19_ABAP_for_Cloud_Development.md | 15 +++--- 20_Selection_Screens_Lists.md | 4 +- 21_XML_JSON.md | 2 +- 22_Misc_ABAP_Classes.md | 9 ++-- 23_Date_and_Time.md | 56 ++++++++++++---------- 24_Misc_Builtin_Functions.md | 1 + README.md | 8 ++-- 22 files changed, 113 insertions(+), 126 deletions(-) diff --git a/01_Internal_Tables.md b/01_Internal_Tables.md index f408b1f..6fc24f6 100644 --- a/01_Internal_Tables.md +++ b/01_Internal_Tables.md @@ -1346,7 +1346,7 @@ The expressions are covered in the cheat sheet [Constructor Expressions](05_Cons ### Interrupting and Exiting Loops -ABAP keywords such as `CONTINUE`, `CHECK`, and `EXIT`, are available to exit loops. Find more information in the [Program Flow Logic](13_Program_Flow_Logic.md#interrupting-and-exiting-loops) cheat sheet. +ABAP keywords such as `CONTINUE`, `CHECK`, and `EXIT`, are available to exit and interrupt loops. Find more information in the [Program Flow Logic](13_Program_Flow_Logic.md#interrupting-and-exiting-loops) cheat sheet. In the following example, the loop is exited using the `EXIT` statement when a certain condition is met. ```abap @@ -1982,8 +1982,7 @@ CLASS zcl_some_class IMPLEMENTATION. "group index value uses the original position in the group index. The group key "binding information is added to a string table for visualizing its content. CLEAR str_table. - LOOP AT it INTO DATA(wae) GROUP BY ( key = wae-comp1 gi = GROUP INDEX gs = GROUP SIZE ) ASCENDING INTO DATA(keye). - ASSERT wae IS INITIAL. + LOOP AT it INTO DATA(wae) GROUP BY ( key = wae-comp1 gi = GROUP INDEX gs = GROUP SIZE ) ASCENDING INTO DATA(keye). APPEND |Key component: '{ keye-key }', group index: '{ keye-gi }', group size: '{ keye-gs }'| TO str_table. ENDLOOP. out->write( data = str_table name = `str_table` ). @@ -1992,8 +1991,7 @@ CLASS zcl_some_class IMPLEMENTATION. "Unlike the previous example, the example uses a nested loop across the groups (the group key binding is "specified after LOOP AT GROUP). There, the component values of the members can be accessed. DATA itf LIKE it. - LOOP AT it INTO DATA(waf) GROUP BY ( key = waf-comp1 gi = GROUP INDEX gs = GROUP SIZE ) ASCENDING INTO DATA(keyf). - ASSERT waf IS INITIAL. + LOOP AT it INTO DATA(waf) GROUP BY ( key = waf-comp1 gi = GROUP INDEX gs = GROUP SIZE ) ASCENDING INTO DATA(keyf). LOOP AT GROUP keyf INTO DATA(memberf). APPEND VALUE #( comp1 = memberf-comp1 comp2 = memberf-comp2 comp3 = memberf-comp3 comp4 = |Key component: '{ keyf-key }', group index: '{ keyf-gi }', group size: '{ keyf-gs }'| @@ -2003,7 +2001,7 @@ CLASS zcl_some_class IMPLEMENTATION. out->write( data = itf name = `itf` ). "The objective of this example is to extract the line with the highest value in a particular - "column within a group (following the sorting) from the original table to another. + "column within a group from the original table to another. "The example uses representative binding, i.e. the representative of the group is specified "in the work area, not in a group key binding. DATA itg LIKE it. @@ -2154,10 +2152,10 @@ ENDCLASS. - Read accesses are executed using `READ TABLE` statements, which access the tables by: - Index (both primary and secondary table index) - Key (primary table key, secondary table key, free key) -- To try this, create a demo class named `zcl_some_class` and insert the provided code. After activation, select *F9* in ADT to execute the class. It may take some time to finish and display the output. The example is set up to display the results of the read performance test in the console. +- To try this, create a demo class named `zcl_some_class` and insert the provided code. After activation, choose *F9* in ADT to execute the class. It may take some time to finish and display the output. The example is set up to display the results of the read performance test in the console. > **💡 Note**
-> - This example is used for [exploration and experimentation ⚠️](README.md#%EF%B8%8F-disclaimer). It is solely for demonstration purposes, and it is **not** a *tool* for proper and accurate runtime and performance testing. Due to its simplified nature, the results may not be entirely accurate. However, multiple test runs should reflect the notes below (and above). +> - This example is used for [exploration and experimentation ⚠️](./README.md#%EF%B8%8F-disclaimer). It is solely for demonstration purposes, and it is **not** a *tool* for proper and accurate runtime and performance testing. Due to its simplified nature, the results may not be entirely accurate. However, multiple test runs should reflect the notes below. > - The example concentrates on a few demo internal tables, constructed using various declaration options. > - The purpose of this example is to underscore the significance of choosing the right table categories for your internal tables, tailored to your specific use case and the frequency of table access. @@ -2172,8 +2170,8 @@ Notes on ... - always non-unique in standard tables. - Key access is optimized for hashed and sorted tables, but not for standard tables. - You cannot modify key fields in hashed and sorted tables. - - In standard tables, key access is relatively slow because the search is linear. -- Generally, the larger the table, the slower the key access. Hashed tables excel here, providing constant access time even for very large tables. + - In standard tables, key access is not optimized regarding the primary table index (for the secondary table index, it is optimized) because the search is linear. +- Generally, the larger the table, the slower the key access. The benefit of hash tables is that they offer constant access time, even for very large tables. - Sorted and standard tables have a primary table index, hence their designation as index tables. - The primary table index assigns a unique line number to each table line. - The index updates whenever a line is added or removed. @@ -2183,18 +2181,18 @@ Notes on ... - Secondary table keys, which can be sorted or hashed, are available for all table categories. - They enhance table access efficiency and performance. - Declaring a secondary table key generates a corresponding secondary table index. However, the index for a non-unique key does not update immediately upon adding or deleting a line. The update happens when the internal table is accessed using the secondary table key. -- In ABAP statements, you must specify the secondary table key explicitly. Otherwise, the system implicitly uses the primary table key. +- In ABAP statements, you must specify the secondary table key explicitly. Otherwise, the primary table key is used implicitly. - Data access using the secondary table key is always optimized, even for standard tables. Thus, even older standard tables can gain from optimized access by adding secondary table keys later, without impacting existing table-related statements. -- However, weigh the administrative costs of secondary table keys. Use them only in scenarios where they offer substantial benefits, like large internal tables that are filled once and rarely altered. Frequent modifications can lead to regular index updates, potentially causing performance issues. +- However, weigh the administrative costs of secondary table keys. Use them only in scenarios where they offer substantial benefits, like large internal tables that are filled once and rarely altered. Frequent modifications can lead to regular index updates, potentially impacting performance. ... the use of table categories: - Standard tables: - Suitable for ... - small, sequentially accessed tables that are often accessed by index - - tables where key sorting is not critical, though you can sort using `SORT` statements, especially after table population + - tables where sorting is not critical. However, you can explicitly sort using `SORT` statements, especially after table population. - tables that are populated frequently, as there is no need to check for unique entries regarding the primary table key. - Access speed: - - Fast: By index, optimized key access with secondary table keys, and free keys using `READ TABLE ... BINARY SEARCH` statements + - Fast: By index, optimized key access with secondary table keys, and free keys using `READ TABLE ... BINARY SEARCH` statements (Note: It is recommended to use secondary table keys for an optimized access.) - Slow: Primary table and free key - Sorted tables: @@ -2212,7 +2210,7 @@ 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 & 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 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 to view the code @@ -2231,7 +2229,7 @@ CLASS zcl_some_class DEFINITION "Internal table to process demo tables and storing information TYPES: BEGIN OF info_struc, id TYPE i, - dobj_name TYPE string, + name TYPE string, runtime TYPE decfloat34, operation TYPE string, comment TYPE string, @@ -2345,14 +2343,14 @@ CLASS zcl_some_class IMPLEMENTATION. "Populating the information table (including references to the tables) info_tab = VALUE #( - ( dobj_name = `it_std_empty_key` itab_ref = REF #( it_std_empty_key ) lines = lines( it_std_empty_key ) comment = `Standard, empty primary t.key` ) - ( dobj_name = `it_std_w_nu_pr_key` itab_ref = REF #( it_std_w_nu_pr_key ) lines = lines( it_std_w_nu_pr_key ) comment = `Standard, expl. primary t.key` ) - ( dobj_name = `it_std_w_std_pr_key_w_sec_key` itab_ref = REF #( it_std_w_std_pr_key_w_sec_key ) lines = lines( it_std_w_std_pr_key_w_sec_key ) comment = `Standard, standard primary, w. secondary t.key` ) - ( dobj_name = `it_std_w_emp_pr_key_w_sec_key` itab_ref = REF #( it_std_w_emp_pr_key_w_sec_key ) lines = lines( it_std_w_emp_pr_key_w_sec_key ) comment = `Standard, empty primary, w. secondary t.key` ) - ( dobj_name = `it_sorted` itab_ref = REF #( it_sorted ) lines = lines( it_sorted ) comment = `Sorted, primary t.key only` ) - ( dobj_name = `it_sorted_w_sec_key` itab_ref = REF #( it_sorted_w_sec_key ) lines = lines( it_sorted_w_sec_key ) comment = `Sorted, w. secondary t.key` ) - ( dobj_name = `it_hashed` itab_ref = REF #( it_hashed ) lines = lines( it_hashed ) comment = `Hashed, primary t.key only` ) - ( dobj_name = `it_hashed_w_sec_key` itab_ref = REF #( it_hashed_w_sec_key ) lines = lines( it_hashed_w_sec_key ) comment = `Hashed, w. secondary t.key` ) + ( name = `it_std_empty_key` itab_ref = REF #( it_std_empty_key ) lines = lines( it_std_empty_key ) comment = `Standard, empty primary t.key` ) + ( name = `it_std_w_nu_pr_key` itab_ref = REF #( it_std_w_nu_pr_key ) lines = lines( it_std_w_nu_pr_key ) comment = `Standard, expl. primary t.key` ) + ( name = `it_std_w_std_pr_key_w_sec_key` itab_ref = REF #( it_std_w_std_pr_key_w_sec_key ) lines = lines( it_std_w_std_pr_key_w_sec_key ) comment = `Standard, standard primary, w. secondary t.key` ) + ( name = `it_std_w_emp_pr_key_w_sec_key` itab_ref = REF #( it_std_w_emp_pr_key_w_sec_key ) lines = lines( it_std_w_emp_pr_key_w_sec_key ) comment = `Standard, empty primary, w. secondary t.key` ) + ( name = `it_sorted` itab_ref = REF #( it_sorted ) lines = lines( it_sorted ) comment = `Sorted, primary t.key only` ) + ( name = `it_sorted_w_sec_key` itab_ref = REF #( it_sorted_w_sec_key ) lines = lines( it_sorted_w_sec_key ) comment = `Sorted, w. secondary t.key` ) + ( name = `it_hashed` itab_ref = REF #( it_hashed ) lines = lines( it_hashed ) comment = `Hashed, primary t.key only` ) + ( name = `it_hashed_w_sec_key` itab_ref = REF #( it_hashed_w_sec_key ) lines = lines( it_hashed_w_sec_key ) comment = `Hashed, w. secondary t.key` ) ). ENDMETHOD. @@ -2445,18 +2443,16 @@ CLASS zcl_some_class IMPLEMENTATION. ASSIGN TO . ENDIF. - IF IS ASSIGNED. - ts1 = utclong_current( ). - DO number_of_reads TIMES. - READ TABLE INDEX sy-index USING KEY (sec_key_name) TRANSPORTING NO FIELDS. - ENDDO. - ts2 = utclong_current( ). - cl_abap_utclong=>diff( EXPORTING high = ts2 - low = ts1 - IMPORTING seconds = seconds ). - dref->runtime = seconds. - APPEND dref->* TO result. - ENDIF. + ts1 = utclong_current( ). + DO number_of_reads TIMES. + READ TABLE INDEX sy-index USING KEY (sec_key_name) TRANSPORTING NO FIELDS. + ENDDO. + ts2 = utclong_current( ). + cl_abap_utclong=>diff( EXPORTING high = ts2 + low = ts1 + IMPORTING seconds = seconds ). + dref->runtime = seconds. + APPEND dref->* TO result. ENDIF. "-------------------- Read access by primary table key -------------------- @@ -2595,9 +2591,8 @@ CLASS zcl_some_class IMPLEMENTATION. "Retrieving the fastest run from the result table and adding this run to "the internal table that is returned - SORT result BY id operation runtime dobj_name ASCENDING. - LOOP AT result INTO DATA(wa) GROUP BY ( key1 = wa-id key2 = wa-operation ). - LOOP AT GROUP wa INTO DATA(member). + LOOP AT result INTO DATA(wa) GROUP BY ( key1 = wa-id key2 = wa-operation ) ASCENDING. + LOOP AT GROUP wa INTO DATA(member) GROUP BY member-runtime ASCENDING. "Clearing internal table content for output purposes CLEAR member-itab_ref. APPEND member TO read_results. @@ -2728,6 +2723,10 @@ REPLACE ALL OCCURRENCES OF `Z` ### Ranges Tables - Internal tables that have the predefined columns `SIGN`, `OPTION`, `LOW`, and `HIGH` + - `SIGN`: type c with length 1; indicates whether each line is included ('I') or excluded ('E') from the result set. + - `OPTION`: type c with length 2; specifies the selection option for the condition. It uses comparison operators such as `EQ`, `NE`, `GE`, `GT`, `LE`, `LT`, `CP`, `NP`, `BT`, `NB`. Special rules apply for certain operators such as when using `CP` or `NP`, the `LOW` and `HIGH` columns must be character values. + - `LOW`: The lower comparison value. + - `HIGH`: The higher comparison value. - Declared with the `TYPE RANGE OF` addition in `DATA` and `TYPES` statements - Used to store range conditions that can be evaluated in expressions using the `IN` operator (each row in the table represents a separate comparison) @@ -2762,7 +2761,7 @@ Using the methods of the `CL_ABAP_DIFF` class, you can compare the content of tw Find ... - more information in the class documentation and in the [ABAP Keyword Documentation]([06_Dynamic_Programming.md](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencl_abap_diff.htm)). -- a code snippet in the [Misc ABAP Classes](22_Misc_ABAP_Classes.md) cheat sheet. +- a code snippet in the [Misc ABAP Classes](./22_Misc_ABAP_Classes.md#comparing-content-of-compatible-internal-tables) cheat sheet.

⬆️ back to top

@@ -2775,4 +2774,4 @@ Topic [Internal Tables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en- > **💡 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 +> - [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 75bd54a..98e9ae1 100644 --- a/03_ABAP_SQL.md +++ b/03_ABAP_SQL.md @@ -1244,7 +1244,7 @@ SELECT id FROM @itab AS tab DATA rangestab TYPE RANGE OF i. "Populating a ranges table using the VALUE operator rangestab = VALUE #( ( sign = 'I' option = 'BT' low = 1 high = 3 ) - ( sign = 'I' option = 'GE' low = 10 ) ). + ( sign = 'I' option = 'GE' low = 10 ) ). SELECT id FROM @itab AS tab WHERE id IN @rangestab INTO TABLE @it. "1,2,3,10,11,12 @@ -1700,4 +1700,4 @@ Find more information in the [ABAP for RAP: Entity Manipulation Language (ABAP E > - 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) +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) diff --git a/04_ABAP_Object_Orientation.md b/04_ABAP_Object_Orientation.md index 27c820c..e2799c5 100644 --- a/04_ABAP_Object_Orientation.md +++ b/04_ABAP_Object_Orientation.md @@ -2314,4 +2314,4 @@ in the ABAP Keyword Documentation. > - 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) +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) diff --git a/05_Constructor_Expressions.md b/05_Constructor_Expressions.md index efa4ab8..b9627fb 100644 --- a/05_Constructor_Expressions.md +++ b/05_Constructor_Expressions.md @@ -1986,4 +1986,4 @@ DATA(it_reduced) = REDUCE string_table( > **💡 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) +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) diff --git a/06_Dynamic_Programming.md b/06_Dynamic_Programming.md index a723ef7..79d4775 100644 --- a/06_Dynamic_Programming.md +++ b/06_Dynamic_Programming.md @@ -1847,7 +1847,7 @@ ENDCLASS.

⬆️ back to top

### Dynamic Invoke -The following code snippet shows dynamically specifying [procedure](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenprocedure_glosry.htm "Glossary Entry") calls. +The following code snippet shows dynamically specifying [procedures](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenprocedure_glosry.htm "Glossary Entry") calls. The snippet covers methods. Find an example of a dynamic function module call in the [Program Flow Logic](./13_Program_Flow_Logic.md#function-module-example) cheat sheet. ``` abap "Note: Dynamic method calls require a CALL METHOD statement. @@ -3311,4 +3311,4 @@ CREATE DATA dref_cr TYPE HANDLE tdo_ref. > - 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) +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) diff --git a/07_String_Processing.md b/07_String_Processing.md index 006dc1b..7b55162 100644 --- a/07_String_Processing.md +++ b/07_String_Processing.md @@ -2262,4 +2262,4 @@ The following list (as also covered in the [Misc ABAP Classes cheat sheet](22_Mi > - 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) +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) diff --git a/08_EML_ABAP_for_RAP.md b/08_EML_ABAP_for_RAP.md index 5d81a23..508ae3a 100644 --- a/08_EML_ABAP_for_RAP.md +++ b/08_EML_ABAP_for_RAP.md @@ -1914,4 +1914,4 @@ This cheat sheet is supported by different executable examples demonstrating var > - Due to the simplification, the examples do not entirely meet all 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) and do not represent semantic or best practice examples. > - 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) +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) diff --git a/11_Internal_Tables_Grouping.md b/11_Internal_Tables_Grouping.md index 2f14f6e..a26ee8f 100644 --- a/11_Internal_Tables_Grouping.md +++ b/11_Internal_Tables_Grouping.md @@ -178,4 +178,4 @@ SIZE`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?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 +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) \ No newline at end of file diff --git a/12_AMDP.md b/12_AMDP.md index 592f5d8..211dcca 100644 --- a/12_AMDP.md +++ b/12_AMDP.md @@ -418,4 +418,4 @@ Find more information in the subtopics of the [ABAP Keyword Documentation (Stand > - 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 +> - [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 677a78b..2f70685 100644 --- a/13_Program_Flow_Logic.md +++ b/13_Program_Flow_Logic.md @@ -557,7 +557,7 @@ Further keywords for defining loops are as follows. They are not dealt with here ## Calling Procedures -Calling [procedures](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenprocedure_glosry.htm) fits in the context of dealing with program flow logic since they can be called explicitly in an [ABAP program](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_program_glosry.htm). +[Procedures](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenprocedure_glosry.htm) can be explicitly called within an [ABAP program](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_program_glosry.htm), thereby influencing the program flow logic. ### Methods of Classes @@ -1159,4 +1159,4 @@ ASSERT flag = abap_true. > - 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 +> - [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 d83cc0e..19ffaaf 100644 --- a/14_ABAP_Unit_Tests.md +++ b/14_ABAP_Unit_Tests.md @@ -521,4 +521,4 @@ For more information about evaluating ABAP unit test results, see [here](https:/ > - 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 +> - [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 58c5c2e..f5691ba 100644 --- a/15_CDS_View_Entities.md +++ b/15_CDS_View_Entities.md @@ -67,4 +67,4 @@ The following links take you to the source code of the cheat sheet artifacts to > - 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 +> - [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 854b128..42d250e 100644 --- a/16_Data_Types_and_Objects.md +++ b/16_Data_Types_and_Objects.md @@ -1467,30 +1467,7 @@ For more information, see the [Dynamic Programming](06_Dynamic_Programming.md) c - Internal tables that have the predefined columns `SIGN`, `OPTION`, `LOW`, and `HIGH` - Declared with the `TYPE RANGE OF` addition in `DATA` and `TYPES` statements - Used to store range conditions that can be evaluated in expressions using the `IN` operator (each row in the table represents a separate comparison) - -```abap -"Populating an integer table with values from 1 to 20 -TYPES int_tab_type TYPE TABLE OF i WITH EMPTY KEY. -DATA(inttab) = VALUE int_tab_type( FOR x = 1 WHILE x <= 20 ( x ) ). - -"Declaring a ranges table -DATA rangestab TYPE RANGE OF i. - -"Populating a ranges table using VALUE -rangestab = VALUE #( sign = 'I' - option = 'BT' ( low = 1 high = 3 ) - ( low = 6 high = 8 ) - ( low = 12 high = 15 ) - option = 'GE' ( low = 18 ) ). - -"Using a SELECT statement and the IN addition to retrieve internal table -"content based on the ranges table specifications -SELECT * FROM @inttab AS tab - WHERE table_line IN @rangestab - INTO TABLE @DATA(result). -"result: 1, 2, 3, 6, 7, 8, 12, 13, 14, 15, 18, 19, 20 - -``` +- Find more information and a code snippet in the [Internal Table](./01_Internal_Tables.md#ranges-tables) cheat sheet.

⬆️ back to top

@@ -1568,7 +1545,7 @@ SELECT SINGLE > - 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) +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) diff --git a/17_SAP_LUW.md b/17_SAP_LUW.md index b0228e3..92321e8 100644 --- a/17_SAP_LUW.md +++ b/17_SAP_LUW.md @@ -30,7 +30,7 @@ Consider the following example of transactional consistency: > **💡 Note**
> - This cheat sheet focuses on [classic ABAP](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenclassic_abap_glosry.htm). Hence, the links in this cheat sheet open topics in the ABAP Keyword Documentation for [Standard ABAP](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenstandard_abap_glosry.htm). -> - The SAP LUW concept is certainly relevant to ABAP Cloud, too. The [ABAP RESTful Application Programming Model (RAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenarap_glosry.htm) is the transactional programming model for [ABAP Cloud](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_cloud_glosry.htm). It comes with a well-defined transactional model and follows the rules of the SAP LUW. Find out more in this [blog](https://blogs.sap.com/2022/12/05/the-sap-luw-in-abap-cloud/). +> - The SAP LUW concept is also relevant to ABAP Cloud. The [ABAP RESTful Application Programming Model (RAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenarap_glosry.htm) is the transactional programming model for [ABAP Cloud](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_cloud_glosry.htm). It comes with a well-defined transactional model and follows the rules of the SAP LUW. Find out more in this [blog](https://blogs.sap.com/2022/12/05/the-sap-luw-in-abap-cloud/). ## Terms @@ -293,7 +293,7 @@ There are RAP-specific [ABAP EML](https://help.sap.com/doc/abapdocu_latest_index ## Controlled SAP LUW -- The *controlled SAP LUW* is an enhancement to the SAP LUW concept. +- The *controlled SAP LUW* is an enhancement to the SAP LUW concept, available in both [ABAP Cloud](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_cloud_glosry.htm) and [classic ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclassic_abap_glosry.htm). - It introduces a check mechanism to detect violations of [transactional contracts](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentransactional_contract_glosry.htm) to guarantee transactional consistency. - Such contracts specify which ABAP statements and operations are allowed and which are not allowed in a [transactional phase](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentr_phase_glosry.htm). - In this way, applications can be made more robust and the SAP LUW can be made more tangible. @@ -383,7 +383,7 @@ After the import of the repository, proceed as follows: > - is explained in more detail 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) +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer)
diff --git a/18_Dynpro.md b/18_Dynpro.md index c0e1949..9a523bc 100644 --- a/18_Dynpro.md +++ b/18_Dynpro.md @@ -740,7 +740,7 @@ After the import of the repository, proceed as follows: > - is only intended to demonstrate a selection of keywords and visualize dynpro-related syntax in action on a high level. > - 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) +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer)
diff --git a/19_ABAP_for_Cloud_Development.md b/19_ABAP_for_Cloud_Development.md index d5c85dc..f9719d7 100644 --- a/19_ABAP_for_Cloud_Development.md +++ b/19_ABAP_for_Cloud_Development.md @@ -31,7 +31,10 @@ It provides references to more detailed information on the topic. - Supported in all SAP products that are based on ABAP technology (in the products it can be fully or partly mandatory). - Classic ABAP - Progamming paradigm for legacy solutions - - Based on the ABAP technology without restrictions regarding ABAP language versions (i.e. you can use [Standard ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenstandard_abap_glosry.htm) - the unrestricted ABAP language version - and also ABAP for Cloud Development there), usage of tools (ADT and/or SAP GUI) or access to repository objects (also objects provided by SAP). + - Based on the ABAP technology without restrictions regarding the ... + - ABAP language versions, i.e. you can use both [Standard ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenstandard_abap_glosry.htm) (the unrestricted ABAP language version) and ABAP for Cloud Development + - usage of tools (ADT and/or SAP GUI) + - access to repository objects (i.e. also objects provided by SAP can be accessed). - Supported in [SAP S/4HANA](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensap_s4hana_glosry.htm) @@ -56,7 +59,7 @@ It provides references to more detailed information on the topic. For deprecated and invalid syntax in ABAP for Cloud Development, refer to the following example code. You can create a demo class and insert the code below (adjust the class name if necessary). Several syntax errors and warnings will be displayed: - ABAP SQL statements - - The first two ABAP SQL statements select from demo database tables. The first one is a demo table provided by SAP, but it cannot be accessed directly in ABAP Cloud like in classic ABAP. Therefore, it cannot be used as a data source for selection. + - The first two ABAP SQL statements select from demo database tables. The first one is a demo table provided by SAP, but it cannot be accessed directly in the case of ABAP for Cloud Development like in the case of Standard ABAP. Therefore, it cannot be used as a data source for selection. - The second one is a database table from the ABAP cheat sheet GitHub repository. If you have imported the repository into the system, you can use it as a data source. - The CDS view is released and can be accessed in the restricted ABAP language scope. - Although the source code provides an invalid data source, the dynamic ABAP SQL statement does not produce a syntax error during compilation. However, it would result in a runtime error because you cannot select from that data source. You can check the validity of dynamic specifications using the `cl_abap_dyn_prg` class, which supports dynamic programming. @@ -130,7 +133,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. It is assumed that the latest ABAP release is available. +2) If available to you, you have accessed a system supporting classic ABAP using ADT. It is assumed that the latest ABAP release is available. a) Checking 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. @@ -141,7 +144,7 @@ It provides references to more detailed information on the topic. ![Standard ABAP](./files/standard.png) - If you have not imported the ABAP cheat sheet GitHub repository, remove the lines of code using artifacts from that repository, i.e. remove the statements using objects starting with `Z...`. You should not see any syntax errors. Activate the class. - Run the class with *F9*. The code should have been processed up to the `BREAK-POINT` statement and the debugger should have started. You may want to check the content of the variables in the debugger. Choose *Terminate* to exit the debugger. - - So, unlike in the case of ABAP Cloud above, you should be able to activate and run the code (which does not represent a meaningful code example). + - So, unlike in the case of ABAP for Cloud Development above, you should be able to activate and run the code (which does not represent a meaningful code example). c) Verifying cloud-readiness of your code in classic ABAP - You have walked through b), created a class, inserted the code from above, and activated the class. The *ABAP Language Version* is maintained as *Standard ABAP* in the *Properties* tab. @@ -152,7 +155,7 @@ It provides references to more detailed information on the topic. d) Cloud-ready development in classic ABAP - You have walked through b), created a class, inserted the code from above, and activated the class. The *ABAP Language Version* is maintained as *Standard ABAP* in the *Properties* tab under *General*. - - Suppose you want to do cloud-ready development and use ABAP for Cloud Development, i.e. the restricted ABAP language version, in classic ABAP (e.g. an on-premise ABAP system that allows the unrestricted ABAP language version). + - Imagine you are aiming for cloud-ready development and want to utilize ABAP for Cloud Development, the restricted version of the ABAP language, within a system that supports classic ABAP. - Open the *Properties* tab and choose *General* for this purpose. - Choose the *Edit...* button to the right of the *ABAP Language Version* property. - Select *ABAP for Cloud Development* in the pop-up window and choose *Ok*. @@ -189,4 +192,4 @@ It provides references to more detailed information on the topic. > - 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) \ No newline at end of file +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) \ No newline at end of file diff --git a/20_Selection_Screens_Lists.md b/20_Selection_Screens_Lists.md index 186a061..52fadff 100644 --- a/20_Selection_Screens_Lists.md +++ b/20_Selection_Screens_Lists.md @@ -236,7 +236,7 @@ PARAMETERS: pv RADIOBUTTON GROUP grp USER-COMMAND rbcm, - Declares selection criteria for a data object - Unlike the `PARAMETERS` statement, which specifies a single value for a variable, the `SELECT-OPTIONS` statement allows you to specify complex criteria, such as an value range or a list of single values, to include or exclude values, that can be evaluated. - The selection criteria are assigned to a selection table (see [ranges table](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenranges_table_glosry.htm) and the type `TYPE RANGE OF`). - - Such a table type contains four columns - low, high, option, sign - for determining range conditions. Each line of such a table represents a condition. + - Such a table type contains four columns - `LOW`, `HIGH`, `OPTION`, `SIGN` - for determining range conditions. Each line of such a table represents a condition. - Typically, the content of the selection table can be evaluated in `SELECT` statements using the `IN` operator in the `WHERE` clause. - If the selection table is empty, all lines are respected. @@ -1336,4 +1336,4 @@ After the import of the repository, proceed as follows: > - 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 +> - [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 d037cb9..c2b8327 100644 --- a/21_XML_JSON.md +++ b/21_XML_JSON.md @@ -747,4 +747,4 @@ DATA(is_equal) = COND #( WHEN len_xstr = len_xstr_decomp > - 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#%EF%B8%8F-disclaimer) \ No newline at end of file +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) \ No newline at end of file diff --git a/22_Misc_ABAP_Classes.md b/22_Misc_ABAP_Classes.md index 3b8c233..247d88b 100644 --- a/22_Misc_ABAP_Classes.md +++ b/22_Misc_ABAP_Classes.md @@ -36,7 +36,8 @@ This ABAP cheat sheet contains a selection of available ABAP classes, serving as > **💡 Note**
> - The cheat sheet is not a comprehensive overview, and the code snippets do not claim to be comprehensive as far as options, methods, or parameters are concerned. It is intended to give you a rough overview, for you to get an idea. It is an invitation to a more in-depth exploration. > - For more information and where available, refer to the class documentation (for example, choose F2 when the cursor is on the class name in ADT), the ABAP Keyword Documentation, and the SAP Help Portal documentation. -> - In the cheat sheet, the focus is on a selected set of classes that are available in [ABAP Cloud](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_cloud_glosry.htm). +> - In the cheat sheet, the focus is on a selected set of classes that are available in [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). +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) ## Excursion: Available Classes in ABAP Cloud @@ -837,9 +838,11 @@ ENDIF.

⬆️ back to top

- ## Time and Date +> **💡 Note**
+> In [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), do not use the date and time-related system fields such as `sy-datum` and `sy-uzeit`, and others. User-related time and date values (such as `sy-timlo` and `sy-datlo`) can be retrieved using the XCO library. For code snippets, see the [Date, Time, and Time Stamp](23_Date_and_Time.md) cheat sheet. + @@ -1452,7 +1455,7 @@ Provides context information relevant to the current ABAP session.

``` abap -"Getting current date in UTC, e.g. 20240101 +"Getting current date in UTC (not the system or user time), e.g. 20240101 DATA(sys_date) = cl_abap_context_info=>get_system_date( ). "Getting current time in UTC, e.g. 152450 diff --git a/23_Date_and_Time.md b/23_Date_and_Time.md index dfd622a..62ab505 100644 --- a/23_Date_and_Time.md +++ b/23_Date_and_Time.md @@ -10,23 +10,23 @@ - [Validity of Date Fields](#validity-of-date-fields) - [Character-Like Access to Date Fields](#character-like-access-to-date-fields) - [Numeric Access/Calculations](#numeric-accesscalculations) - - [`CL_ABAP_DATFM`: Date Conversions](#cl_abap_datfm-date-conversions) + - [CL\_ABAP\_DATFM: Date Conversions](#cl_abap_datfm-date-conversions) - [Time](#time) - [Time Stamps](#time-stamps) - - [Time Stamps of Type `utclong`](#time-stamps-of-type-utclong) + - [Time Stamps of Type utclong](#time-stamps-of-type-utclong) - [Retrieving the Current Time Stamp](#retrieving-the-current-time-stamp) - [Creating/Modifying a Time Stamp](#creatingmodifying-a-time-stamp) - - [Time Stamp Calculations with the Built-In Function `utclong_add`](#time-stamp-calculations-with-the-built-in-function-utclong_add) + - [Time Stamp Calculations with the Built-In Function utclong\_add](#time-stamp-calculations-with-the-built-in-function-utclong_add) - [Time Stamp Calculations with XCO](#time-stamp-calculations-with-xco) - - [Calculating Time Stamp Differences Using the Built-In Function `utclong_diff`](#calculating-time-stamp-differences-using-the-built-in-function-utclong_diff) - - [`CONVERT UTCLONG`: Time Stamp (`utclong`) -\> Local Date/Time](#convert-utclong-time-stamp-utclong---local-datetime) - - [`CONVERT ... INTO UTCLONG`: Local Date/Time -\> Time Stamp (`utclong`)](#convert--into-utclong-local-datetime---time-stamp-utclong) - - [`CL_ABAP_UTCLONG`: Utilities for Time Stamps (`utclong`)](#cl_abap_utclong-utilities-for-time-stamps-utclong) - - [Time Stamps in Packed Numbers (types `timestamp`, `timestampl`)](#time-stamps-in-packed-numbers-types-timestamp-timestampl) - - [`GET TIME STAMP`: Retrieving the Current Time Stamp](#get-time-stamp-retrieving-the-current-time-stamp) - - [`CONVERT TIME STAMP`: Time Stamp in Packed Numbers -\> Local Date/Time](#convert-time-stamp-time-stamp-in-packed-numbers---local-datetime) - - [`CONVERT ... INTO TIME STAMP`: Local Date/Time -\> Time Stamp in Packed Numbers](#convert--into-time-stamp-local-datetime---time-stamp-in-packed-numbers) - - [`CL_ABAP_TSTMP`: Calculating and Converting Time Stamps in Packed Numbers](#cl_abap_tstmp-calculating-and-converting-time-stamps-in-packed-numbers) + - [Calculating Time Stamp Differences Using the Built-In Function utclong\_diff](#calculating-time-stamp-differences-using-the-built-in-function-utclong_diff) + - [CONVERT UTCLONG: Time Stamp (utclong) -\> Local Date/Time](#convert-utclong-time-stamp-utclong---local-datetime) + - [CONVERT ... INTO UTCLONG: Local Date/Time -\> Time Stamp (utclong)](#convert--into-utclong-local-datetime---time-stamp-utclong) + - [CL\_ABAP\_UTCLONG: Utilities for Time Stamps (utclong)](#cl_abap_utclong-utilities-for-time-stamps-utclong) + - [Time Stamps in Packed Numbers (Types timestamp and timestampl)](#time-stamps-in-packed-numbers-types-timestamp-and-timestampl) + - [GET TIME STAMP: Retrieving the Current Time Stamp](#get-time-stamp-retrieving-the-current-time-stamp) + - [CONVERT TIME STAMP: Time Stamp in Packed Numbers -\> Local Date/Time](#convert-time-stamp-time-stamp-in-packed-numbers---local-datetime) + - [CONVERT ... INTO TIME STAMP: Local Date/Time -\> Time Stamp in Packed Numbers](#convert--into-time-stamp-local-datetime---time-stamp-in-packed-numbers) + - [CL\_ABAP\_TSTMP: Calculating and Converting Time Stamps in Packed Numbers](#cl_abap_tstmp-calculating-and-converting-time-stamps-in-packed-numbers) - [Excursion: Unix Time Stamps](#excursion-unix-time-stamps) - [Date, Time, and Time Stamps in String Templates](#date-time-and-time-stamps-in-string-templates) - [Excursion: Date and Time Functions in ABAP SQL and ABAP CDS](#excursion-date-and-time-functions-in-abap-sql-and-abap-cds) @@ -63,6 +63,8 @@ The main data types for date, time, and time stamps in ABAP are as follows: > - Format: `yyyymmddhhmmss.sssssss` (in addition to the short form, the seven decimal places are fractions of a second) > > Many code snippets in the cheat sheet include examples that utilize the [XCO library](https://help.sap.com/docs/btp/sap-business-technology-platform/xco-library?version=Cloud), which offers various options for handling dates, times, and time stamps. The cheat sheet includes a selection. Note that, in most cases, the return value of the XCO calls in the snippets is of type `string`. For more detailed information, refer to the class documentation and the [SAP Help Portal](https://help.sap.com/docs/btp/sap-business-technology-platform/xco-library?version=Cloud). +> +> In [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), do not use the date and time-related system fields such as `sy-datum` and `sy-uzeit`, and others. User-related time and date values (such as `sy-timlo` and `sy-datlo`) can be retrieved using the XCO library as shown below. Example: @@ -143,6 +145,7 @@ DATA(date_1) = xco_cp=>sy->date( )->as( xco_cp_time=>format->iso_8601_basic )->v "e.g. 2024-01-01 DATA(date_2) = xco_cp=>sy->date( )->as( xco_cp_time=>format->iso_8601_extended )->value. "Specifying the default time zone explicitly +"The following method call retrieves the current user date. DATA(date_3) = xco_cp=>sy->date( xco_cp_time=>time_zone->user )->as( xco_cp_time=>format->iso_8601_extended )->value. @@ -317,7 +320,7 @@ ENDTRY.

⬆️ back to top

-### `CL_ABAP_DATFM`: Date Conversions +### CL_ABAP_DATFM: Date Conversions ```abap "Using the CL_ABAP_DATFM class, you can perform conversions with external @@ -420,6 +423,7 @@ DATA(utc_time) = cl_abap_context_info=>get_system_time( ). "Using XCO "Note the optional time zone specification. +"The following method call retrieves the current user time. "Result: e.g. 14:39:10 DATA(time_w_xco) = xco_cp=>sy->time( xco_cp_time=>time_zone->user )->as( xco_cp_time=>format->iso_8601_extended @@ -534,7 +538,7 @@ ENDTRY.

⬆️ back to top

-### Time Stamps of Type `utclong` +### Time Stamps of Type utclong #### Retrieving the Current Time Stamp More information: [`utclong_current`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenutclong_current.htm) @@ -614,7 +618,7 @@ DATA(ts12) = ts11->overwrite( iv_year = '2025'

⬆️ back to top

-#### Time Stamp Calculations with the Built-In Function `utclong_add` +#### Time Stamp Calculations with the Built-In Function utclong_add More information: [`utclong_add`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenutclong_add.htm) @@ -728,7 +732,7 @@ DATA(ts_interval_high) = ts_interval->upper_bound->as( xco_cp_time=>format->iso_

⬆️ back to top

-#### Calculating Time Stamp Differences Using the Built-In Function `utclong_diff` +#### Calculating Time Stamp Differences Using the Built-In Function utclong_diff More information: [`utclong_diff`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenutclong_diff.htm) @@ -746,7 +750,7 @@ DATA(ts_diff2) = utclong_diff( high = ts16

⬆️ back to top

-#### `CONVERT UTCLONG`: Time Stamp (`utclong`) -> Local Date/Time +#### CONVERT UTCLONG: Time Stamp (utclong) -> Local Date/Time More information: [`CONVERT UTCLONG`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapconvert_utclong.htm) @@ -788,7 +792,7 @@ ENDTRY.

⬆️ back to top

-#### `CONVERT ... INTO UTCLONG`: Local Date/Time -> Time Stamp (`utclong`) +#### CONVERT ... INTO UTCLONG: Local Date/Time -> Time Stamp (utclong) More information: [`CONVERT ... INTO UTCLONG`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapconvert_utclong.htm) @@ -889,7 +893,7 @@ ENDDO.

⬆️ back to top

-#### `CL_ABAP_UTCLONG`: Utilities for Time Stamps (`utclong`) +#### CL_ABAP_UTCLONG: Utilities for Time Stamps (utclong) ```abap "Check the class documentation. More methods are available. @@ -918,11 +922,11 @@ ENDTRY.

⬆️ back to top

-### Time Stamps in Packed Numbers (types `timestamp`, `timestampl`) +### Time Stamps in Packed Numbers (Types timestamp and timestampl) -This section deals with time stamps in packed numbers (types `timestamp`, `timestampl`). Note that only a few ABAP statements can deal with these types. Most other statements just interpret the types as numbers. +This section deals with time stamps in packed numbers (types `timestamp` and `timestampl`). Note that only a few ABAP statements can deal with these types. Most other statements just interpret the types as numbers. -#### `GET TIME STAMP`: Retrieving the Current Time Stamp +#### GET TIME STAMP: Retrieving the Current Time Stamp More information: [`GET TIME STAMP`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapget_time-stamp.htm) @@ -945,7 +949,7 @@ GET TIME STAMP FIELD DATA(ts_inl).

⬆️ back to top

-#### `CONVERT TIME STAMP`: Time Stamp in Packed Numbers -> Local Date/Time +#### CONVERT TIME STAMP: Time Stamp in Packed Numbers -> Local Date/Time More information: [`CONVERT TIME STAMP`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapconvert_time-stamp.htm) @@ -1004,7 +1008,7 @@ ASSERT sy-subrc = 12.

⬆️ back to top

-#### `CONVERT ... INTO TIME STAMP`: Local Date/Time -> Time Stamp in Packed Numbers +#### CONVERT ... INTO TIME STAMP: Local Date/Time -> Time Stamp in Packed Numbers More information: [`CONVERT ... INTO TIME STAMP`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapconvert_date_time-stamp.htm) @@ -1033,7 +1037,7 @@ CONVERT DATE CONV d( '20240101' )

⬆️ back to top

-#### `CL_ABAP_TSTMP`: Calculating and Converting Time Stamps in Packed Numbers +#### CL_ABAP_TSTMP: Calculating and Converting Time Stamps in Packed Numbers More information: Class documentation and [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencl_abap_tstmp.htm) @@ -1260,4 +1264,4 @@ INTO @DATA(wa). > **💡 Note**
> - The executable example covers the handling and processing of date, time, and time stamps. The snippets of this cheat sheet and more are included. > - 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 +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) \ No newline at end of file diff --git a/24_Misc_Builtin_Functions.md b/24_Misc_Builtin_Functions.md index 4641453..f4cafcc 100644 --- a/24_Misc_Builtin_Functions.md +++ b/24_Misc_Builtin_Functions.md @@ -31,6 +31,7 @@ Built-in functions are also available in ABAP SQL and ABAP CDS. > - For more detailed information, refer to the topics linked in the [More Information](#more-information) section. > - Avoid naming your methods the same as built-in functions within classes. Otherwise, the methods will "[hide](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenbuilt_in_functions_hiding.htm)" the built-in functions. > - The examples in the ABAP cheat sheet are not comprehensive in terms of functions covered, syntax options and parameters used. Always refer to the ABAP Keyword Documentation for more details. +> - [Disclaimer](./README.md#%EF%B8%8F-disclaimer) ## Logical Functions diff --git a/README.md b/README.md index dbccb67..4e5e471 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ ABAP cheat sheets[^1] ... - provide a **collection of information on selected ABAP topics** in a nutshell for your reference. - focus on **ABAP syntax**. - include **code snippets**. -- are supported by easy-to-consume **demonstration examples** that you can import into your [SAP BTP ABAP environment](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensap_btp_abap_env_glosry.htm) (*main* branch; ABAP language version: [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)) or on-premise ABAP system ([classic ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclassic_abap_glosry.htm); the repository branches other than *main*) using [abapGit](https://abapgit.org/) to run and check out ABAP syntax in action in simple contexts. +- are supported by easy-to-consume **demonstration examples** that you can import into your [SAP BTP ABAP environment](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensap_btp_abap_env_glosry.htm) (*main* branch; ABAP language version: [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)) or your system supporting [classic ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclassic_abap_glosry.htm) (the repository branches other than *main*; ABAP language version: [Standard ABAP](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenstandard_abap_glosry.htm)) using [abapGit](https://abapgit.org/) to run and check out ABAP syntax in action in simple contexts. - are enriched by links to glossary entries and chapters of the **ABAP Keyword Documentation** (the *F1 help*) and more for you to deep dive into the respective ABAP topics and get more comprehensive information.
@@ -146,7 +146,7 @@ https://github.com/SAP-samples/abap-cheat-sheets.git
- 2b) Classic ABAP (on-premise ABAP systems) + 2b) System supportig classic ABAP
**Prerequisites** @@ -211,7 +211,7 @@ Use the standalone version of the abapGit report to import the demo examples of ## ⚡ Known Issues - Only one user on the system can import this repository because all object names must be globally unique. - Regarding possible code check warnings, e.g. for the many strings in the code, not using an `ORDER BY` clause, or messages regarding using `SELECT *`, the code deliberately avoids [pragmas](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenpragma_glosry.htm) and [pseudo comments](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenpseudo_comment_glosry.htm) in order to focus on the available ABAP syntax. See also the [Disclaimer](#%EF%B8%8F-disclaimer). -- Regarding the examples to be imported into on-premise ABAP systems, note the following: In most cases, the cheat sheet documents and examples focus on ABAP for Cloud Development. Therefore, the lower the [ABAP release](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_release_glosry.htm) in your system, the fewer syntax options and examples are available. For example, the RAP examples in particular require at least ABAP version 7.56. The code examples in the classic ABAP branches do not necessarily reflect all (described) syntax variations and options that are available in classic ABAP and in the particular ABAP release. For more information about the availability of syntax, see the [ABAP Release News (Standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abennews.htm). +- Regarding the examples to be imported into a system supporting classic ABAP, note the following: In most cases, the cheat sheet documents and examples focus on ABAP for Cloud Development. Therefore, the lower the [ABAP release](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_release_glosry.htm) in your system, the fewer syntax options and examples are available. For example, the RAP examples need at least ABAP version 7.56. Or, the [`FINAL` declaration operator](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenfinal_inline.htm) is not available in ABAP version 7.56. The code examples in the classic ABAP branches do not necessarily reflect all (described) syntax variations and options that are available in classic ABAP and in the particular ABAP release. For more information on new ABAP features by release, see the [ABAP Release News (Standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abennews.htm). - If you encounter import problems with the XSLT/ST objects, try to manually paste the code from the 3 `...source.xml` files ([zdemo_abap_st_carrhtml](./src/zdemo_abap_st_carrhtml.xslt.source.xml), [zdemo_abap_st_strhtml](./src/zdemo_abap_st_strhtml.xslt.source.xml), [zdemo_abap_xslt_fl](./src/zdemo_abap_xslt_fl.xslt.source.xml)) into the improperly imported objects and activate all non-active objects.
@@ -223,7 +223,7 @@ Use the standalone version of the abapGit report to import the demo examples of - Links to the online version of the ABAP Keyword Documentation for: - **Standard ABAP**: Unrestricted ABAP language scope for [classic ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenclassic_abap_glosry.htm) → [Online version of the documentation (latest version)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap.htm). To access the online documentation for a specific ABAP version, e.g. 7.54, you can select the version from the drop-down list [here](https://help.sap.com/docs/ABAP?locale=en-US) (*latest* is preselected). The *ABAP* link under *Development* will take you to the documentation of choice. - **ABAP for Cloud Development**: Restricted ABAP language scope for developments, for example, in the SAP BTP ABAP environment → [Online version of the documentation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm) -- For demonstration examples of the ABAP Keyword Documentation in classic ABAP, see the `SABAPDEMOS` package. This package contains all the examples used in the ABAP Keyword Documentation. For the context, class/program name, etc., see the [example page](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_examples.htm), which is also available in the system-internal SAP GUI version as a node in the topic tree and which summarizes the executable examples. Of course, you can also find the example topics in the context of the individual topic of the ABAP keyword documentation. The example topics are marked with a ⚙️ icon: +- For demonstration examples of the ABAP Keyword Documentation in classic ABAP, see the `SABAPDEMOS` package. This package contains all the examples used in the ABAP Keyword Documentation. For the context, class/program name, etc., see the [example page](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_examples.htm), which is also available in the system-internal SAP GUI version as a node in the topic tree and which summarizes the executable examples. Of course, you can also find the example topics in the context of the individual topic of the ABAP keyword documentation. The example topics are marked with a ⚙️ icon: ![](./files/example_topics.png)
Class Details/Code Snippet