Update content

This commit is contained in:
danrega
2023-04-14 14:41:29 +02:00
parent 3fd765ccb7
commit e30db53953
7 changed files with 20 additions and 21 deletions

View File

@@ -309,7 +309,7 @@ The following example shows the pattern and various examples of declaring intern
Steps:
1. Define a structured data type (locally or globally).
This is not necessary if you use, for example, you use the name of a database table or [CDS view](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_view_glosry.htm) in the internal table declaration. In these cases their line type is used automatically.
This is not necessary if you use, for example, the name of a database table or [CDS view](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_view_glosry.htm) in the internal table declaration. In these cases their line type is used automatically.
2. Define an internal table type.
3. Create the internal table, i.e. a data object that uses this type.
@@ -344,7 +344,7 @@ TYPES:
"Based on database table (could also be, e. g. a CDS view)
"In this case, the line type of the table is automatically used.
tt_gl_tab TYPE TABLE OF zdemo_abap_fli WITH NON-UNIQUE KEY key_field,
tt_gl_tab TYPE TABLE OF zdemo_abap_fli WITH NON-UNIQUE KEY carrid,
"Based on an elementary type
tt_el_type TYPE TABLE OF i.
@@ -508,7 +508,7 @@ other line is constructed inline.
> **💡 Note**<br>
> The extra pair of parentheses represents a table line. The # sign indicates that the line type can be derived from the context. The assignment deletes the existing content of the internal table on the left side.
> The extra pair of parentheses represents a table line. The `#` character indicates that the line type can be derived from the context. The assignment deletes the existing content of the internal table on the left side.
``` abap
itab = VALUE #( ( line )
@@ -521,7 +521,7 @@ itab = VALUE #( ( line )
TYPES it_type LIKE itab.
"Inline declaration
"The # sign would not be possible here since the line type
"The # character would not be possible here since the line type
"cannot be derived from the context.
DATA(it_in) = VALUE it_type( ( comp1 = a comp2 = b ... )
@@ -801,6 +801,8 @@ There are three different ways to specify the line to read:
- by table keys (only tables for which a key is defined)
- by free key
The following code snippets include [`READ TABLE`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapread_table.htm) statements and [table expressions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abentable_expressions.htm) to read from internal tables.
**Reading single lines**
*Determining the target area*

View File

@@ -779,7 +779,7 @@ SELECT SINGLE
"Searches for a PCRE expression and returns the matched substring
"More parameters possible: occurrence, case_sensitive, start, group
"Result:.lu
"Result: .lu
substring_regexpr( pcre = '\...', "Period that is followed by any two characters
                     value = url ) AS substring_regexpr,

View File

@@ -300,6 +300,8 @@ TYPES i_table TYPE STANDARD TABLE OF i WITH EMPTY KEY.
DATA(ref3) = NEW i_table( ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) ).
"CREATE DATA statements (older syntax)
"Unlike above, the older syntax is not commented out. CREATE DATA is used for dynamic
"type specification as shown further down.
DATA ref4 TYPE REF TO string.
DATA ref5 TYPE REF TO data.
@@ -326,7 +328,7 @@ Excursion: Static vs. dynamic type, upcasts and downcasts
- Downcast: If the static type of the target variable is **more specific** than the static type of the source variable, a check must be made at runtime before the assignment is done. If you indeed want to trigger such a downcast, you must do it explicitly in your code. You can do this, for example, using the
[constructor operator](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenconstructor_operator_glosry.htm "Glossary Entry")
[`CAST`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenconstructor_expression_cast.htm). In older code, you might see
the operator [`?=`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmove_cast.htm)).
the operator [`?=`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmove_cast.htm).
- In contrast to a downcast, an upcast does not have to be done explicitly. However, you can - but need not - use the mentioned operators for upcasts, too.
@@ -362,8 +364,8 @@ DATA ref6 TYPE REF TO data.
ref6 = NEW i( 654 ).
ref5 = CAST #( ref6 ).
"Old casting operator
ref5 ?= ref6.
"Casting operator: Older syntax
"ref5 ?= ref6.
```
**Addressing data references**
@@ -403,7 +405,6 @@ DATA(calc) = 1 + ref_gen->*.
"Complete structure
DATA(struc) = ref_carr->*.
"When dereferencing a data reference variable that has a structured
"data type, you can use the component selector -> to address individual components
DATA(carrid) = ref_carr->carrid.
@@ -492,15 +493,12 @@ DATA: BEGIN OF struc,
"Some value assignment
struc2 = VALUE #( num = 1 ref = NEW #( 2 ) ).
struc = VALUE #( num = 1 ref = NEW #( 2 ) ).
"Internal table
DATA itab LIKE TABLE OF struc WITH EMPTY KEY.
"Some value assignment in the first table line
"assuming the table is filled and a line is available.
APPEND struc TO itab.
itab[ 1 ]-ref->* = 123.
```

View File

@@ -1112,7 +1112,7 @@ Parameters of the `find` function:
- `len`:
- Specifies the length
- Must be of type `i`
- The fefault value is the length of the string (minus a defined offset in `off`)
- The default value is the length of the string (minus a defined offset in `off`)
- The exception `CX_SY_RANGE_OUT_OF_BOUNDS` is raised if the offset is negative and a range is not contained in the searched string
- `pcre`: Regular expression

View File

@@ -77,7 +77,7 @@ ABAP cheat sheets[^1] ...
## 🎬 Getting Started with the Examples
The executable examples are designed to be imported into the SAP BTP ABAP environment, but they are basically suitable for both on-premise systems (ABAP release > 7.56; especially the RAP examples) and the SAP BTP ABAP environment (hence there are no ABAP reports included). Therefore, check the information in the following collapsible sections for your system environment and perform the required steps.
The executable examples are designed to be imported into the SAP BTP ABAP environment, but they are basically suitable for both on-premise systems (ABAP release >= 7.56; especially the RAP examples) and the SAP BTP ABAP environment (hence there are no ABAP reports included). Therefore, check the information in the following collapsible sections for your system environment and perform the required steps.
<details>
<summary>1) General info</summary>
@@ -185,9 +185,9 @@ Use the standalone version of the abapGit report to import the demo examples of
<br>
## ⚡ Known Issues
- Only one user on the system can import this repository because all object names must be globally unique. If you get an error that the objects already exist when you try to import, search the system for classes named `ZCL_DEMO_ABAP*`. Someone has already imported the content into the system and you can simply check out that imported version.
- Only one user on the system can import this repository because all object names must be globally unique. Before importing the code, you should perform a system-wide search for classes named `ZCL_DEMO_ABAP*`, for example. If someone has already imported the content into the system, you can simply check out that imported code.
- Since the repository contains self-contained examples, i.e. some of them work with demo database tables included in the repository (note that these tables are populated during method executions), all demo artifacts must be imported for all examples to work.
- When importing into an on-premise system, note the following: The demos cover ABAP syntax regardless of the ABAP release to avoid scattering information and to get the information in one go. Therefore, there may be syntax that is not yet available in the ABAP version of your on-premise system. In this case, you may want to comment out the affected code sections and/or ignore the affected artifacts if an activation fails. Note that the RAP examples in particular require at least ABAP version 7.56.
- When importing into an on-premise system, note the following: The demos cover ABAP syntax regardless of the ABAP release to avoid scattering information and to have the information in one go. Therefore and if you are not running the latest ABAP version, there may be syntax that is not yet available in the ABAP version of your on-premise system. In this case, you may want to comment out the affected code sections or ignore the affected artifacts if an activation fails. Note that the RAP examples in particular require at least ABAP version 7.56.
- 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).
<br>

View File

@@ -243,7 +243,7 @@ CLASS zcl_demo_abap_sql IMPLEMENTATION.
INTO @DATA(exists).
IF exists = abap_true.
output->display( |A line was found.| ).
output->display( `A line was found.` ).
ELSE.
output->display( `Nothing found.` ).
ENDIF.
@@ -547,7 +547,6 @@ CLASS zcl_demo_abap_sql IMPLEMENTATION.
output->display( input = dref->* name = `dref->*` ).
**********************************************************************
output->next_section( `Excursion: ABAP SQL - Operands and Expressions` ).

View File

@@ -30,7 +30,7 @@ define view entity zdemo_abap_cds_ve_agg_exp
// - Aggregate expressions can be used as elements of an element list. Other positions are possible.
// - An alias name must be specified.
// - A GROUP BY clause is required. It must list all non-aggregated fields from the element list.
// - Additions: If ALL is used, all rows in the result set are respected. This the default setting.
// - Additions: If ALL is used, all rows in the result set are respected. This is the default setting.
// If DISTINCT is used, only distinct values of an argument are respected.
// AVG (Returns the average value of an argument)