Correct typos
This commit is contained in:
@@ -157,7 +157,7 @@ DATA: struc_6 LIKE struc_1,
|
||||
Creating structures by inline declaration using `DATA(...)`
|
||||
- This is particularly useful for declaring data objects at the [operand positions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenoperand_position_glosry.htm) where you actually need them.
|
||||
- In this way, you can avoid an extra declaration of the structure in different contexts.
|
||||
- In newer ABAP releases, you can use the [`FINAL`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenfinal_inline.htm) declaration operator to create [immutable variables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenimmutable_variable_glosry.htm).
|
||||
- You can also use the [`FINAL`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenfinal_inline.htm) declaration operator to create [immutable variables](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenimmutable_variable_glosry.htm).
|
||||
|
||||
``` abap
|
||||
"Structures created inline instead of an extra declared variable
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
concept is very handy particularly in this context: [Inline
|
||||
declaration](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abeninline_declaration_glosry.htm "Glossary Entry").
|
||||
- This means that you can declare a variable using
|
||||
`DATA(var)` (or, in newer ABAP releases, an immutable variable
|
||||
`DATA(var)` (or an immutable variable
|
||||
[`FINAL(var)`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenfinal_inline.htm))
|
||||
as an operand in the current [write
|
||||
position](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenwrite_position_glosry.htm "Glossary Entry").
|
||||
|
||||
@@ -649,7 +649,7 @@ Note that dynamically specifying syntax elements has downsides, too. Consider so
|
||||
READ TABLE itab INTO DATA(wa) WITH KEY (field_name) = ...
|
||||
|
||||
"MODIFY: Dynamically specifying WHERE conditions
|
||||
DATA(condition) = ( `CARRID = 'LH'` ).
|
||||
DATA(condition) = `CARRID = 'LH'`.
|
||||
|
||||
MODIFY itab FROM ... TRANSPORTING ... WHERE (condition).
|
||||
|
||||
@@ -724,12 +724,12 @@ Note that dynamically specifying syntax elements has downsides, too. Consider so
|
||||
"attributes and that are specified dynamically.
|
||||
DATA cl_ref TYPE REF TO cl_some_class.
|
||||
cl_ref = NEW #( ).
|
||||
ASSIGN cl_ref->('some_attribute') TO FIELD-SYMBOL(<another_fs>).
|
||||
ASSIGN cl_ref->(SOME_ATTRIBUTE') TO FIELD-SYMBOL(<another_fs>).
|
||||
|
||||
"If ELSE UNASSIGN is specified, no memory area is assigned to
|
||||
"the field symbol. It has the state unassigned after the ASSIGN
|
||||
"statement.
|
||||
ASSIGN cl_ref->('attr_xyz') TO FIELD-SYMBOL(<attr>) ELSE UNASSIGN.
|
||||
ASSIGN cl_ref->('SOME_ATTRIBUTE') TO FIELD-SYMBOL(<attr>) ELSE UNASSIGN.
|
||||
```
|
||||
|
||||
- Dynamically specifying data types/creating (data) objects
|
||||
@@ -1208,7 +1208,7 @@ TYPES some_ref_type2cl TYPE REF TO zcl_demo_abap_dynamic_prog.
|
||||
|
||||
"Using RTTC methods
|
||||
"You can create a reference type from a base type. This base type
|
||||
"may be class, interface or data type.
|
||||
"may be a class, interface or data type.
|
||||
DATA(tdo_ref_1) = cl_abap_refdescr=>get( cl_abap_elemdescr=>get_t( ) ).
|
||||
DATA(tdo_ref_2) = cl_abap_refdescr=>get(
|
||||
cl_abap_typedescr=>describe_by_name( 'ZCL_DEMO_ABAP_DYNAMIC_PROG' ) ).
|
||||
|
||||
@@ -116,7 +116,7 @@ ENDCLASS.
|
||||
```
|
||||
|
||||
- [Named](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abennamed_data_object_glosry.htm) character-like data types and objects can be declared like other types and objects using [`TYPES`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abaptypes.htm), [`DATA`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapdata.htm) [`CONSTANTS`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapconstants.htm) and by referring to a character-like data type.
|
||||
- In addition, character-like data objects can be declared inline with the operators `DATA` and, in newer ABAP releases, `FINAL`, as shown below.
|
||||
- In addition, character-like data objects can be declared inline with the operators `DATA` and [`FINAL`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenfinal_inline.htm).
|
||||
|
||||
Syntax examples:
|
||||
``` abap
|
||||
@@ -194,7 +194,7 @@ DATA str4 TYPE string VALUE -1. "type i
|
||||
DATA(char2) = 'abcd'. "Type c length 4
|
||||
DATA(str5) = `efgh`.
|
||||
|
||||
"In newer ABAP releases, you can use FINAL to create immutable variables.
|
||||
"You can use FINAL to create immutable variables.
|
||||
FINAL(final_string) = `zyx`.
|
||||
|
||||
"Since char2 is of type c length 4 (the length is also derived),
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
## Introduction
|
||||
|
||||
⚠️ Most of the content of this cheat sheet is only relevant to [classic ABAP](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenclassic_abap_glosry.htm).
|
||||
⚠️ The concept is relevant to both ABAP Cloud and classic ABAP, but some of the statements covered in the cheat sheet and executable example are only relevant to [classic ABAP](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenclassic_abap_glosry.htm).
|
||||
|
||||
This cheat sheet provides a high-level overview of the [SAP LUW](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abensap_luw_glosry.htm) concept that deals with data consistency with a focus on SAP LUW-related statements, supported by an executable example to check the syntax in action.
|
||||
|
||||
@@ -93,7 +93,7 @@ The following terms are related to the concept of the SAP LUW and try to give yo
|
||||
- A work process can execute only a single database LUW. It cannot interfere with the database LUWs of other work processes.
|
||||
|
||||
|
||||
<p align="right">(<a href="#top">⬆️ back to top</a>)
|
||||
<p align="right"><a href="#top">⬆️ back to top</a></p>
|
||||
|
||||
|
||||
## SAP LUW Overview
|
||||
@@ -111,7 +111,7 @@ Using the above bank transfer as an example:
|
||||
- You cannot debit account A in one work process and then credit account B in a separate work process. When the work process changes, new totals would be available in one account, but not in the other. Consider the consequences if an error occurs and the new totals for account B cannot be updated, and so on. You would no longer be able to easily roll back the changes.
|
||||
- Consider prematurely updating the database and notifying the users or processing the data while the logical unit has not been successfully completed.
|
||||
|
||||
<p align="right">(<a href="#top">⬆️ back to top</a>)
|
||||
<p align="right"><a href="#top">⬆️ back to top</a></p>
|
||||
|
||||
### Bundling Techniques
|
||||
The following bundling techniques are available for classic ABAP. This means that programming units are registered in different work processes, but are executed by a single work process. All database changes are put into one database LUW, and all changes are committed in one final database commit.
|
||||
@@ -122,13 +122,13 @@ The following bundling techniques are available for classic ABAP. This means tha
|
||||
- Usually contain database modification operations/statements
|
||||
- [`CALL FUNCTION ... IN UPDATE TASK`](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapcall_function_update.htm) statements are used to register the update function modules for later execution; the actual execution is triggered by a `COMMIT WORK` statement
|
||||
|
||||
- Example of a simple function module that has an importing parameter (a structure that is used to modify a database table). Example function modules in the repository are marked as update function modules.
|
||||
- Example of a simple function module that has an importing parameter (a structure that is used to modify a database table). It simply shows a database modifying statement contained in a function module. The code alone does not distinguish it as an update function module. You can open the imported example function modules from the repository. They are marked as update function modules.
|
||||
```abap
|
||||
FUNCTION zsome_update_fu_mod
|
||||
IMPORTING
|
||||
VALUE(values) TYPE some_dbtab.
|
||||
|
||||
MODIFY some_dbtab FROM values.
|
||||
MODIFY some_dbtab FROM @values.
|
||||
|
||||
ENDFUNCTION.
|
||||
```
|
||||
@@ -210,7 +210,7 @@ The following bundling techniques are available for classic ABAP. This means tha
|
||||
- In the current work process, before update function modules.
|
||||
- When they are registered in an update function module with `ON COMMIT`, they are executed at the end of the update. This happens in the update work process for non-local updates, and in the current work process for local updates.
|
||||
|
||||
<p align="right">(<a href="#top">⬆️ back to top</a>)
|
||||
<p align="right"><a href="#top">⬆️ back to top</a></p>
|
||||
|
||||
### Related ABAP Statements
|
||||
|
||||
@@ -240,7 +240,7 @@ The statements to end an SAP LUW have already been mentioned above: [`COMMIT WOR
|
||||
> - Within the SAP LUW, database changes and commits are allowed on service connections or through secondary database connections.
|
||||
|
||||
|
||||
<p align="right">(<a href="#top">⬆️ back to top</a>)
|
||||
<p align="right"><a href="#top">⬆️ back to top</a></p>
|
||||
|
||||
## Concepts Related to the SAP LUW
|
||||
The following concepts are related to the SAP LUW to ensure transactional consistency. They are not discussed in detail here. For more information, see the links.
|
||||
@@ -267,12 +267,14 @@ The following concepts are related to the SAP LUW to ensure transactional consis
|
||||
- contain the key fields on which a lock is to be set.
|
||||
- When a lock object is created, two [lock function modules](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenlock_function_module_glosry.htm) (`ENQUEUE_...` and `DEQUEUE_...`) are automatically generated. They are executed in a special enqueue work process. When a record is locked during a transaction (by the enqueue function module), a central lock table is filled with the table name and key field information. Unlike database locks, a locked entry in a lock object does not necessarily have to exist in a database table. Also, the locking must be done proactively, i. e. there is no automatic locking. You must make sure that the application implementation checks the lock entries.
|
||||
- At the end of an SAP LUW, all locks should be released, either automatically during the database update or explicitly when you call the corresponding dequeue function module.
|
||||
- More information: [SAP Locks](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abensap_lock.htm)
|
||||
- More information:
|
||||
- [SAP Locks](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abensap_lock.htm)
|
||||
- Also note the information on the [`CL_ABAP_LOCK_OBJECT_FACTORY`](https://help.sap.com/docs/sap-btp-abap-environment/abap-environment/lock-objects) class
|
||||
|
||||
> **💡 Note**<br>
|
||||
> RAP comes with its own implementation features to cover these concepts. See the topics [Authorization Control](https://help.sap.com/docs/SAP_S4HANA_CLOUD/e5522a8a7b174979913c99268bc03f1a/375a8124b22948688ac1c55297868d06.html) and [Concurrency Control](https://help.sap.com/docs/SAP_S4HANA_CLOUD/e5522a8a7b174979913c99268bc03f1a/d315c13677d94a6891beb3418e3e02ed.html) in the *Development guide for the ABAP RESTful Application Programming Model*.
|
||||
|
||||
<p align="right">(<a href="#top">⬆️ back to top</a>)
|
||||
<p align="right"><a href="#top">⬆️ back to top</a></p>
|
||||
|
||||
## Notes on the SAP LUW in ABAP Cloud and RAP
|
||||
|
||||
@@ -289,9 +291,9 @@ There are RAP-specific [ABAP EML](https://help.sap.com/doc/abapdocu_latest_index
|
||||
## More Information
|
||||
- [The RAP Transactional Model and the SAP LUW](https://help.sap.com/docs/SAP_S4HANA_CLOUD/e5522a8a7b174979913c99268bc03f1a/ccda1094b0f845e28b88f9f50a68dfc4.html) (Development guide for the ABAP RESTful Application Programming Model)
|
||||
- [The SAP LUW in ABAP Cloud](https://blogs.sap.com/2022/12/05/the-sap-luw-in-abap-cloud/) (blog)
|
||||
- [Cheat sheet about ABAP EML](08_EML_ABAP_for_RAP.md)
|
||||
- [SAP LUW in the ABAP Keyword Documentation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensap_luw.htm)
|
||||
|
||||
<p align="right">(<a href="#top">⬆️ back to top</a>)
|
||||
<p align="right"><a href="#top">⬆️ back to top</a></p>
|
||||
|
||||
## Executable Example
|
||||
|
||||
@@ -312,7 +314,7 @@ After importing, find the program in ADT using search: Press `CTRL+SHIFT+A` and
|
||||
<summary>Expand to see explanations of the executable example</summary>
|
||||
<!-- -->
|
||||
<br>
|
||||
Th example demonstrates the SAP LUW using dynpros and bundling techniques with update function modules and subroutines. In the dynpros, you can select various options that determine how the program runs. It covers the following aspects:
|
||||
The example demonstrates the SAP LUW using dynpros and bundling techniques with update function modules and subroutines. In the dynpros, you can select various options that determine how the program runs. It covers the following aspects:
|
||||
|
||||
- Demonstrating synchronous update, asynchronous update, and local update triggered by `COMMIT WORK`, `COMMIT WORK AND WAIT`, and `SET UPDATE TASK LOCAL` using update function modules.
|
||||
- Demonstrating the statements `PERFORM ... ON COMMIT` and `PERFORM ... ON ROLLBACK` using subroutines.
|
||||
@@ -354,7 +356,7 @@ The log shows the value 1 for the transaction state after the update task is exe
|
||||
- **Terminating the program with an error message** of type A: This option only indicates that if such a message is generated, the program is terminated and all changes are implicitly rolled back. In this case, you may want to check the database table entries that remain unchanged.
|
||||
- **Using subroutines**:
|
||||
- Note that subroutines are considered obsolete and should no longer be used. This is to demonstrate the effect as a bundling technique in an SAP LUW. Selecting this option triggers the registration of subroutines for commit (to delete the database table entry, insert a newly created entry, insert entries in the log table) and rollback (this subroutine does nothing specific; it is just to demonstrate that the subroutine is called in the event of a rollback).
|
||||
- When you select the commit options, the subroutines registered with ON COMMIT are executed in the current work process.
|
||||
- When you select the commit options, the subroutines registered with `ON COMMIT` are executed in the current work process.
|
||||
- Choosing `COMMIT WORK` or `COMMIT WORK AND WAIT` has the same effect: When these statements are called and a `SELECT` statement follows, the number of database table entries is 1 in both cases.
|
||||
- If the rollback option is selected, the subroutine registered with `ON ROLLBACK` is executed in the current work process.
|
||||
- The transaction state in the log is 1 for `ON COMMIT` or `ON ROLLBACK` when the corresponding subroutines are called.
|
||||
|
||||
14
18_Dynpro.md
14
18_Dynpro.md
@@ -24,11 +24,11 @@
|
||||
- [Tabstrips Controls](#tabstrips-controls)
|
||||
- [GUI Controls](#gui-controls)
|
||||
- [More Information](#more-information)
|
||||
- [Example](#example)
|
||||
- [Executable Example](#executable-example)
|
||||
|
||||
## Introduction
|
||||
|
||||
⚠️ The content of this cheat sheet is only relevant to [classic ABAP](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenclassic_abap_glosry.htm).
|
||||
⚠️ The content of this cheat sheet and the executable example are only relevant to [classic ABAP](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenclassic_abap_glosry.htm).
|
||||
|
||||
[User interfaces (UI)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenuser_interface_glosry.htm) are not limited to displaying some information, they must also allow the user to interact with the program.
|
||||
In modern UI technologies, this can be achieved through [events](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenevent_glosry.htm), i.e. [user actions](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenuser_action_glosry.htm) on a UI trigger events, and UI methods register these events and react accordingly. In this way, users control the program flow through their actions.
|
||||
@@ -53,7 +53,7 @@ This cheat sheet provides a high-level overview of classic dynpro topics with a
|
||||
- Can only be defined in [function groups](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenfunction_group_glosry.htm), [module pools](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenmodul_pool_glosry.htm) (not [class pools](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenclass_pool_glosry.htm)) and [executable program](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenexecutable_program_glosry.htm) (*reports*; the focus in the cheat sheet is on the latter)
|
||||
- Can be identified by a unique, four-digit [dynpro number](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abendynpro_number_glosry.htm) in an [ABAP program](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_program_glosry.htm). Note that leading zeros need not be specified when calling the dynpro. Number 1000 is reserved, as are other dynpro number ranges (e.g. used by SAP). The current dynpro can be retrieved using `sy-dynnr`.
|
||||
- Is displayed in a window of [SAP GUI](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abensap_gui_glosry.htm)
|
||||
- Consists of 3 main aspects:
|
||||
- Consists of the following main aspects:
|
||||
- Specific characteristics when creating the dynpro. To name a few:
|
||||
- Dynpro type: Defines whether the dynpro is displayed in the full GUI window (if *Normal* is selected), in a pop-up window (*Modal Dialog Box*), or as a subscreen in a specific area within another dynpro in the same ABAP program.
|
||||
- [Next dynpro](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abennext_dynpro_glosry.htm): Statically specifies the next dynpro to be displayed in a [dynpro sequence](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abendynpro_sequence_glosry.htm). Setting the next dynpro to 0 or leaving the attribute blank will make the current dynpro the last dynpro in the sequence. If the next dynpro number is the same as the current dynpro, the dynpro continues to be called. The static next dynpro can be overwritten temporarily and dynamically in the ABAP program.
|
||||
@@ -714,12 +714,11 @@ PROCESS AFTER INPUT.
|
||||
- [SAP GUI User Dialogs](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_screens.htm) in the ABAP Keyword Documentation as the entry topic for dynpro-related topics
|
||||
- Documentation about the [screen painter in the Help Portal](https://help.sap.com/docs/ABAP_PLATFORM_NEW/bd833c8355f34e96a6e83096b38bf192/d1801b50454211d189710000e8322d00)
|
||||
- Documentation about the [menu painter in the Help Portal](https://help.sap.com/docs/ABAP_PLATFORM_NEW/bd833c8355f34e96a6e83096b38bf192/d1801ce8454211d189710000e8322d00)
|
||||
- In ADT, in your system, choose `CTRL+SHIFT+A` to open the search. Insert `demo_dynpro*` to get a list of dynpro examples of the ABAP Keyword Documentation.
|
||||
- Find more dynpro examples in the ABAP Keyword Documentation. In ADT, in your system, choose `CTRL + SHIFT + A` to open the search. Insert `demo_dynpro*` to get a list of dynpro examples.
|
||||
|
||||
## Example
|
||||
|
||||
After importing, find the program in ADT using the search: Press `CTRL+SHIFT+A` and enter `zdemo_abap_dynpro`. Open the program and run it by pressing `F8`.
|
||||
## Executable Example
|
||||
|
||||
After importing, find the program in ADT using the search: Choose `CTRL + SHIFT + A` and enter `zdemo_abap_dynpro`. Open the program and run it by choosing `F8`.
|
||||
|
||||
> **💡 Note**<br>
|
||||
> - The steps about how to import and run the code are outlined [here](README.md#-getting-started-with-the-examples).
|
||||
@@ -731,6 +730,7 @@ After importing, find the program in ADT using the search: Press `CTRL+SHIFT+A`
|
||||
> - See notes on the executable example in the expandable section below.
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<details>
|
||||
<summary>Expand to see explanations of the executable example</summary>
|
||||
|
||||
@@ -15,7 +15,7 @@ It provides references to more detailed information on the topic.
|
||||
# Terms
|
||||
|
||||
- ABAP Cloud
|
||||
- progamming paradigm for state-of-the-art, cloud-ready and upgrade-stable solutions
|
||||
- Progamming paradigm for state-of-the-art, cloud-ready and upgrade-stable solutions
|
||||
- Based on a usage type of the [ABAP Platform](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_platform_glosry.htm), where the following restrictions apply:
|
||||
- [ABAP language version](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_version_glosry.htm):
|
||||
- The available ABAP language version is [ABAP for Cloud Development](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_for_cloud_dev_glosry.htm) that presents a [restricted ABAP language version](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrestricted_version_glosry.htm) (for example, dynpro-related statements are not allowed).
|
||||
@@ -31,7 +31,7 @@ It provides references to more detailed information on the topic.
|
||||
- Supported in both [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) and [ABAP Platform Cloud](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_platform_cloud_glosry.htm).
|
||||
- Classic ABAP
|
||||
- Progamming paradigm for legacy solutions
|
||||
- Based on a ABAP Platform 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 an ABAP Platform 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).
|
||||
- Supported in [SAP S/4HANA](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensap_s4hana_glosry.htm)
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ It provides references to more detailed information on the topic.
|
||||
> - See more information in the topic [ABAP Language Versions, Release Contracts and Released APIs](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_versions_and_apis.htm).
|
||||
> - See the topic [Language Elements in ABAP Versions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrestricted_abap_elements.htm) that provides a table showing which ABAP language elements are allowed in which ABAP language version
|
||||
|
||||
<p align="right">(<a href="#top">⬆️ back to top</a>)</p>
|
||||
<p align="right"><a href="#top">⬆️ back to top</a></p>
|
||||
|
||||
# Excursions
|
||||
|
||||
@@ -49,7 +49,7 @@ It provides references to more detailed information on the topic.
|
||||
|
||||

|
||||
|
||||
As an example of a released API, consider the `CL_ABAP_RANDOM_INT` class (computes random integers). In ADT, once you have opened the class, check the *Properties* tab. Click *API State* on the left to display information about the release contracts. In this case, it is C1. As mentioned above, see [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_versions_and_apis.htm#@@ITOC@@ABENABAP_VERSIONS_AND_APIS_2) for more information on C1, and so on. This is also true for ABAP Repository objects in on-premise systems.
|
||||
As an example of a released API, consider the `CL_ABAP_RANDOM_INT` class (computes random integers). In ADT, once you have opened the class, check the *Properties* tab. Click *API State* on the left to display information about the release contracts. In this case, it is C1. As mentioned above, see [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_versions_and_apis.htm#@@ITOC@@ABENABAP_VERSIONS_AND_APIS_2) for more information on C1, and so on. This is also true for ABAP repository objects in on-premise systems.
|
||||
|
||||

|
||||
|
||||
@@ -92,12 +92,10 @@ It provides references to more detailed information on the topic.
|
||||
"No runtime error if you have imported the ABAP cheat sheet repository objects
|
||||
SELECT SINGLE carrid, connid FROM ('ZDEMO_ABAP_FLI') WHERE carrid = 'LH' INTO NEW @DATA(ref_b).
|
||||
|
||||
"Examples for deprecated and invalid syntax in ABAP for Cloud Development
|
||||
|
||||
"Examples for deprecated and invalid syntax in ABAP for Cloud Development
|
||||
DATA(num1) = 1.
|
||||
DATA(num2) = 1.
|
||||
DATA(num3) = 2.
|
||||
|
||||
"Invalid statement
|
||||
MOVE num3 TO num1.
|
||||
"Alternative that can be used
|
||||
@@ -118,7 +116,7 @@ It provides references to more detailed information on the topic.
|
||||
ref1 = REF #( num1 ).
|
||||
|
||||
DATA str_itab TYPE string_table.
|
||||
"Invalid statements
|
||||
"The following statements are invalid
|
||||
READ REPORT 'ZCL_DEMO_ABAP_UNIT_TEST=======CCAU' INTO str_itab.
|
||||
WRITE 'hi'.
|
||||
BREAK-POINT.
|
||||
@@ -128,14 +126,10 @@ It provides references to more detailed information on the topic.
|
||||
|
||||
2) If available to you, you have accessed an on-premise ABAP system using ADT.
|
||||
|
||||
You have the unrestricted ABAP language version at your disposal. For example, you can use the code from above and ...
|
||||
- insert it into an [executable program (F1 for Standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenexecutable_program_glosry.htm) (a *report*), create a local class and run the program. Reports are not available in ABAP Cloud.
|
||||
- create a global class in the ABAP Class Builder (transaction `SE24`). SAP GUI is not available in ABAP Cloud.
|
||||
|
||||
Assuming, as mentioned, you have accessed ADT, you can then check out the following:
|
||||
a) 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.
|
||||
a) Check API Status information
|
||||
- Choose `CTRL + SHIFT + A` to open the search in ADT. Search the class `CL_ABAP_RANDOM_INT`. Once you have opened the class, check the *Properties* tab and find the API status information.
|
||||
|
||||
b) Example class
|
||||
b) Create an example class
|
||||
- Create a global class and insert the code from above. Depending on the name of the class you created, replace the class name in the snippet.
|
||||
- If you have not imported the ABAP cheat sheet GitHub repository, remove the lines of code using artifacts from that repository, i.e. change the `SELECT` and `READ REPORT` statemnets. 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.
|
||||
@@ -150,7 +144,7 @@ It provides references to more detailed information on the topic.
|
||||
- For example, in your class, right-click and choose *Run As* → *4 ABAP Test Cockpit With...*. Enter `ABAP_CLOUD_READINESS` in the pop-up window and choose *Ok*. The ATC check run is started.
|
||||
- As a result of the ATC check run (note that it may take a while to complete), the *ATC Problems* tab in ADT should display results. In this case, these are the errors and warnings mentioned above, indicating that the code is not cloud-ready in various places. Double-click on the findings for more detailed information.
|
||||
|
||||
d) Cloud-ready development in an ABAP on-premise system
|
||||
d) Develop in an on-premise ABAP system in a cloud-ready manner
|
||||
- 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 develop in a cloud-ready way and use ABAP for Cloud Development, i.e. the restricted ABAP language version, in an on-premise ABAP system that allows the unrestricted ABAP language version.
|
||||
- Open the *Properties* tab and choose *General* for this purpose.
|
||||
@@ -158,7 +152,7 @@ It provides references to more detailed information on the topic.
|
||||
- Select *ABAP for Cloud Development* in the pop-up window and choose *Ok*.
|
||||
- You will then be able to work with a repository object with the restrictions mentioned above. As a result, the example class with the code snippets will have syntax errors and cannot be activated. In more meaningful, productive development contexts, appropriate refactoring is required.
|
||||
|
||||
<p align="right">(<a href="#top">⬆️ back to top</a>)</p>
|
||||
<p align="right"><a href="#top">⬆️ back to top</a></p>
|
||||
|
||||
# More Information
|
||||
|
||||
@@ -176,7 +170,7 @@ It provides references to more detailed information on the topic.
|
||||
- [Rules for ABAP Cloud](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_strict_rules.htm)
|
||||
- [Language Elements in ABAP Versions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrestricted_abap_elements.htm): A table showing which ABAP language elements are allowed in which ABAP language version
|
||||
|
||||
<p align="right">(<a href="#top">⬆️ back to top</a>)</p>
|
||||
<p align="right"><a href="#top">⬆️ back to top</a></p>
|
||||
|
||||
|
||||
# Executable Example
|
||||
|
||||
@@ -212,8 +212,8 @@ Use the standalone version of the abapGit report to import the demo examples of
|
||||
- ... **on-premise system**: Access the documentation in the SAP GUI via the transactions `ABAPDOCU` (opens the documentation directly) and `ABAPHELP` (opens an input field with which you can search the documentation content, for example, you can search for a keyword such as `SELECT`). Or, of course, choose `F1` on a keyword in your code. If you are in the SAP GUI (e.g. in `SE80`), the system-internal version opens. If you are in ADT, the documentation opens in the *ABAP Language Help* view.
|
||||
- ... **SAP BTP ABAP environment**: In ADT, the documentation is in the *ABAP Language Help* view, where you can also search. If you choose `F1` on a keyword in your code, the documentation opens there.
|
||||
- Links to the online version of the ABAP Keyword Documentation for:
|
||||
- **Standard ABAP**: Unrestricted ABAP language scope, e.g. for developments in an on-premise ABAP system → [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 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)
|
||||
- **Standard ABAP**: Unrestricted ABAP language scope for developments in an on-premise ABAP system → [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)
|
||||
- Regarding demonstration examples of the ABAP Keyword Documentation in your on-premise system: Have you ever checked out the package `SABAPDEMOS`? This package contains all the examples used in the ABAP Keyword Documentation. To get the context, program names, etc., see the [example page](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_examples.htm) (also available in the system-internal SAP GUI version as a node in the topic tree), which summarizes the executable examples. Of course, you can also find the example topics in the context of the individual ABAP Keyword Documentation topic. The example topics are marked with a ⚙️ icon:
|
||||
|
||||

|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* 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.
|
||||
*
|
||||
* In newer ABAP releases, you can use side effects to trigger data
|
||||
* You can also use side effects to trigger data
|
||||
* changes (in terms of this example, the recalculation of the calculation
|
||||
* result) and other things based on data changes in UI scenarios with
|
||||
* draft-enabled BOs.
|
||||
|
||||
@@ -241,7 +241,7 @@ CLASS zcl_demo_abap_cloud_excursion IMPLEMENTATION.
|
||||
**********************************************************************
|
||||
|
||||
out->write( heading( `Excursions into the XCO Library` ) ).
|
||||
"The following code snippets focuse on the XCO library that provides
|
||||
"The following code snippets focus on the XCO library that provides
|
||||
"predefined functionality and can be used in ABAP for Cloud Development.
|
||||
"The examples cover a selection of options for you to explore. For more
|
||||
"detailed information and more code snippets, see the SAP Help Portal
|
||||
@@ -326,14 +326,14 @@ CLASS zcl_demo_abap_cloud_excursion IMPLEMENTATION.
|
||||
DATA(filter1) = xco_cp_abap_repository=>object_name->get_filter(
|
||||
xco_cp_abap_sql=>constraint->contains_pattern( 'ZDEMO_ABAP_RAP_R%' ) ).
|
||||
|
||||
"Getting all accessible BDEFs that start with ZDEMO_ABAP_RAP_R in a particular package
|
||||
"Getting all accessible BDEFs that start with ZDEMO_ABAP_RAP_R in the entire system
|
||||
"As shown above, loop over the handler to get more detailed information. You can also set
|
||||
"a break point to check out the content of the variable in the debugger.
|
||||
IF package_exists = abap_true.
|
||||
DATA(bdefs_in_package) = xco_cp_abap_repository=>objects->bdef->where( VALUE #( ( filter1 )
|
||||
) )->in( xco_cp_abap=>repository )->get( ).
|
||||
|
||||
out->write( |\nThere are { lines( bdefs_in_package ) } accessible BDEFs with the specified name pattern in the specified package.| ).
|
||||
out->write( |\nThere are { lines( bdefs_in_package ) } accessible BDEFs with the specified name pattern in the entire system.| ).
|
||||
ENDIF.
|
||||
|
||||
"Getting all accessible interfaces with a particular name pattern in the entire system
|
||||
@@ -422,7 +422,7 @@ CLASS zcl_demo_abap_cloud_excursion IMPLEMENTATION.
|
||||
DATA(b10_rel_state) = b1_handler->get_api_state( )->get_release_state( )->value.
|
||||
|
||||
CLEAR str.
|
||||
"Getting information about the Visibilities of the repository object
|
||||
"Getting information about the visibility of the repository object
|
||||
LOOP AT b9_vis INTO DATA(vis_b).
|
||||
CASE abap_true.
|
||||
WHEN vis_b->use_in_key_user_apps( ).
|
||||
@@ -510,7 +510,7 @@ CLASS zcl_demo_abap_cloud_excursion IMPLEMENTATION.
|
||||
DATA(d8_type_outp_len) = d1_handler->content( )->get_underlying_built_in_type( )->abap_type->get_type_descriptor( )->output_length.
|
||||
|
||||
CLEAR str.
|
||||
"Processing Visibilities information
|
||||
"Processing visibility information
|
||||
LOOP AT d4_vis INTO DATA(vis_d).
|
||||
CASE abap_true.
|
||||
WHEN vis_d->use_in_key_user_apps( ).
|
||||
@@ -553,7 +553,7 @@ CLASS zcl_demo_abap_cloud_excursion IMPLEMENTATION.
|
||||
DATA(e9_type_abs_name) = e1_handler->content( )->get_row_type( )->get_built_in_type( )->abap_type->get_type_descriptor( )->absolute_name.
|
||||
|
||||
CLEAR str.
|
||||
"Processing Visibilities information
|
||||
"Processing visibility information
|
||||
LOOP AT e4_vis INTO DATA(vis_e).
|
||||
CASE abap_true.
|
||||
WHEN vis_e->use_in_key_user_apps( ).
|
||||
@@ -894,7 +894,7 @@ CLASS zcl_demo_abap_cloud_excursion IMPLEMENTATION.
|
||||
|
||||
**********************************************************************
|
||||
|
||||
out->write( heading( `11) Getting sy-Related Information Using XCO` ) ).
|
||||
out->write( heading( `11) Getting Date and Time Information Using XCO` ) ).
|
||||
"Among others, the examples cover time and date-related information.
|
||||
|
||||
"Creating a time stamp
|
||||
@@ -936,7 +936,7 @@ CLASS zcl_demo_abap_cloud_excursion IMPLEMENTATION.
|
||||
"Calculations
|
||||
DATA(m18_add_date) = xco_cp=>sy->date( )->add( iv_day = 1 iv_month = 1 iv_year = 1 )->as( xco_cp_time=>format->iso_8601_extended )->value.
|
||||
DATA(m19_subtract_date) = xco_cp=>sy->date( )->subtract( iv_day = 1 iv_month = 1 iv_year = 1 )->as( xco_cp_time=>format->iso_8601_extended )->value.
|
||||
"Getting technical name of user, see also the API cl_abap_context_info
|
||||
"You can also get more pieces of information using "sy" such as the technical name of your user (see also the class cl_abap_context_info)
|
||||
DATA(m20_user_name) = xco_cp=>sy->user( )->name.
|
||||
|
||||
out->write( data = m1_user_time_zone name = `m1_user_time_zone` ).
|
||||
@@ -969,16 +969,16 @@ CLASS zcl_demo_abap_cloud_excursion IMPLEMENTATION.
|
||||
"To carry out the object generation, make sure that you meet the following
|
||||
"prerequisites:
|
||||
"1) You have a modifiable transport request (suitable for demo content). In
|
||||
" ADT, got to the Transport Organizer tab, check that you have a transport
|
||||
" ADT, go to the Transport Organizer tab, check that you have a transport
|
||||
" request available under "Modifiable". Otherwise, create a new transport
|
||||
" request.
|
||||
" Copy the ID of the transport request and insert it in the constant "tr_req_id"
|
||||
" that is available in the private Visibilities section of the class.
|
||||
" that is available in the private visibility section of the class.
|
||||
"
|
||||
"2) You have specified a package for demo content, for example, the
|
||||
" package of the ABAP cheat sheets, which is "ZABAP_CHEAT_SHEETS" in the example.
|
||||
" Make sure that you have assigned the constant "package4gen" a value
|
||||
" with a valid package iin which you want to create the demo repository
|
||||
" with a valid package in which you want to create the demo repository
|
||||
" objects.
|
||||
"
|
||||
"3) You have provided suitable names for the demo objects. Check and, if need be,
|
||||
@@ -996,7 +996,7 @@ CLASS zcl_demo_abap_cloud_excursion IMPLEMENTATION.
|
||||
DATA(n1_handler) = xco_cp_cts=>transport->for( tr_req_id ).
|
||||
DATA(n2_exists) = n1_handler->exists( ).
|
||||
DATA(n3_status) = n1_handler->get_status( ).
|
||||
CATCH CX_root INTO DATA(e).
|
||||
CATCH cx_root INTO DATA(e).
|
||||
ENDTRY.
|
||||
|
||||
"Checking if repository objects with the names specified already exist in the system
|
||||
@@ -1014,7 +1014,7 @@ CLASS zcl_demo_abap_cloud_excursion IMPLEMENTATION.
|
||||
WHEN OTHERS.
|
||||
ENDCASE.
|
||||
|
||||
"Checking if pacakge exists
|
||||
"Checking if package exists
|
||||
DATA(n9_exists_devc) = xco_cp_abap_repository=>package->for( package4gen )->exists( ).
|
||||
|
||||
IF n2_exists IS NOT INITIAL
|
||||
|
||||
@@ -130,7 +130,7 @@ define view entity zdemo_abap_cds_ve_sel
|
||||
else 'Z'
|
||||
end as case1,
|
||||
|
||||
// In newer ABAP releases, you can use the ELSE NULL addition that returns the null value.
|
||||
// You can use the ELSE NULL addition that returns the null value.
|
||||
// Note: If ELSE is not specified, the null value is returned as a result.
|
||||
// case $projection.case1
|
||||
// when 'X' then 'A'
|
||||
|
||||
Reference in New Issue
Block a user