Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
danrega committed Feb 7, 2025
1 parent c730345 commit afe9e85
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 98 deletions.
22 changes: 13 additions & 9 deletions 04_ABAP_Object_Orientation.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@
- [Class-Based and Classic Exceptions](#class-based-and-classic-exceptions)
- [ABAP Unit Tests](#abap-unit-tests)
- [ABAP Doc Comments](#abap-doc-comments)
- [Escaping Characters](#escaping-characters)
- [Escape Character](#escape-character)
- [More Information](#more-information)
- [Executable Examples](#executable-examples)


This ABAP cheat sheet provides an overview on selected syntax options and concepts related to ABAP object orientation.

> **💡 Note**<br>
> - This ABAP cheat sheet provides an overview on selected syntax options and concepts related to ABAP object orientation. It is supported by code snippets and an executable example. They are **not** suitable as role models for object-oriented design. Their primary focus is on the syntax and functionality. For more details, refer to the respective topics in the ABAP Keyword Documentation. Find an overview in the topic [ABAP Objects - Overview](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_objects_oview.htm).
> - The cheat sheet is supported by code snippets and an executable example. They are **not** suitable as role models for object-oriented design. Their primary focus is on the syntax and functionality.
> - For more details, refer to the respective topics in the ABAP Keyword Documentation. Find an overview in the topic [ABAP Objects - Overview](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_objects_oview.htm).
> - The [executable examples](#executable-examples) reflect several points and code snippets covered in the cheat sheet.

Expand Down Expand Up @@ -2802,7 +2806,7 @@ Components specified in superclasses

<br>

The inheritance tree of the following example classes looks as follows:
The inheritance tree of the following example classes is as follows:

```
LCL1
Expand Down Expand Up @@ -3240,7 +3244,7 @@ Additions impacting inheritance

<td>

- You can use the `FINAL` addition to prevent classes from being inherited. These classes cannot inherit from other classes.
- You can use the `FINAL` addition to prevent classes from being inherited.
- You can also apply the `FINAL` addition to methods to prevent them from being redefined in subclasses.
- Refer to the next section for notes on these topics and other inheritance and instantiation features.

Expand Down Expand Up @@ -3278,7 +3282,7 @@ Constructors

<br>

The inheritance tree of the following example classes looks as follows:
The inheritance tree of the following example classes is as follows:

```
LCL1
Expand Down Expand Up @@ -3381,7 +3385,7 @@ ENDCLASS.

<br>

The inheritance tree of the following example classes looks as follows:
The inheritance tree of the following example classes is as follows:

```
LCL1
Expand Down Expand Up @@ -3585,7 +3589,7 @@ The table below includes selected syntax related to inheritance in class and met
> **💡 Note**<br>
> - Some of the syntax options have already been mentioned previously. This is to summarize.
> - The code examples shows local classes and interfaces declared, for example, in the [CCIMP include](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenccimp_glosry.htm) of a class pool.
> - The code examples show local classes and interfaces declared, for example, in the [CCIMP include](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenccimp_glosry.htm) of a class pool.
> - The snippets provided do not represent all possible syntax combinations. For the complete picture, refer to the ABAP Keyword Documentation. Additional syntax options are available in the context of friendship (`GLOBAL FRIENDS/FRIENDS`), testing (`FOR TESTING`), [RAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenarap_glosry.htm) (`FOR BEHAVIOR OF`; to declare [ABAP behavior pools](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenbehavior_pool_glosry.htm)), and more.
> - The order of the additions can vary.
Expand Down Expand Up @@ -3615,7 +3619,7 @@ CLASS zcl_demo DEFINITION

- `... PUBLIC ...`: Specifies that the class is a global class, available globally within the class library. Most of the subsequent snippets use the `PUBLIC` addition as the focus is on global classes.
- `... FINAL ...`: Specifies that the class cannot have any subclasses, effectively prohibiting inheritance. This addition seals off a branch of the inheritance tree. In final classes, all methods are automatically final.
- `... CREATE PUBLIC ...`: Specifies that the class can be instantiated wherever it is visible.
- `... CREATE PUBLIC ...`: Specifies that the class can be instantiated wherever it is visible. Not specifying the addition `CREATE ...` means `CREATE PUBLIC` by default.

<br>

Expand Down Expand Up @@ -10348,7 +10352,7 @@ ENDCLASS.

<p align="right"><a href="#top">⬆️ back to top</a></p>

### Escaping Characters
### Escape Character

- You may encounter [`!` characters](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/ABENNAMES_ESCAPING.html) specified before operands, particularly in signatures of [procedures](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenprocedure_glosry.htm).
- They are used to distinguish the operand's name from ABAP words.
Expand Down
4 changes: 2 additions & 2 deletions 08_EML_ABAP_for_RAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ MODIFY ENTITY root_ent

- The example demonstrates the long form of an ABAP EML `MODIFY` statement.
- The example statement uses the [`FROM`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmodify_entity_entities_fields.htm) addition instead of `FIELDS ( ... ) WITH`. See more details in the documentation and below.
-


``` abap
MODIFY ENTITIES OF root_ent "full name of root entity
Expand Down Expand Up @@ -1714,7 +1714,7 @@ MODIFY ENTITIES OF root_ent
current status of instances in the transactional buffer which
includes unsaved modifications on instances. If an instance is not
yet available in the transactional buffer, the currently persisted
data set is automatically read into the transactional buffer.
data set is (automatically - in case of a managed scenario) read into the transactional buffer.
- Note that read operations are always implicitly enabled for each
entity listed in a BDEF, i. e. there is no extra definition in the
BDEF in contrast to, for example, create or update.
Expand Down
12 changes: 5 additions & 7 deletions 12_AMDP.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,11 @@ ENDMETHOD.

Note:

- In the [restricted ABAP language
version](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrestricted_version_glosry.htm "Glossary Entry")
scope, only reads are allowed. Hence, the addition `OPTIONS READ-ONLY` is mandatory. Furthermore, you must make sure
- In [ABAP for Cloud Development](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_for_sap_cloud_glosry.htm) (i.e. the [restricted ABAP language version](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenrestricted_version_glosry.htm "Glossary Entry")
scope), only reads are allowed. Hence, the addition `OPTIONS READ-ONLY` is mandatory. Furthermore, you must make sure
that the database objects that are specified after `USING` are accessible.
- Generally, in the [unrestricted ABAP language
version](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenunrestricted_version_glosry.htm "Glossary Entry")
scope ([ABAP for Cloud Development](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_for_sap_cloud_glosry.htm)), more syntax options are allowed for AMDP method declaration
- Generally, in [Standard ABAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenstandard_abap_glosry.htm) (i.e. the [unrestricted ABAP language
version](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenunrestricted_version_glosry.htm "Glossary Entry") scope), more syntax options are allowed for AMDP method declaration
and implementation parts. Check the ABAP Keyword Documentation for
more details as covered further down.

Expand Down Expand Up @@ -400,7 +398,7 @@ You can then use the CDS table function as source for a
- Native SQL is passed directly to the database.
- AMDP, which uses Native SQL, also does not support implicit client handling.
- While AMDP is permitted in ABAP Cloud, accessing client-dependent data via Native SQL is not supported.
- When using AMDP in ABAP Cloud, it is crucial to access only the current client. Client-safety must be ensured..
- When using AMDP in ABAP Cloud, it is crucial to access only the current client. Client-safety must be ensured.
- AMDP methods in ABAP Cloud must be client-safe, meaning the SQLScript code should access data only in your client. Use only artifacts that limit access to a single client or those that are client-independent.
- Consequently, all objects in the `USING` list must be client-safe, including CDS table functions implemented as AMDP methods.
- There are additions to cover client-safe aspects, ensuring access only to your client data.
Expand Down
3 changes: 2 additions & 1 deletion 17_SAP_LUW.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ The statements to end an SAP LUW have already been mentioned above: [`COMMIT WOR
`ROLLBACK WORK`
- Similar to `COMMIT WORK` statements, this statement closes the current SAP LUW and opens a new one.
- Among other things, this statement ...
- causes all changes within a SAP LUW to be undone, that is, all previous registrations for the current SAP LUW are removed.
- causes all changes within an SAP LUW to be undone, that is, all previous registrations for the current SAP LUW are removed.
- triggers a database rollback on all currently open database connections, which also terminates the current database LUW.
> **💡 Note**<br>
Expand Down Expand Up @@ -372,6 +372,7 @@ After the import of the repository, proceed as follows:
- Run the program by choosing `F8`.

> **💡 Note**<br>
> - The examples in the *main* branch of the ABAP cheat sheet repository are designed to be imported into the SAP BTP ABAP Environment. For Standard ABAP, you can find examples (such as `zdemo_abap_sap_luw`) in the other branches of the repository.
> - The executable example ...
> - demonstrates the SAP LUW using classic dynpros to provide a self-contained and simple example that highlights the considerations regarding implicit database commits, without putting the spotlight on dynpros. Note that classic dynpros are outdated for application programs. New developments should use web-based UIs, such as SAP Fiori UIs.
> - covers the following topics in simple contexts:
Expand Down
1 change: 1 addition & 0 deletions 20_Selection_Screens_Lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,7 @@ After the import of the repository, proceed as follows:
- Run the program by choosing `F8`.

> **💡 Note**<br>
> - The examples in the *main* branch of the ABAP cheat sheet repository are designed to be imported into the SAP BTP ABAP Environment. For Standard ABAP, you can find examples (such as `ZDEMO_ABAP_SELSCR_LISTS_INTRO`) in the other branches of the repository.
> - The executable examples ...
> - do not claim to include meaningful selection screens and lists.
> - are not intended to be role models for proper selection screen and list design.
Expand Down
4 changes: 2 additions & 2 deletions 23_Date_and_Time.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ The main data types for date, time, and time stamps in ABAP are as follows:
**Built-in ABAP types**
| Type | Length | Meaning | Value Range | Initial value | Notes |
|---|---|---|---|---|---|
| `d` | 8 characters | For storing a calendar date (i.e. an exact day, week, or month of the Gregorian calendar) in a date field. A valid value has the format `yyyymmdd`. | Any eight Unicode characters that can be encoded in UCS-2 are valid values. These values must be digits that conform to the calendar rules in the format `yyyymmdd`. yyyy (year): 0001 to 9999; mm (month): 01 to 12; dd (day): 01 to 31 | 00000000 | It is a character-like type and mostly used for input and output of dates. Regarding assignments of data objects with numeric data types and calculations: The content of the time field is converted to the number of seconds since 00:00:00. |
| `t` | 6 characters | For storing a time in a time field. A valid value has the format `hhmmss`. | Any six Unicode characters that can be encoded in UCS-2 are valid values. These values must represent times in accordance with the 24-hour clock format, specifically `hhmmss`. hh (hours): 00 to 23; mm (minutes): 00 to 59; ss (seconds): 00 to 59. | 000000 | It is a character-like type and mostly used for input and output of times. Regarding assignments of data objects with numeric data types and calculations: Valid values are converted to the number of days since 01.01.0001. |
| `d` | 8 characters | For storing a calendar date (i.e. an exact day, week, or month of the Gregorian calendar) in a date field. A valid value has the format `yyyymmdd`. | Any eight Unicode characters that can be encoded in UCS-2 are valid values. These values must be digits that conform to the calendar rules in the format `yyyymmdd`. yyyy (year): 0001 to 9999; mm (month): 01 to 12; dd (day): 01 to 31 | 00000000 | It is a character-like type and mostly used for input and output of dates. Regarding assignments of data objects with numeric data types and calculations: Valid values are converted to the number of days since 01.01.0001. |
| `t` | 6 characters | For storing a time in a time field. A valid value has the format `hhmmss`. | Any six Unicode characters that can be encoded in UCS-2 are valid values. These values must represent times in accordance with the 24-hour clock format, specifically `hhmmss`. hh (hours): 00 to 23; mm (minutes): 00 to 59; ss (seconds): 00 to 59. | 000000 | It is a character-like type and mostly used for input and output of times. Regarding assignments of data objects with numeric data types and calculations: The content of the time field is converted to the number of seconds since 00:00:00. |
| `utclong` | 8 byte | For storing a time stamp (i.e. a combined date/time specification). A time stamp field represents a unique time in UTC reference time (UTC: Coordinated Universal Time, which is the basis for representing worldwide time data). | Internal 8-byte integer representation of a UTC time stamp exact to 100 nanoseconds, in ISO-8601 notation between 0001-01-01T00:00:00.0000000 and 9999-12-31T23:59:59.9999999 | 0 | Find more details, e.g. on the special initial value, [here](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenutclong.htm). |


Expand Down
Loading

0 comments on commit afe9e85

Please sign in to comment.