SAP AMDP DB SCHEMA ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_AMDP - Access to Database Schemas
Demonstrates access to tables in explicitly specified database schemas.

ABAP_SOURCE_CODE
DEMO CL_DEMO_AMDP_DB_SCHEMA_ACCESS

ABAP_DESCRIPTION
This example accesses AMDP methods that are declared and implemented in the AMDP class CL_DEMO_AMDP_DB_SCHEMA.
The method GET_SCHEMAS_PHYSICAL accesses the table SCHEMAS of the physical database schema SYS by specifying the schema directly. All existing database schema are stored in this table.
METH CL_DEMO_AMDP_DB_SCHEMA=>GET_SCHEMAS_PHYSICAL
The method GET_SCHEMAS_LOGICAL accesses the physical database schema that is mapped to the logical database schema DEMO_LOGICAL_DB_SCHEMA in transaction DB_SCHEMA_MAP by specifying the AMDP macro $ABAP.schema. If this is SYS, the same table is accessed.
METH CL_DEMO_AMDP_DB_SCHEMA=>GET_SCHEMAS_LOGICAL
Another method GET_SCHEMAS_LOGICAL_TO_ABAP demonstrates how the addition USING SCHEMA of the statement METHOD is specified. The logical database schema DEMO_LOGICAL_DB_SCHEMA_TO_ABAP is defined in such a way that it allows access to the ABAP database schema . Since it is used in the method in the macro $ABAP.schema, it must be declared after USING SCHEMA.
METH CL_DEMO_AMDP_DB_SCHEMA=>GET_SCHEMAS_LOGICAL_TO_ABAP
If the current ABAP database schema is mapped to the logical database schema using the predefined name :abap_db_schema, the full string '$ABAP.schema( DEMO_LOGICAL_DB_SCHEMA_TO_ABAP )'. is omitted when the macro is evaluated and the ABAP database schema is accessed implicitly. The specification of scarr is checked statically against the ABAP Dictionary.
If another physical database schema is mapped to the logical database schema, there must be a suitable database object SCARR in this database schema when the method is executed.