Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP and SAP HANA 

Logical Schemas for SAP HANA

A logical schema is a symbolic name for a database schema in the SAP HANA database that can be used in an AMDP macro.

Other versions: 7.31 | 7.40 | 7.54

Definition

There are two types of logical schema:

  • Logical database schema
A logical database schema makes it possible to map a physical database schema in a mapping table. A logical database schema is represented by a transportable repository object that developers must create in the ABAP Development Tools (ADT). The repository object has the following attributes:
  • A name used to map a physical database schema to the object, so making the object usable.
Developers with development authorization can create and modify a logical database schema as a repository object.
  • Logical HDI Container
A logical HDI container is part of the definition of an ABAP-managed HDI container (AMHC), namely a HDI container managed by ABAP. A logical HDI container does not have a repository object.

Mapping of Physical Database Schemas

Mappings of physical database schemas to logical database schemas can be distinguished from mappings of physical database schemas to logical HDI schemas.

Mapping to a Logical Database Schema

The mapping of physical database schema to an existing logical database schema is defined in the mapping table AMDP_SCHEMA_MAP in the documented transaction DB_SCHEMA_MAP. A mapping of this type is currently only possible on an AS ABAP whose standard database is a SAP HANA database. The physical database schema is case-sensitive.

A mapping made using the transaction DB_SCHEMA_MAP is usually a local mapping, but can be transported with some restrictions. Transports like this are usually only made from systems with an SAP HANA database and should only be made into systems in which the specified physical database schemas exist. Transports should only be made between systems in the same enterprise. Any mappings made by SAP are not delivered to customers. The cross-client mapping table AMDP_SCHEMA_MAP has the delivery class C.

An ABAP database schema is mapped using the predefined name :abap_db_schema:

  • This name is used as a placeholder for the real name of the ABAP database schema and can be evaluated accordingly by frameworks.
  • The associated flag must be set for the logical database schema before the mapping can take place.


Notes

  • System administrators with appropriate authorizations can map physical database schemas to logical database schemas.

  • The mappings exist in systems that do not have an SAP HANA database as a standard database, but cannot be edited and are ignored.

  • Only the predefined name :abap_db_schema should be used for the mapping of the current ABAP database schema. If the associated flag is set, it would be possible to speciiy the real name, but this name cannot be transported properly and the logical database schema would not be usable in AMDP.

Mapping to a Logical HDI Container

A physical database schema is mapped to a logical HDI container in transaction SCTS_AMHC (used to define ABAP-managed HDI containers (AMHCs)). An AMHC is a special HDI container that uses SAP HANA Transport for ABAP (HTA) as an interface to the Change and Transport System (CTS) (for its HDI objects too). The logical HDI container is a symbolic name for the physical AMHC database schema. There are no entries in the mapping table AMDP_SCHEMA_MAP for a logical HDI container. The logical HDI containers in AS ABAP can be displayed in transaction DB_SCHEMA_MAP, but mappings cannot be edited.


Notes

  • Mappings of physical HDI containers to logical HDI schemas are usually predefined in a system.

Use

A logical schema can be used by frameworks for variable access to a physical database schema in Native SQL. More specifically, the use of logical schemas is are supported by the ABAP Managed Database Procedures (AMDP):

  • A special AMDP macro ($ABAP.schema) can be used in AMDP methods to specify logical schemas. At runtime, the macro is replaced by the name of the mapped physical database schema.
  • If the current ABAP database schema is entered implicitly as a physical database schema of a logical database schema using the predefined name :abap_db_schema, the macro $ABAP.schema is skipped in the evaluation and hence the current ABAP database schema accessed implicitly.
  • If the current ABAP database schema is mapped to a logical schema using its real name, it is used for the macro $ABAP.schema in the evaluation of this macro. It is not possible to specify the current ABAP database schema explicitly in AMDP, which means that a syntax error occurs.


Notes

  • If a logical database schema to which the ABAP database schema is mapped is used in the macro $ABAP.schema, the schema must be declared using the addition USING SCHEMA of the statement METHOD in the current AMDP emthod. Conversely, this addition can only be used for logical database schemas to wohic the ABAP database schema can be mapped. For this reason, if the flag that allows mappings of the ABAP database schema is changed for an existing logical database schema, syntax errors are incurred in AMDP classes that already use this schema.

  • The transaction DB_SCHEMA_MAP also displays a logical schema with the predefined name SAP_ABAP to which the current ABAP database schema is always mapped. This schema is only for internal HDI use and cannot be used in the AMDP macro $ABAP.schemas.