SAP DB ACCESS



Get Example source ABAP code based on a different SAP table
  


VERSION 5 IN

ABAP Database Access
All the data relevant for all applications of an AS ABAP, including metadata and technical data, is stored and managed centrally in its standard database. AS ABAP supports database systems from different vendors. The database objects for storing and accessing data, such as database tables, views, or stored procedures, are created as platform-dependent objects by the ABAP-specific frameworks ABAP Dictionary , ABAP CDS, and AMDP in the ABAP database schema .
In the ABAP Dictionary, DDIC database tables and DDIC views, and in ABAP CDS non-abstract CDS entities are defined as ABAP-specific objects. Instances of these objects are created in the ABAP database schema when they are activated. Such database tables, views, and entities can also be used as globally visible structured types in ABAP programs.
The AMDP framework makes it possible to create ABAP-based definitions of AMDP procedures and AMDP functions in the ABAP database schema. In ABAP, they can be called as follows:
Using method calls
Using AB_SQL for accessing a CDS table function.
With CDS scalar functions.
BEGIN_SECTION VERSION 5 OUT
All database objects defined and managed in AS ABAP are known as:
ABAP-managed database objects.
END_SECTION VERSION 5 OUT
To enable access to database objects, every database system uses the largely standardized language SQL, which can be implemented in different ways to suit specific platforms. The following options are available in ABAP for accessing ABAP-managed database objects: ABAP-managed database objects:
AB_SQL For mostly platform-independent access to database tables,
BEGIN_SECTION VERSION 5 OUT DDIC views,
END_SECTION VERSION 5 OUT and non-abstract CDS entities, the AB_SQL statements embedded in ABAP are used, which themselves are transformed to platform-dependent SQL using the AB-SQL interface in AS ABAP. This method also covers ABAP-specific evaluations, such as implicit client handling or CDS access control.
AMDP Framework used to manage and call database procedures and database functions in ABAP.
BEGIN_SECTION VERSION 5 OUT
Native SQL To use platform-dependent SQL in ABAP, Native SQL can be passed to the database as follows using the Native-SQL interface:
Using the object-oriented framework ADBC
Using embedded Native SQL statements after the ABAP statement EXEC SQL.
END_SECTION VERSION 5 OUT
BEGIN_SECTION VERSION 5 OUT
ABAP and SAP HANA Additional specific methods are available when accessing SAP HANA databases from ABAP.
END_SECTION VERSION 5 OUT
BEGIN_SECTION VERSION 5 OUT
Object Services The Object Services framework makes object-oriented access to the database possible by placing a wrapper around the actual database reads.
END_SECTION VERSION 5 OUT
The following topics also deal with important aspects of database access:
Data consistency LUW concepts must be employed to ensure data consistency when handling persistent data in databases.
BEGIN_SECTION VERSION 5 OUT
Database connections Database connections can also be used to provide access to other databases or database schemas.
END_SECTION VERSION 5 OUT
BEGIN_SECTION VERSION 5 OUT
System class for database features The class CL_ABAP_DBFEATURES can be used to determine features of database.
END_SECTION VERSION 5 OUT

ABAP_PGL
Use ABAP SQL for general database accesses where possible.
ABAP_PGL_END



Latest notes:

If a SAP HANA database is used as the standard AS ABAP database, it is handled in ABAP programs like any relational database.
ABAP-managed database objects should not be accessed using any methods other than those described here.
ABAP SQL Services provide SQL-level access to published, ABAP-managed CDS view entities for consumers outside the system.
NON_V5_HINTS
In addition to the statements described here for database reads, the following are also available:
Access to data clusters in database tables
Obsolete access statements
The framework for logical databases is an obsolete wrapper framework for database access.
ABAP_HINT_END