How to Optimize Database Access and Increase System Performance Through More Efficient ABAP Programming ?
In an R/3 system, data is stored in a relational database. A relational database consists of tables that are two-dimensional data structures defined by rows (data records) and columns (fields). The smallest possible combination of fields that can uniquely identify each table row is called a key. Each table must have at least one key, and each table has one key that is defined as its primary key. In a relational model, the relationship between various tables is expressed in terms of foreign keys. A combination of fields in a table is termed a foreign key if it is the primary key of another table.
Application programs can address this database by means of a standardized language known as SQL (Structured Query Language), which contains statements for reading, modifying, creating, and administering database tables. SQL is embedded in the ABAP language via two kinds of statements:
Open SQL (a database-independent subset of standard SQL)
Native SQL (the language of the database system being used)
Open SQL statements are fully integrated into ABAP and allow you to access data regardless of the database system that the R/3 installation is using. Open SQL consists of the Data Manipulation Language (DML) portion of standard SQL; in other words, it allows you to read and change data. Figure 1 lists all Open SQL keywords and their respective functions.
Open SQL, along with other ABAP statements, can be used to simplify and speed up database access, as you will see later in this article. It supports buffering of certain tables and statements on the application server, thus preventing excessive database access. Buffers are partly stored in the working memory of the current work process, and partly in the shared memory for all work processes on an R/3 application server. In situations where an R/3 system is distributed across more than one application server, the data in the various buffers is synchronized at set intervals by the buffer management.
Open SQL statements do not access the database directly. They are checked at compile time and converted to the proper SQL statements for the specific database system.
Native SQL statements, in contrast to Open SQL statements, are only loosely integrated into ABAP, but allow access to all of the functions contained in the programming interface of the underlying database system. So, if you want to use specific features of a certain database that are beyond what Open SQL can do, you’ll need to use Native SQL. Obviously, programs that use Native SQL become inextricably linked to the database system for which they are written, so when writing R/3 applications, Native SQL should be used as a last resort.
Download attached file:
You must be Loged in to download file