Get Example source ABAP code based on a different SAP table
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>. ITOC
Definition There are two types of logical schema:
Logical database schema> A logical database schema> enables the mapping of 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 properties:
A name used to map a physical database schema to the object, so making the object usable.
An optional flag that allows the mapping of the ABAP database schema>. 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 a logical database schema differ for logical database schemas and logical HDI schemas.
Mapping to a Logical Database Schema A physical database schema is mapped to an existing logical database schema in the mapping table AMDP_SCHEMA_MAP>> using the documented transaction DB_SCHEMA_MAP>>. A mapping of this type is currently only possible on an AS ABAP whose standard database> is an SAP HANA database. The physical database schema is case-sensitive. A mapping made using the transaction DB_SCHEMA_MAP> should usually be a local mapping but can also be transported with some restrictions. Transports like this are usually only made from systems with an SAP HANA database and should only be performed in systems in which the specified physical database schemas definitely exist. Transports should only be made between systems of the same company. Any mappings made by SAP are not delivered to customers. The client-independent 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 in order for the mapping to take place.
Latest 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 processed and are ignored.
Only the predefined name :abap_db_schema> should be used to map the current ABAP database schema>. If the associated flag is set, the real name could also be specified, but this name cannot be transported properly and the logical database schema would not be usable in AMDP. ABAP_HINT_END
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 modified.
Latest notes:
Mappings of physical HDI containers> to logical HDI schemas are usually predefined in a system.
The database schema of a AMHC> is never the ABAP database schema>. ABAP_HINT_END
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.
Latest 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 method. Conversely, this addition can only be used for logical database schemas to which 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, this leads to syntax errors in AMDP classes> that already use this schema.
Logical HDI containers> are used in the macro $ABAP.schema> > for simple access to HDI objects> in SAP HANA XSA>.
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>>. ABAP_HINT_END