This commit is contained in:
danrega
2025-01-10 16:46:58 +01:00
parent 4f3be4ac3e
commit 6926ca4f3b
7 changed files with 1025 additions and 98 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,7 @@
- [Dynamic Specifications in Statements for Processing Internal Tables](#dynamic-specifications-in-statements-for-processing-internal-tables)
- [Dynamic ABAP SQL Statements](#dynamic-abap-sql-statements)
- [Dynamic Method Calls](#dynamic-method-calls)
- [Dynamic Function Module Calls](#dynamic-function-module-calls)
- [Dynamic ABAP EML Statements](#dynamic-abap-eml-statements)
- [Dynamic Formatting Option Specifications in String Templates](#dynamic-formatting-option-specifications-in-string-templates)
- [Dynamic Parameter List in EXPORT and IMPORT Statements](#dynamic-parameter-list-in-export-and-import-statements)
@@ -2621,6 +2622,31 @@ ENDCLASS.
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Dynamic Function Module Calls
The following code snippet shows a dynamic function module call. Similar to dynamic method calls, a parameter table is used. It has the type `abap_func_parmbind_tab`. The function module name is specified as the value of a character-like data object.
See the section [Function Module Example](13_Program_Flow_Logic.md#function-module-example) in the [Program Flow Logic](13_Program_Flow_Logic.md) cheat sheet that includes the creation of a demo function module and static and dynamic function module calls.
```abap
DATA(func_name) = 'Z_DEMO_ABAP_TEST_FUNC_M'.
DATA(ptab) = VALUE abap_func_parmbind_tab( ( name = 'NUM1'
kind = abap_func_exporting
value = NEW i( 3 ) )
( name = 'OPERATOR'
kind = abap_func_exporting
value = NEW string( `+` ) )
( name = 'NUM2'
kind = abap_func_exporting
value = NEW i( 5 ) )
( name = 'RESULT'
kind = abap_func_importing
value = NEW string( ) ) ).
CALL FUNCTION func_name PARAMETER-TABLE ptab.
```
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Dynamic ABAP EML Statements
In the context of [RAP](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_rap_glosry.htm), [ABAP EML](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenabap_eml_glosry.htm) statements are available with dynamic forms.

View File

@@ -125,12 +125,12 @@ The following code snippet shows a global class implementing the interface `if_o
- The literals can be (but should not according to the [programming guidelines on literals (F1 docu for standard ABAP)](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenliterals_guidl.htm)) used like constants of these types in [operand positions](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenoperand_position_glosry.htm). They should be only used for start values when declaring [named data objects](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abennamed_data_object_glosry.htm).
```abap
CLASS zcl_some_test_class DEFINITION PUBLIC FINAL CREATE PUBLIC.
CLASS zcl_demo_abap_class DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
ENDCLASS.
CLASS zcl_some_test_class IMPLEMENTATION.
CLASS zcl_demo_abap_class IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
out->write( `I am a text string literal` ). "text string literal of type string
out->write( 'I am a text field literal' ). "text field literal of type c

View File

@@ -23,7 +23,7 @@
- [Special Function Modules in Standard ABAP](#special-function-modules-in-standard-abap)
- [Subroutines in Standard ABAP](#subroutines-in-standard-abap)
- [Excursion: RETURN](#excursion-return)
- [Interrupting the Program Execution](#interrupting-the-program-execution)
- [Interrupting the Program Execution with WAIT UP TO Statements](#interrupting-the-program-execution-with-wait-up-to-statements)
- [Exceptions and Runtime Errors](#exceptions-and-runtime-errors)
- [Executable Example](#executable-example)
@@ -558,7 +558,7 @@ Further keywords for defining loops are as follows. They are not dealt with here
### Methods of Classes
In modern ABAP programs, only methods should be implemented (instead of [function modules](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenfunction_module_glosry.htm) and [subroutines](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensubroutine_glosry.htm) in most cases).
In modern ABAP programs, classes and methods are the way to go for modularization purposes (instead of [function modules](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenfunction_module_glosry.htm) and [subroutines](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abensubroutine_glosry.htm) in most cases; the latter is only available in Standard ABAP).
Note that methods and calling methods are described in the context of the [ABAP Object Orientation cheat sheet](04_ABAP_Object_Orientation.md). Find more information and examples there.
<p align="right"><a href="#top">⬆️ back to top</a></p>
@@ -898,7 +898,7 @@ ENDCLASS.
<p align="right"><a href="#top">⬆️ back to top</a></p>
## Interrupting the Program Execution
## Interrupting the Program Execution with WAIT UP TO Statements
Using [`WAIT UP TO`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapwait_up_to.htm) statements, you can interrupt the program execution by a specified number of seconds.

View File

@@ -1387,19 +1387,19 @@ DATA(low_timestamp) = utclong_current( ).
"utclong_add: Using the built-in function to create a UTC time stamp and
"adding time values
DATA(high_timestamp) = utclong_add( val = low_timestamp
days = 1
hours = 2
minutes = 3
seconds = 4 ).
days = 1
hours = 2
minutes = 3
seconds = 4 ).
"diff: Calculating time differences
"In the example, the returned values correspond to the ones added above.
cl_abap_utclong=>diff( EXPORTING high = high_timestamp
low = low_timestamp
IMPORTING days = DATA(days)
hours = DATA(hours)
minutes = DATA(minutes)
seconds = DATA(seconds) ).
IMPORTING days = DATA(days)
hours = DATA(hours)
minutes = DATA(minutes)
seconds = DATA(seconds) ).
"read: Reading a time stamp from a string
DATA(ts) = |{ utclong_current( ) TIMESTAMP = ENVIRONMENT TIMEZONE = 'UTC' }|.
@@ -1811,13 +1811,13 @@ DATA: BEGIN OF s1,
a TYPE i,
b TYPE c LENGTH 3,
c TYPE c LENGTH 5,
END OF s1.
END OF s1.
DATA: BEGIN OF s2,
a TYPE i,
b TYPE c LENGTH 3,
d TYPE string,
END OF s2.
END OF s2.
"Populating structures
s1 = VALUE #( a = 1 b = 'aaa' c = 'bbbbb' ).
@@ -2704,7 +2704,7 @@ DATA(sub_acc_id) = ten->get_subaccount_id( )->as_string( ).
<tr>
<td> <code>CX_*</code> </td>
<td>
Exception classes are special classes, usually starting with the name <code>CX_*</code>, that serve as the basis for <a href="https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencatchable_exception_glosry.htm">catchable exceptions</a>. When an exception is raised, an object of such an exception class is created. There are several predefined exception classes. Find more information in the cheat sheet about program flow logic.
Exception classes are special classes, usually starting with the name <code>CX_*</code>, that serve as the basis for <a href="https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencatchable_exception_glosry.htm">catchable exceptions</a>. When an exception is raised, an object of such an exception class is created. There are several predefined exception classes. Find more information in the [Exceptions and Runtime Errors](27_Exceptions.md) cheat sheet.
<br><br>
``` abap

View File

@@ -22,7 +22,7 @@
- [Excursions](#excursions)
- [Built-in Database Functions](#built-in-database-functions)
- [Finding Released Repository Objects in the System](#finding-released-repository-objects-in-the-system)
- [Creating Repository Objects Programmatically with XCO](#creating-repository-objects-programmatically-with-xco)
- [Retrieving Repository Objects Information and Creating Repository Object Programmatically with XCO](#retrieving-repository-objects-information-and-creating-repository-object-programmatically-with-xco)
- [More Information](#more-information)
- [Executable Example](#executable-example)
@@ -735,9 +735,9 @@ SELECT ReleasedObjectType, ReleasedObjectName, ReleaseState
<p align="right"><a href="#top">⬆️ back to top</a></p>
### Creating Repository Objects Programmatically with XCO
### Retrieving Repository Objects Information and Creating Repository Object Programmatically with XCO
Using the [XCO library](https://help.sap.com/docs/btp/sap-business-technology-platform/generation-apis), you can create ABAP repository objects programmatically. The executable example ([zcl_demo_abap_cloud_excursion](src/zcl_demo_abap_cloud_excursion.clas.abap)) of the [ABAP for Cloud Development](19_ABAP_for_Cloud_Development.md) cheat sheet includes demo code snippets. For more information, refer to the [documentation](https://help.sap.com/docs/btp/sap-business-technology-platform/generation-apis).
Using the [XCO library](https://help.sap.com/docs/btp/sap-business-technology-platform/generation-apis), you can create retrieve ABAP repository objects information and create the objects programmatically. The executable example ([zcl_demo_abap_cloud_excursion](src/zcl_demo_abap_cloud_excursion.clas.abap)) of the [ABAP for Cloud Development](19_ABAP_for_Cloud_Development.md) cheat sheet includes demo code snippets. The [Released ABAP Classes](22_Released_ABAP_Classes.md) cheat sheet also includes a small selection of code snippets in that context. For more information, refer to the [documentation](https://help.sap.com/docs/btp/sap-business-technology-platform/generation-apis).
<p align="right"><a href="#top">⬆️ back to top</a></p>

View File

@@ -1,4 +1,4 @@
"! <p class="shorttext"><strong>AMDP</strong><br/>Excursions into ABAP for Cloud Development</p>
"! <p class="shorttext">Excursions into ABAP for Cloud Development</p>
"!
"! <p>The example class demonstrates released APIs and libraries with the restricted
"! ABAP language version.<br/>
@@ -431,7 +431,7 @@ CLASS zcl_demo_abap_cloud_excursion IMPLEMENTATION.
DATA(a4_del_cl) = a2_content-delivery_class->value.
DATA(a5_data_maint) = a2_content-data_maintenance->if_xco_printable~get_text( )->get_lines( )->join( )->value.
"Getting all fields of the database table
"The handler is further processed. In the example, only the field names are retreived.
"The handler is further processed. In the example, only the field names are retrieved.
DATA(a6_fields) = db->fields->all->get( ).
CLEAR str.