Update content

This commit is contained in:
Daniel Reger
2023-01-11 14:45:25 +01:00
parent 93a2788207
commit 90a2c55ba1
19 changed files with 44 additions and 60 deletions

View File

@@ -796,7 +796,7 @@ SELECT SINGLE
FROM zdemo_abap_carr
WHERE carrid = 'LH'
INTO @FINAL(string_functions).
INTO @DATA(string_functions).
```
Example: [Special functions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_sql_special_functions.htm)
@@ -845,7 +845,7 @@ SELECT SINGLE
is_valid( @( cl_abap_context_info=>get_system_time( ) ) ) AS time_is_valid
FROM zdemo_abap_carr
INTO @FINAL(special_functions).
INTO @DATA(special_functions).
```
[Aggregate expressions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapselect_aggregate.htm)
@@ -891,7 +891,7 @@ SELECT
FROM zdemo_abap_flsch
WHERE carrid = 'LH'
GROUP BY carrid
INTO TABLE @FINAL(agg_exp).
INTO TABLE @DATA(agg_exp).
```
**More SQL Expressions**

View File

@@ -1183,7 +1183,7 @@ ENDCLASS.
CLASS class IMPLEMENTATION.
METHOD factory_method.
IF par =
IF par = ...
obj = NEW class( ).
ELSE.
...

View File

@@ -210,7 +210,7 @@ side. Various expressions and strings can be chained using the
operator](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenconcatenation_operator_glosry.htm "Glossary Entry")
`&&`. Alternatively, you might chain strings using [string
templates](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenstring_template_glosry.htm "Glossary Entry")
and as outlined in the section [Concatenating Strings]. `Concatenating Strings`.
and as outlined in the section *Concatenating Strings*.
``` abap
str5 = str3 && ` ` && str4 && `!`. "X 1-!
"Note the output for str4 that includes the conversion of type i to
@@ -629,17 +629,17 @@ s2 = substring( val = s1 len = 5 ). "Lorem
"Specifying both off and len parameters
s2 = substring( val = s1 off = 6 len = 5 ). "ipsum
DATA(ch5) = 'Lorem ipsum dolor sit amet'. "Type c
DATA(txt) = 'Lorem ipsum dolor sit amet'. "Type c
"Offset and length specification using the + sign after a variable
DATA(ch6) = ch2+0(5). "Lorem
DATA(ch6) = txt+0(5). "Lorem
"* means respecting the rest of the remaining string
DATA(ch7) = ch2+12(*). "dolor sit amet
DATA(ch7) = txt+12(*). "dolor sit amet
CLEAR ch5+11(*). "Lorem ipsum
CLEAR txt+11(*). "Lorem ipsum
ch5+0(5) = 'Hallo'. "Hallo ipsum dolor sit amet
txt+0(5) = 'Hallo'. "Hallo ipsum dolor sit amet
"Further string functions
s1 = `aa1bb2aa3bb4`.

View File

@@ -318,7 +318,7 @@ METHODS some_action FOR MODIFY
[`%cid`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_cid.htm)).
- `failed`: Information for identifying the data set for
which an error occurred in a RAP operation
- `reported`: Used to exchange, for example, error messages for each
- `reported`: Used, for example, to exchange error messages for each
entity defined in the BDEF and [not related to a specific
entity](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_other.htm).
- Example: Technically, the `reported` parameter is a
@@ -969,15 +969,11 @@ instances](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?
`key` in the underlying [CDS view entity](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_v2_view_glosry.htm "Glossary Entry")
of the RAP BO.
- The primary key uniquely identifies each RAP BO entity instance.
- After the creation of an instance and the primary key during a [RAP create operation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_create_operation_glosry.htm "Glossary Entry"),
the primary key cannot be changed.
- Note the concept of [late numbering](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenlate_numbering_glosry.htm "Glossary Entry")
where newly created entity instances are given their final key
only shortly before saving in the database. Until then, the
business logic uses a temporary key that has to be replaced.
- After the creation of an instance including the primary key during a [RAP create operation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_create_operation_glosry.htm "Glossary Entry"),
the primary key can no longer be changed.
- Note that there are different numbering concepts, such as [early](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_early_numbering_glosry.htm) and [late numbering](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenlate_numbering_glosry.htm "Glossary Entry"). In the latter concept, newly created entity instances are given their final key only shortly before saving in the database. Until then, the business logic uses a temporary key that has to be replaced.
- If a data set with a particular primary key already exists in the
persistent database table, the saving of a RAP BO instance with a
duplicate primary key is rejected.
persistent database table, the saving of a RAP BO instance is rejected because of a duplicate primary key.
**How can a RAP BO instance be uniquely identified?**
@@ -1017,12 +1013,7 @@ instances](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?
- Used as a unique and preliminary identifier for RAP BO instances
in RAP create operations, especially where no primary key exists
for the particular instance.
- For newly created instances, the ID can then be used for
performing further, referencing modifications on those instances
using
[`%cid_ref`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_cid_ref.htm)
(which has the same value as `%cid` is then used, for
example, in RAP operations using [`CREATE BY`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmodify_entity_entities_op.htm), [`UPDATE`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmodify_entity_entities_op.htm)
- For newly created instances, the ID can then be used for performing further modifications, referencing to those instances using [`%cid_ref`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapderived_types_cid_ref.htm) (which has the same value as %cid), for example, in RAP operations using [`CREATE BY`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmodify_entity_entities_op.htm), [`UPDATE`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmodify_entity_entities_op.htm)
and
[`DELETE`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmodify_entity_entities_op.htm),
as well as
@@ -1033,7 +1024,7 @@ instances](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?
`%pid` for late numbering scenarios, `%cid` (and
`%cid_ref`) are only available on a short-term basis
for the current ABAP EML request within the [RAP interaction phase](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_int_phase_glosry.htm "Glossary Entry") in one [RAP LUW](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_luw_glosry.htm "Glossary Entry").
- **Note:** The specification of `%cid` should be done even if there are no further operations referring to it.
- **Note:** Specify `%cid` even if there are no further operations referring to it.
- Special case: Late numbering
- As mentioned above, in late numbering scenarios newly created
entity instances are given their final key only shortly before
@@ -1107,14 +1098,8 @@ contains all relevant components for the chosen scenario.
in order to allow transactions to expand over different ABAP
sessions.
- Like the concepts mentioned above, a RAP BO can be draft-enabled in
the BDEF. This concept enters the picture, for example, if you have
an application allowing data modifications and the temporary storage
of modifications but does not yet persist them to the database. You
can continue modifying this data later and you might even use a
different device from the one where you modified the data
previously.
- The draft indicator `%is_draft` enters the picture here for
RAP BO instance identification. It is used to indicate if a RAP BO
the BDEF. If enabled, the application allows data modifications and the temporary storage of modifications but does not yet persist them to the database. The users of the application can continue modifying this data later and they might even use a different device from the one where they modified the data previously.
- The draft indicator `%is_draft` is available for RAP BO instance identification. It is used to indicate if a RAP BO
instance is a [draft instance](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_draft_instance_glosry.htm "Glossary Entry")
or an [active instance](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrap_active_instance_glosry.htm "Glossary Entry").
Conveniently, the component group `%tky` contains

View File

@@ -192,7 +192,7 @@ METHOD amdp_meth
                  
"Beginning of the SQLScript code (note that it is not ABAP code although it looks similar)
  ... "Here goes SAPScript code
  ... "Here goes SQLScript code
      "Note that an AMDP method implementation must not be empty.
"End of the SQLScript code
@@ -288,7 +288,7 @@ METHOD amdp_func
"Beginning of the SQLScript code (note that it is not ABAP code although it looks similar)
  ... "Here goes SAPScript code;
  ... "Here goes SQLScript code;
      "AMDP table function to be called by other AMDP methods only
"End of the SQLScript code

View File

@@ -507,8 +507,7 @@ Regarding the exiting of procedures, note the hint mentioned above. The use of `
"Multiple classes in a list and CATCH blocks can be specified
"Note: If there are multiple CATCH blocks for exceptions that are in an inheritance
"relationship, you must pay attention that the more special exceptions are specified
"before the more general ones. Otherwise, a handler for a more general exception
"is called before the more special one.
"before the more general ones.
TRY.
... "TRY block
CATCH cx_abc cx_bla cx_blabla.
@@ -637,7 +636,7 @@ RAISE EXCEPTION TYPE cx_sy_zerodivide.
- Runtime errors are caused by uncatchable exceptions when a program is executed, when a catchable exception is not caught, or they can be forced by, for example, using [`ASSERT`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapassert.htm) statements.
- Every runtime error terminates the program, which in turn raises a [database rollback](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abendatabase_rollback_glosry.htm) and is documented by default in a [short dump](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenshort_dump_glosry.htm).
- Regarding `ASSERT` statements: `ASSERT` is followed by a logical expression. If the expression is false, the program is terminated and an uncatchable exception is raised resulting in the runtime error `ASSERTION_FAILED`. Note that each runtime error is identified by a name and assigned to a specific error situation. It leads to a .
- Regarding `ASSERT` statements: `ASSERT` is followed by a logical expression. If the expression is false, the program is terminated and an uncatchable exception is raised resulting in the runtime error `ASSERTION_FAILED`. Note that each runtime error is identified by a name and assigned to a specific error situation.
```abap
"The ASSERT keyword is followed by a logical expression.

View File

@@ -203,7 +203,7 @@ The code examples presented in this repository are only syntax examples and are
SAP does not guarantee either the correctness or the completeness of the code. In addition, SAP takes no legal responsibility or liability for possible errors or their consequences, which occur through the use of the example programs.
## 📟 How to Obtain Support
This project is provided "as-is": there is no guarantee that raised issues will be answered or addressed in future releases.
Please do not create pull requests. If you like to address issues or suggestions, please create an issue. However, this project is provided "as-is": there is no guarantee that raised issues will be answered or addressed in future releases.
## 📜 License
Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the [LICENSE](LICENSE) file.

View File

@@ -15,7 +15,7 @@
* and data exchange between a RAP BO consumer, which is a class
* in this case, and RAP BO provider can work. Additionally, it shows
* how the methods for non-standard RAP BO operations might be
* self-implemented in an ABP. The example is is intentionally kept
* self-implemented in an ABP. The example is intentionally kept
* short and simple and focuses on specific RAP aspects. For this reason,
* the example might not fully meet the requirements of the RAP BO contract.
*
@@ -738,7 +738,7 @@ CLASS lhc_root IMPLEMENTATION.
<f>-%action-multiply_by_3 = if_abap_behv=>mk-on.
ENDLOOP.
"Multiply integer values by 2
"Multiply integer values by 3
MODIFY ENTITIES OF zdemo_abap_rap_ro_u IN LOCAL MODE
ENTITY root
UPDATE FIELDS ( field3 field4 ) WITH VALUE #( FOR key IN result ( %tky = key-%tky

View File

@@ -29,7 +29,7 @@
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
* sections. Plus, the variable name is displayed in most cases. Hence,
* to easier and faster find the relevant output in the console, just
* search in the console for the number/variable name (STRG+F in the
* search in the console for the number/variable name (CTRL+F in the
* console) or use the debugger.
*
* ----------------------------- NOTE -----------------------------------
@@ -224,7 +224,7 @@ CLASS zcl_demo_abap_amdp IMPLEMENTATION.
"Note: When commented in, the following code results in a runtime
"error since you cannot call an AMDP function in ABAP directly.
* NEW ZCL_demo_ABAP_AMDP( )->get_carr_fli(
* NEW zcl_demo_abap_amdp( )->get_carr_fli(
* EXPORTING carrid = 'LH' ).
**********************************************************************

View File

@@ -26,7 +26,7 @@
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
* sections. Plus, the variable name is displayed in most cases. Hence,
* to easier and faster find the relevant output in the console, just
* search in the console for the number/variable name (STRG+F in the
* search in the console for the number/variable name (CTRL+F in the
* console) or use the debugger.
*
* ----------------------------- NOTE -----------------------------------

View File

@@ -81,7 +81,7 @@ ENDCLASS.
CLASS ZCL_demo_ABAP_OBJECTS IMPLEMENTATION.
CLASS zcl_demo_abap_objects IMPLEMENTATION.
METHOD hallo_instance_method.

View File

@@ -552,7 +552,7 @@ CLASS zcl_demo_abap_prog_flow_logic IMPLEMENTATION.
"substring. Then, a REPLACE statement is used and that only replaces
"the substring according to the values. The condition for WHILE is
"tailored in a way that the loop is terminated if there are no more
"findings. The number of findings are also output - a number that
"findings. The number of findings is also displayed - a number that
"corresponds to the number of loop passes.
DATA(while_string) = `##abap####abap#abap######abap###abapabap##abap`.
@@ -1061,7 +1061,7 @@ CLASS zcl_demo_abap_prog_flow_logic IMPLEMENTATION.
"specified for the RAISING addition. If an actual parameter has a certain
"value, the method raises an exception.
"You can comment in the following line of code to see the enforcement.
"A syntax warning is displayed since, there is no proper exception handling.
"A syntax warning is displayed since there is no proper exception handling.
"DATA(my_user_a) = whats_my_user( get_name = abap_false ).

View File

@@ -33,7 +33,7 @@
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
* sections. Plus, the variable name is displayed in most cases. Hence,
* to easier and faster find the relevant output in the console, just
* search in the console for the number/variable name (STRG+F in the
* search in the console for the number/variable name (CTRL+F in the
* console) or use the debugger.
*
* ----------------------- GETTING STARTED (2) -------------------------
@@ -64,9 +64,9 @@
* columns are displayed, choose the 'Settings' button and select the
* desired columns.
* Choosing the 'Go' button refreshes the list. At first use, there
* might not any entry. You can create an entry choosing the 'Create'
* might not be any entry. You can create an entry choosing the 'Create'
* button.
* The late numbering aspects comes into the picture when you, for
* The late numbering aspects enters the picture when you, for
* example, create a new instance, i. e. create a new calculation, and
* you keep a draft version of it instead of saving it to the database.
* The calculation ID which represents the key of the instance has an

View File

@@ -30,7 +30,7 @@
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
* sections. Plus, the variable name is displayed in most cases. Hence,
* to easier and faster find the relevant output in the console, just
* search in the console for the number/variable name (STRG+F in the
* search in the console for the number/variable name (CTRL+F in the
* console) or use the debugger.
*
* ----------------------------- NOTE -----------------------------------

View File

@@ -30,7 +30,7 @@
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
* sections. Plus, the variable name is displayed in most cases. Hence,
* to easier and faster find the relevant output in the console, just
* search in the console for the number/variable name (STRG+F in the
* search in the console for the number/variable name (CTRL+F in the
* console) or use the debugger.
*
* ----------------------------- NOTE -----------------------------------

View File

@@ -20,7 +20,7 @@
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
* sections. Plus, the variable name is displayed in most cases. Hence,
* to easier and faster find the relevant output in the console, just
* search in the console for the number/variable name (STRG+F in the
* search in the console for the number/variable name (CTRL+F in the
* console) or use the debugger.
*
* ----------------------------- NOTE -----------------------------------

View File

@@ -17,7 +17,7 @@
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
* sections. Plus, the variable name is displayed in most cases. Hence,
* to easier and faster find the relevant output in the console, just
* search in the console for the number/variable name (STRG+F in the
* search in the console for the number/variable name (CTRL+F in the
* console) or use the debugger.
* ----------------------------- NOTE -----------------------------------
* The code presented in this class is only meant for supporting the ABAP

View File

@@ -20,7 +20,7 @@
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
* sections. Plus, the variable name is displayed in most cases. Hence,
* to easier and faster find the relevant output in the console, just
* search in the console for the number/variable name (STRG+F in the
* search in the console for the number/variable name (CTRL+F in the
* console) or use the debugger.
*
* ----------------------------- NOTE -----------------------------------

View File

@@ -20,7 +20,7 @@
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
* sections. Plus, the variable name is displayed in most cases. Hence,
* to easier and faster find the relevant output in the console, just
* search in the console for the number/variable name (STRG+F in the
* search in the console for the number/variable name (CTRL+F in the
* console) or use the debugger.
* ----------------------------- NOTE -----------------------------------
* The code presented in this class is only meant for supporting the ABAP