A basic knowledge of open SQL is necessary to develop ABAP application in SAP HANA.
ABAP programs can access SAP HANA database through available set of queries and operations that can be executed on existing data.
This article will introduce you to classic ABAP programming and how it complements with Native HANA.
Simple Database access via ABAP Open SQL Statement:
DATA: wa TYPE scarr.
SELECT-OPTIONS: carrier FOR wa-carrid.
SELECT * FROM scarr INTO wa WHERE carrid IN carrier.
WRITE: / wa-carrid. wa-carrname.
This program will display Airline id and its name based on the user selection of Airline id. For example-
The SAP Netweaver AS ABAP stores all data in exactly one specific schema within the database catalog. This schema is also referred to as system schema or ABAP schema.
In traditional ABAP development, schema is irrelevant.
For SAP HANA, schema is relevant because:
- When tables are replicated to SAP HANA, the tables are stored in different schema to separate them from the system data
- There are many technical schemas in SAP HANA that play an important role in native development in SAP HANA.
ABAP Schema and technical database user
The name of the ABAP schema is usually composed of the system id (SID) and the prefix “SAP”. The default schema name of the ABAP system “IRC” would be SAPIRC, for example. ABAP tables like the MARA table can thus be addressed in the database catalog using SAPIRC.MARA. This schema also comprises a database user SAPIRC, which is used by the SAP NetWeaver AS ABAP to establish the standard database connection.
SAP LUW Concept
In ABAP, the business transactions e.g. Creating a new sales order are handled using LUW concept. These business transactions include changes to the records in multiple database tables to ensure both table and business data consistency. These are bundled and then saved by a COMMIT WORK statement or discarded via ROLLBACK WORK statement.
There is currently no such equivalent concept in SAP HANA.
Transaction Concept in Database
Database operations are short lived as compared to business transactions as they focus on only table consistency.
This is done via SQLScript in SAP HANA.
Physical locks are used by every database to synchronize parallel changes to table data. In addition, there is a ‘logical lock’ concept in SAP ABAP for business logic.
For example, while booking a flight, another user cannot book the same flight and seat.
However, the tables are not physically locked while booking a flight.
These logical lock concepts should also be considered while modifying ABAP tables using SQLScript in SAP HANA.
Data types in ABAP and HANA
|Data type in ABAP Data Dictionary||Data type in ABAP System||Data type in HANA System||Example|
Pool and Cluster Tables
In ABAP, there were restrictions of the maximum number of tables and also due to poor compression capabilities. To avoid these problems, several logical tables were combined into one physical database table (pool or cluster) that can be accessed as normal table.
These special types of tables in the ABAP Dictionary are converted to normal tables before migrating to SAP HANA as pool and cluster tables are not needed in SAP HANA.
Object types in ABAP Data Dictionary
Foreign key relationships defined in the table are used when modeling views in SAP HANA
Views play an important role in the context of SAP HANA.
- Data types
These are user defined types which can be elementary or table types.These data types cannot be used directly for modeling and programming tasks in SAP HANA.
Domain cannot be directly used for modeling or programming tasks in SAP HANA
- Search help
Specific search helps can be implemented in SAP HANA
- Lock Object
- Technical settings of a Table
- ABAP table buffer – this is helpful for reading data from tables, these are utilized in SAP HANA too
- Data Class and Size Category
- Usage of column store or row store-
As of SAP Netweaver 7.4, the ABAP data dictionary allows you to create a column or a row store table to be stored in HANA database. If default option ‘Undefined’ is set, the table is created as column store.
The Open SQL statements in ABAP are database independent. Database read statements like SELECT, FOR ALL ENTRIES are accelerated in SAP HANA.
These examples will be discussed in more detail in the next post.