320 KiB
Released ABAP Classes
- Released ABAP Classes
- Excursions
- Displaying Output in the ADT Console
- Creating and Transforming UUIDs
- XCO Representations of SY Components
- RAP
- Transactional Consistency
- Numbers and Calculations
- String Processing
- Handling Codepages and Binary Data
- Regular Expressions
- Time and Date
- Calendar-Related Information
- Runtime Type Services (RTTS)
- Assignments
- Information about Non-Initial Structure Components
- Comparing Content of Compatible Internal Tables
- Dynamic Programming
- Getting the Current User Name
- XML/JSON
- ABAP Repository Object Information
- Generating ABAP Repository Objects
- Call Stack
- Sending Emails
- Tenant Information
- Exception Classes
- Parallel Processing
- Application Log
- Running Code in the Background
- Locking
- Calling Services
- Reading and Writing XLSX Content
- Zip Files
- ABAP Unit
- Units of Measurement
- Programmatic ABAP Test Cockpit (ATC) Check
- Handling Number Ranges
- Releasing APIs
- Application Jobs
- Generative AI
- Programmatically Creating and Releasing Transport Requests
- Repairing and Cleaning up HTML and XML Documents
This ABAP cheat sheet contains a selection of released ABAP classes that are available in ABAP for Cloud Development. It serves as a quick introduction, along with code snippets to explore the functionality in action.
Note
- The cheat sheet is not a comprehensive overview, and the code snippets do not claim to be comprehensive as far as options, methods, or parameters are concerned. It is intended to give you a rough overview, for you to get an idea. It is an invitation to a more in-depth exploration.
- For more information and where available, refer to the class documentation (for example, choose F2 when the cursor is on the class name in ADT), the ABAP Keyword Documentation, and the SAP Help Portal documentation.
- You might find that different classes can achieve similar or the same results, especially with the Extension Components Library (XCO), a general-purpose development library designed specifically for ABAP for Cloud Development. Choose the classes that best meet your needs.
- For XCO classes, the cheat sheet covers released XCO APIs. In Standard ABAP, XCO APIs are also available that do not have
CPin the class name. These classes are not covered here.- Disclaimer
Excursions
Available Classes in ABAP for Cloud Development
If available to you, you have accessed an SAP BTP ABAP Environment using the ABAP development tools for Eclipse (ADT). Access to SAP-provided repository objects is restricted to objects that have been released for ABAP for Cloud Development (released APIs). You can find the released repository objects in the Project Explorer view in ADT under Released Objects. The classes are located in the Source Code Library folder:
You can also programmatically get the released objects. You can use specific XCO classes or a CDS view, as shown in the example code snippet below.
SELECT ReleasedObjectType, ReleasedObjectName, ReleaseState
FROM i_apisforclouddevelopment
WHERE releasestate = 'RELEASED'
AND ReleasedObjectType = 'CLAS'
ORDER BY ReleasedObjectName
INTO TABLE @DATA(released_classes).
Cloud Development Successors
The I_APIsWithCloudDevSuccessor view provides information on objects that cannot or should no longer be used in ABAP for Cloud Development along with their successors that can be used.
SELECT * FROM I_APIsWithCloudDevSuccessor
INTO TABLE @DATA(successors_all).
SELECT * FROM I_APIsWithCloudDevSuccessor
WHERE PredecessorObjectType = 'TABL'
INTO TABLE @DATA(successors_tables).
SELECT SINGLE * FROM I_APIsWithCloudDevSuccessor
WHERE PredecessorObjectName = 'TADIR'
INTO @DATA(successor_tadir).
Displaying Output in the ADT Console
The table includes the IF_OO_ADT_CLASSRUN interface.
| Interface/Class | Details/Code Snippet |
IF_OO_ADT_CLASSRUN |
|
CL_DEMO_CLASSRUN |
As an alternative to using the IF_OO_ADT_CLASSRUN interface for displaying output in the console, you can also use the CL_DEMO_CLASSRUN class, which offers more methods.
For more information, refer to this blog.
The following example makes use of the CL_DEMO_CLASSRUN class. A structure and an internal table are displayed in the console. A structure component is a reference variable, which is automatically dereferenced. Plus, the write_xml method is shown, which displays XML data.
|
CL_XCO_CP_ADT_SIMPLE_CLASSRUN |
XCO alternative for output in the ADT console |
Excursion: Exploring Demo Display Class Using IDE Actions
- IDE actions let you create simple features to extend ABAP development tools for Eclipse (ADT).
- With IDE actions, you can build custom functionalities using ABAP, especially for AI-related use cases (see the ABAP classes available in the ABAP AI SDK powered by Intelligent Scenario Lifecycle Management below).
- A feature of IDE actions is the ability to display HTML output in the result dialog.
- The following examples use IDE actions to demonstrate the capabilities of the demo class
CL_DEMO_OUTPUT_CLOUD. - These examples, intended for exploration and experimentation, use the class's HTML capabilities for display. When you execute the example IDE actions, they present data objects in HTML within the IDE action result dialog. You may recognize this HTML presentation from the
CL_DEMO_OUTPUTclass that is available in Standard ABAP and used for demo display purposes, especially useful for displaying internal table content. - The (non-AI-related) experiments include these IDE actions for demo display purposes:
| IDE Action | Notes |
|---|---|
|
Class runner and data object displayer |
|
|
Method runner and parameter displayer |
|
|
XLSX file importer and content displayer |
|
💡 Note
- Find more information on IDE actions and examples:
- Your user must be assigned to the
SAP_A4C_BC_DEV_AIA_PCbusiness catalog.
⚠️ Disclaimer
- The examples are simplified and not meant to represent best practices for IDE action implementation. They are only intended for exploration purposes to get a high-level idea.
- All examples use
CL_DEMO_OUTPUT_CLOUDto retrieve HTML output of data objects. Note that this class is intended for demo purposes only.- NOTE: The use of IDE actions is your responsibility. Development and use are up to you. Refer to this repository's disclaimer and the disclaimer in the IDE action documentation.
- Be particularly mindful of the potential security risks when importing external content, which the simplified example code below does not address. The example code also uses dynamic programming techniques. They can pose a security risk. Refer to the Dynamic Programming cheat sheet and the ABAP Keyword Documentation.
Demo IDE Actions Using CL_DEMO_OUTPUT_CLOUD
The setup is similar across all examples:
- Creation of repository objects for demo IDE actions.
- Each demo IDE action involves two global classes:
- Implementing class
- Input UI configuration class
- A demo class to demonstrate the IDE action (except for the XLSX file importer and content displayer example; the examples use a demo class named
ZCL_DEMO_ABAP) - Some IDE action classes contain code within the CCIMP include.
- One example requires creating a demo interface.
Expand the following collapsible sections for descriptions and example code:
🟢 Class runner and data object displayer
Demo Purpose
This demo IDE action runs classes and displays the content of data objects in an IF_OO_ADT_CLASSRUN-like style. Instead of plain text in the ADT console, it presents the results as HTML in an IDE action result dialog in ADT.
Steps
- Access your demo package in ADT in your SAP BTP ABAP Environment.
- Create a new repository object e.g. by right-clicking the package and choosing New -> Other ABAP Repository Object -> Filter for IDE Action.
- Action creation:
- Name: ZDEMO_ABAP_IDE_ACTION_OUTPUT
- Description: IDE Action for HTML Output
- Make the following entries on the IDE action screen:
- Title: Demo IDE Action: HTML Output
- Summary: Action to display the content of data objects as HTML in an IDE action result dialog
- Implementing Class:
ZCL_DEMO_ABAP_ACTION_OUTPUT - Input UI Configuration Class:
ZCL_DEMO_ABAP_ACTION_OUTPUT_UI - Number of Focused Resources: Any
- Filter Object Types:
CLAS(choose Add and filter forCLAS)
- Create the classes
- Click the Implementing Class link. A pop-up is displayed to start the class creation. Provide a description and walk through the wizard. Once the class has been created, activate the class having no implementation at this stage.
- Go back and repeat the steps for the Input UI Configuration Class.
- Once the classes have been created, activate the IDE action. The screen will show warnings regarding interfaces not implemented in the classes.
- For demo purposes, you can copy and paste the code from below.
- Perform a mass activation to activate the classes because one class uses types specified in the other class.
- To check out the action, proceed as follows:
- Create an interface named
ZIF_DEMO_ABAP_OUTPUTand use the code from below.ZIF_DEMO_ABAP_OUTPUTis essential to be implemented for checking out the IDE action. - Create a class named
ZCL_DEMO_ABAPand use the code from below (contains a collection of various data objects that should be displayed). - In ADT, you have opened the demo class
ZCL_DEMO_ABAP(or any class implementing the interface). - Choose STR + ALT/CMD + R to run an IDE action.
- Select the IDE action. You can filter for HTML Output.
- Choose Run.
- An IDE action dialog is displayed prompting you to provide a class. Insert the testing class
ZCL_DEMO_ABAP(or browse, or you have run the action in a class filling the input field automatically). - Choose Run.
- The IDE action result dialog is displayed showing the HTML output of the data objects that were written using
out->write( ... ).and other methods that theCL_DEMO_OUTPUT_CLOUDclass offers.. - The example class is designed to demonstrate various data objects, ranging from elementary types to more complex types such as structures and internal tables, including nested structures, deep internal tables, and data references.
- Create an interface named
| Class (include)/Interface | Code |
|---|---|
|
|
|
|
|
|
|
|
|
|
Interface to check out the IDE action |
|
|
Class to check out the IDE action |
|
🟢 Method runner and parameter displayer
Demo Purpose
- This demo IDE action lets you select usable and instantiable classes, select one of their public instance or static methods, and provide the input parameters (if any) with character-like actual parameters.
- For example, a calculator method may require three inputs: two numbers and an operator. The example focuses on basic cases and does not perform input validation at runtime.
- When you run the IDE action, the method is executed.
- As a result, the parameter table (refer to the Dynamic Programming cheat sheet) is displayed as HTML in the IDE action result dialog using
CL_DEMO_OUTPUT_CLOUD, including any of the input and output parameters and their values (if any).
Steps
- Access your demo package in ADT in your SAP BTP ABAP Environment.
- Create a new repository object by, e.g. right-clicking the package and choosing New -> Other ABAP Repository Object -> Filter for IDE Action.
- Action creation:
- Name: ZDEMO_ABAP_IDE_ACTION_M_RUN
- Description: IDE Action for Method Running and Parameter Displaying
- Make the following entries on the IDE Action screen:
- Title: Demo IDE Action: Method Run
- Summary: Action to run public instance and static class methods and display the content of parameters as HTML in an IDE action pop-up
- Implementing Class:
ZCL_DEMO_ABAP_ACTION_METHODRUN - Input UI Configuration Class:
ZCL_DEMO_ABAP_ACTION_M_RUN_UI - Number of Focused Resources: Any
- Filter Object Types:
CLAS
- Create the classes (see the description on the steps in the first expandable section).
- Create a demo class named
ZCL_DEMO_ABAPto check out the IDE action. - For the classes, you can use the code below.
- To check out the demo IDE action, proceed as follows:
- In ADT, you have opened the demo class
ZCL_DEMO_ABAP(or any class implementing the interface). - Choose STR + ALT/CMD + R to run an IDE action.
- Select the IDE action. You can filter for Method Run.
- Choose Run.
- An IDE action dialog is displayed prompting you to provide a class.
- Once you have provided the class name, you can choose Browse for Public Method. Select the method you want to call.
- If the selected method has input parameters, they are displayed in the Method Input Parameters section.
- To provide actual parameters for the formal parameters, select the line and choose Edit. You can then provide input for Value.
- Choose Run.
- The IDE action result dialog is displayed showing the HTML output of the parameter table (if any), i.e. also possible output parameters and their content.
- In ADT, you have opened the demo class
| Class (include) | Code |
|---|---|
|
|
|
|
|
|
|
|
|
|
Class to check out the IDE action |
|
🟢 XLSX file importer and content displayer
Demo Purpose
- The demo IDE action lets you select an XLSX file from your local machine, retrieve its content, and display it in an internal table as HTML using
CL_DEMO_OUTPUT_CLOUDin the IDE action result dialog. - In the selection IDE action dialog, you can specify which worksheet contains the content to retrieve. You can also choose where to start retrieving the content (e.g., from column A, row 1) and indicate if there is a header line. If a header exists, the content of that cells in that line are used as field names for the internal table.
- When you run the IDE action, the XCO API is used to read the XLSX content. An internal table is created dynamically, and the worksheet content is added to it. Finally, this internal table is displayed as HTML in the IDE action result dialog.
Steps
- Access your demo package in ADT in your SAP BTP ABAP Environment.
- Create a new repository object by, e.g. right-clicking the package and choosing New -> Other ABAP Repository Object -> Filter for IDE Action.
- Action creation:
- Name: ZDEMO_ABAP_IDE_ACTION_IMPORT
- Description: IDE Action for XLSX file import
- Make the following entries on the IDE Action screen:
- Title: Demo IDE Action: File Importer
- Summary: Action to import XLSX files and display the content in an internal table in an IDE action pop-up
- Implementing Class:
ZCL_DEMO_ABAP_ACTION_IMPORT - Input UI Configuration Class:
ZCL_DEMO_ABAP_ACTION_IMPORT_UI - Number of Focused Resources: Any
- Filter Object Types:
CLAS(choose Add and filter forCLAS)
- Create the classes (see the description on the steps in the first expandable section).
- You do not need a demo class named
ZCL_DEMO_ABAPto check out the IDE action for this example. - For the classes, you can use the code below. The table below also contains demo content you can provide your demo worksheet with.
- To check out the demo IDE action, proceed as follows:
- In ADT, you have opened a class (no particular class).
- Choose STR + ALT/CMD + R to run an IDE action.
- Select the IDE action. You can filter for File import.
- Choose Run.
- An IDE action dialog is displayed prompting you to provide a path to an XLSX file on your local machine.
- The assumption is that a very simple worksheet is imported, for example, the content is available in the first worksheet and has a header line. The content starts at column A in row 1. If the content does not include a header line, you can select the checkbox. If the content starts elsewhere in the sheet (e.g. at column C, row 3), you can make the appropriate entry.
- The table below includes descriptions for demonstrations.
- Choose Run.
- If the XLSX content processing is successful, the IDE action result dialog will display the XLSX content in an internal table, presented as HTML table.
⚠️ Disclaimer
Since the example IDE action lets you import a local file, be mindful of the potential security risks when importing external content. Refer to this repository's disclaimer and to the disclaimer in the documentation about XCO.
| Subject/Class | Notes/Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Example XLSX content and demo execution steps |
First Example
Second Example
Third Example
|
Creating and Transforming UUIDs
| Class | Details/Code Snippet |
CL_SYSTEM_UUID |
Creating and converting system UUIDs with various algorithms
|
XCO_CP XCO_CP_UUID |
Creating UUIDs and transforming between different UUID formats using XCO
|
XCO Representations of SY Components
| Class | Details/Code Snippet |
XCO_CP |
|
RAP
| Class | Details/Code Snippet |
CL_ABAP_BEHV_AUX |
A utility class for retrieving information about RAP handler implementations, such as the current context of RAP handler/saver methods, the handler kind, and the current RAP transactional phase (e.g., RAP interaction phase.
|
CL_ABAP_BEHAVIOR_HANDLER |
Used for RAP handler classes that inherit from class CL_ABAP_BEHAVIOR_HANDLER.
|
CL_ABAP_BEHAVIOR_SAVER |
Used as base class from which a RAP saver class in an ABAP behavior pool (ABP) inherits. The RAP saver class must be defined in the CCIMP include of an ABP.
|
CL_ABAP_BEHAVIOR_SAVER_FAILED |
|
CL_ABAP_BEHAVIOR_EVENT_HANDLER |
It is used as base class from which a RAP event handler class in its CCIMP include inherits. Its purpose is to locally consume RAP business events.
More information: ABAP for RAP Business Events.
|
Transactional Consistency
| Class | Details/Code Snippet |
CL_ABAP_TX |
|
Numbers and Calculations
| Class | Details/Code Snippet |
CL_ABAP_MATH |
For operations with (decimal) floating point numbers and for providing constants for minimum and maximum values.
|
CL_ABAP_DECFLOAT |
For handling decimal floating point numbers.
|
CL_ABAP_BIGINT |
For calculations with integers of any size (e.g. to avoid the risk of an arithmetic overflow). Find more information in
this blog, and check out the different methods available.
|
CL_ABAP_RATIONAL |
For calculations with rational numbers without precision loss and rounding errors.
|
CL_ABAP_RANDOM* |
For generating arbitrary numbers for different numeric types:
CL_ABAP_RANDOM_INT (type i),
CL_ABAP_RANDOM_INT8 (int8),
CL_ABAP_RANDOM_FLOAT (f),
CL_ABAP_RANDOM_PACKED (p),
CL_ABAP_RANDOM_PACKED_DEC1 - CL_ABAP_RANDOM_PACKED_DEC14 (p with 1 to 14 decimal places),
CL_ABAP_RANDOM_DECFLOAT16 (decfloat16),
CL_ABAP_RANDOM_DECFLOAT34 (decfloat34)
The following example explores the generation of arbitrary numeric values.
|
String Processing
| Class | Details/Code Snippet |
CL_ABAP_CHAR_UTILITIES |
Provides utilities for string processing, such as attributes that represent new lines and horizontal tabs.
|
CL_ABAP_STRING_UTILITIES |
For processing text strings, such as handling trailing blanks in character strings (i.e. data objects of type string).
|
XCO_CP |
Offers various options to process strings using the XCO Library; see a selection in the code snippet
|
Handling Codepages and Binary Data
| Class | Details/Code Snippet |
CL_ABAP_GZIP* |
(De)compressing character strings and byte strings using GZIP:
CL_ABAP_GZIP,
CL_ABAP_GZIP_BINARY_STREAM,
CL_ABAP_GZIP_TEXT_STREAM,
CL_ABAP_UNGZIP_BINARY_STREAM,
CL_ABAP_UNGZIP_TEXT_STREAM
|
CL_ABAP_CONV_CODEPAGE |
For handling code pages, converting strings to the binary representation of different code pages and vice versa.
|
XCO_CP |
Converting strings to xstrings using a codepage using the XCO Library
|
XCO_CP |
Base64 decoding/encoding using XCO
|
CL_WEB_HTTP_UTILITY |
Endcoding strings/xstrings in Base64 and decoding Base64-encoded strings/xstrings
|
Regular Expressions
| Class | Details/Code Snippet |
CL_ABAP_REGEX CL_ABAP_MATCHER |
|
Time and Date
💡 Note
In ABAP for Cloud Development, do not use the date and time-related system fields such assy-datumandsy-uzeit, and others. User-related time and date values can be retrieved using the XCO library. For code snippets, see the Date, Time, and Time Stamp cheat sheet.
| Class | Details/Code Snippet |
CL_ABAP_CONTEXT_INFO |
Provides context information relevant to the current ABAP session.
|
CL_ABAP_DATFM |
For conversions between the external and the internal representation of a date specification
|
CL_ABAP_TIMEFM |
For conversions between the external and the internal representation of a time specification
|
CL_ABAP_UTCLONG |
For handling time stamps in time stamp fields (data objects with type utclong).
|
CL_ABAP_TSTMP |
For calculating and converting time stamps in packed numbers (types timestamp and timestampl)
|
XCO_CP_TIMEXCO_CP |
Class of the XCO time library that provides abstractions for getting and working with date and time information. Find more details here.
|
Calendar-Related Information
| Class | Details/Code Snippet |
CL_FHC_CALENDAR_RUNTIME |
The following example explores accessing calendar-related information (factory and holiday calendars). Find more information in the SAP Help Portal documentation. Note the released CDS views in that context. |
CL_SCAL_UTILS |
Calendar utilities for getting month names, year and week of a date, first day of a week, name and number of the weekday for a specified date
|
Runtime Type Services (RTTS)
| Class | Details/Code Snippet |
CL_ABAP_TYPEDESCR |
RTTS represent a hierarchy of type description classes containing methods for:
Apart from CL_ABAP_TYPEDESCR
|
|--CL_ABAP_DATADESCR
| |
| |--CL_ABAP_ELEMDESCR
| | |
| | |--CL_ABAP_ENUMDESCR
| |
| |--CL_ABAP_REFDESCR
| |--CL_ABAP_COMPLEXDESCR
| |
| |--CL_ABAP_STRUCTDESCR
| |--CL_ABAP_TABLEDESCR
|
|--CL_ABAP_OBJECTDESCR
|
|--CL_ABAP_CLASSDESCR
|--CL_ABAP_INTFDESCR
|
Assignments
| Class | Details/Code Snippet |
CL_ABAP_CORRESPONDING |
For assignments of components between structures or between internal tables with dynamically specified mapping rules. For more information, you can refer to the ABAP Keyword Documentation.
The example shows simple assignments with structures.
|
Information about Non-Initial Structure Components
| Class | Details/Code Snippet |
CL_ABAP_STRUCT_UTILITIES |
Provides methods to get information about filled components in structures allowing an efficient processing of non-initial components of a structure.
|
Comparing Content of Compatible Internal Tables
| Class | Details/Code Snippet |
CL_ABAP_DIFF |
Using the methods diff and diff_with_line_ref of the CL_ABAP_DIFF class, you can compare the content of two compatible index tables. The returning parameter is an internal table showing how the content of one internal table can be modified to match another one. diff_with_line_ref also returns a reference to the original table lines. Various importing parameters are available to adjust the comparison. Find more information in the class documentation and in the ABAP Keyword Documentation.
|
Dynamic Programming
| Class | Details/Code Snippet |
CL_ABAP_DYN_PRG |
For validating input for dynamic specifications.
|
Getting the Current User Name
| Class | Details/Code Snippet |
CL_ABAP_CONTEXT_INFO |
Provides context information relevant to the current ABAP session.
|
XCO_CP |
|
XML/JSON
| Class | Details |
CL_IXML_* CL_SXML_* |
|
XCO_CP_JSON |
Handling JSON data using the XCO library
|
/UI2/CL_JSON |
|
ABAP Repository Object Information
| Class | Details/Code Snippet |
XCO_CP_ABAPXCO_CP_ABAP_REPOSITORYXCO_CP_ABAP_DICTIONARY |
|
Generating ABAP Repository Objects
| Class | Details/Code Snippet |
XCO_CP_GENERATION |
For creating, updating and deleting ABAP repository objects. More information: Generation APIs The rudimentary snippet is taken from the executable example of the ABAP for Cloud Development cheat sheet. |
Call Stack
| Class | Details/Code Snippet |
XCO_CPXCO_CP_CALL_STACK |
Getting the current ABAP call stack programmatically. See more information here.
|
Sending Emails
| Class | Details/Code Snippet |
CL_BCS_MAIL_MESSAGE |
The following snippet includes some file attachments: |
Tenant Information
| Class | Details/Code Snippet |
XCO_CPXCO_CP_TENANT |
For obtaining various information about the currently active tenant.
|
Exception Classes
| Class | Details/Code Snippet |
CX_* |
Exception classes are special classes, usually starting with the name |
Parallel Processing
| Class | Details/Code Snippet |
CL_ABAP_PARALLEL |
For performing the parallel processing for instances of ABAP Objects. For more information, refer to the class documentation.
The following example class demonstrates parallel processing using the 🟢 Click to expand for more information and example codeNotes on the example:
|
Application Log
| Class | Details/Code Snippet |
CL_BALI_LOG |
For creating and reading application logs. Refer to this documentation for more information and code snippets. Note that there is also an XCO module available dealing with business application log (XCO_CP_BAL; see this documentation).
|
Running Code in the Background
| Class | Details/Code Snippet |
CL_BGMC_PROCESS_FACTORY |
Example 1: Using bgPF without transactional control 🟢 Click to expand for example code (Example 1)The following, self-contained, and oversimplified example is intended to give a rough idea about the functionality. It does not include transactional control. The example class can be run using F9 in ADT. It does the following: A demo database table of the cheat sheet repository is filled synchronously and asynchronously (using bgPF) with entries, just to show an effect and get an idea. Two entries are created in the background. WAIT statements are included to have a self-contained example, and that all created database entries can be shown in the output. In the example, the background processing may be visualized, for example, by the MODIFY statement that is followed by a WAIT statement in the loop. The output can show that the entry for the first asynchronously created entry was added before a synchronously created entry. For more visualization options regarding the execution in the background, you can, for example, check the ABAP Cross Trace. For more information, refer to the documentation.
Example 2: Using bgPF with transactional control 🟢 Click to expand for example code (Example 2)This example is similar to example 1. Unlike example 1, example 2 executes operations under transactional control. The transactional phase is explicitly switched using the |
Locking
| Class | Details/Code Snippet |
CL_ABAP_LOCK_OBJECT_FACTORY |
For activating lock objects. Note that you can also use the DEQUEUE_ALL method to remove all locks in the current SAP LUW.
The following example code snippet uses artifacts from the ABAP cheat sheet repository.
|
Calling Services
| Class | Details/Code Snippet |
CL_WEB_HTTP_CLIENT_MANAGERCL_HTTP_DESTINATION_PROVIDER |
To check out examples in demo classes, expand the collapsible sections below. 🟢 1. Read example: Retrieving ABAP cheat sheet markdown content using a GitHub API and sending a ZIP file with the content via email
🟢 2. Post example: Demonstrating a post request by converting Markdown to HTML using the GitHub API
|
Reading and Writing XLSX Content
| Class | Details/Code Snippet |
XCO_CP_XLSX |
The XCO library offers classes such as Expand the following collapsible sections for further information and example code. 🟢 Click to expand for more information and example codeThe following example demonstrates a selection of methods and includes the following steps:
Prerequisite Steps for the XLSX Content Import into the SAP BTP ABAP Environment The XLSX XCO module works with XLSX content in the form of an xstring. The following example assumes that you have XLSX content available as xstring. To try out the example, you can proceed as follows:
Exploring the XCO XLSX Module Assuming you have the XLSX content created and uploaded above on your system, you can explore the following example using the XCO classes/methods. Set up a demo class called
|
Zip Files
| Class | Details/Code Snippet |
CL_ABAP_ZIP |
The following example creates a zip file and adds three txt files with sample content. Note that the example snippet for |
ABAP Unit
| Class | Details/Code Snippet |
CL_ABAP_UNIT_ASSERT |
Provides methods to verify test expectations in ABAP Unit tests. For more information, see the ABAP Unit Tests cheat sheet. |
CL_ABAP_TESTDOUBLECL_OSQL_TEST_ENVIRONMENTCL_CDS_TEST_ENVIRONMENTCL_BOTD_TXBUFDBL_BO_TEST_ENVCL_BOTD_MOCKEMLAPI_BO_TEST_ENV |
|
Units of Measurement
| Class | Details/Code Snippet |
CL_UOM_DIM_MAINTENANCE |
|
CL_UOM_MAINTENANCE |
|
CL_UOM_CONVERSION |
|
Programmatic ABAP Test Cockpit (ATC) Check
| Class | Details/Code Snippet |
CL_SATC_API |
|
Handling Number Ranges
| Class | Details/Code Snippet |
CL_NUMBERRANGE_OBJECTSCL_NUMBERRANGE_INTERVALSCL_NUMBERRANGE_RUNTIME |
|
Releasing APIs
| Class | Details/Code Snippet |
CL_ABAP_API_STATE |
|
Application Jobs
| Class | Details/Code Snippet |
CL_APJ_DT_CREATE_CONTENTCL_APJ_RT_API |
🟢 Click to expand for more information and example codeNotes on the example:
The example does not cover several aspects (check the documentation for more information), including:
Before running the example class, check the values of the constants in the public section of the class. In particular, ensure you have valid values for these constants:
|
Generative AI
| Class | Details/Code Snippet |
CL_AIC_ISLM_COMPL_API_FACTORYCL_AIC_ISLM_PROMPT_TPL_FACTORY |
|
Programmatically Creating and Releasing Transport Requests
| Class | Details/Code Snippet |
XCO_CP_CTS |
The following code snippet uses the
🟢 Click to expand for example code |
Repairing and Cleaning up HTML and XML Documents
| Class | Details/Code Snippet |
CL_HTMLTIDY |
🟢 Click to expand for example codeThe following example explores some of the capabilities of the
To try the example out, create a demo class named |
