Skip to main content

Development Guidelines ABAP on HANA

ABAP on SAP HANA: Building business application optimized for In-memory.
To leverage the strengths of SAP HANA from a development perspective, applications follow the “code to data” or so called “code-push-down” paradigm in which data intense computations and calculations logic is pushed down from the application server to the database server.

Example for a simple report: 

In general all code that uses OPEN SQL will benefit already automatically. Therefore it’s also strongly recommended to apply high coding standards/ development guidelines, like the “5 Golden SQL rules” provided by SAP or new OPEN SQL features. However it could be that more performance improvement is required by the business. HANA specific optimization techniques like AMDP (ABAP Managed Database Procedure) or CDS (Core Data Services) views might be required to implement.

5 Golden SQL rules

The next “5 Golden SQL rules” are applicable for development on any DB. However some rules will have more impact on HANA than others.
1. Keep the result sets small
You should aim to keep the result set small. This reduces both the amount of memory used in the database system and the network load when transferring data to the application server. To reduce the size of your result sets, use the WHERE and HAVING clauses.


2. Minimize the amount of transferred data
Data is transferred between the database system and the application server in blocks. To minimize the network load, you should transfer as few blocks as possible. Open SQL allows you to do this as follows:

  • Restrict the Number of Lines

  1. If you only want to read a certain number of lines in a SELECT statement, use the UP TO          <n> ROWS addition in the FROM clause.
  2. If you expect the WHERE clause to return a large number of duplicates entries, you can use      the DISTINCT addition in the SELECT clause.

  • Restrict the Number of Columns

  1. Do not use * to select all columns unless you really need them. You should only read the columns from a database table that you actually need in the program.

  • Use Aggregate Functions

  1. If you only want to use data for calculations, it is often more efficient to use the aggregate functions of the SELECT clause than to read the individual entries from the database and perform the calculations in the ABAP program.

  • Data Transfer when Changing Table Lines

  1. When you use the UPDATE statement to change lines in the table, you should use the WHERE clause to specify the relevant lines and then SET statements to change only the required columns.

3. Minimize the number of data transfers

In every Open SQL statement, data is transferred between the application server and the database system. Furthermore, the database system has to construct or reopen the appropriate administration data for each database access. You can therefore minimize the load on the network and the database system by minimizing the number of times you access the database.

  • Multiple Operations Instead of Single Operations


  1. When you change data using INSERT, UPDATE, and DELETE, use internal tables instead of single entries.

  • Avoid Repeated Access

  1. Avoid accessing the same data more than once (for example, SELECT before an UPDATE).

  • Avoid Nested SELECT Loops

  1. A simple SELECT loop is a single database access whose result is passed to the ABAP program line by line. Nested SELECT loops mean that the number of accesses in the inner loop is multiplied by the number of accesses in the outer loop. You should therefore only use nested SELECT loops if the selection in the outer loop contains very few lines.





4. Minimize the search overhead
To minimize the size of the result set use the WHERE and HAVING clauses. To increase the efficiency of these clauses, formulate them to fit with the database table indexes.
In case of highly selective queries on non-primary key fields, a secondary index could be beneficial. Some key points to keep in mind:
  • Create the index on a large table if access is still slow.
  • Create inverted indexes on the most selective columns.
  • Create composite indexes on the most selective column combinations
  • Indexes have maintenance costs, especially composite indexes. Avoid this as much as possible.

5. Keep load away from the database
Unlike application servers and presentation servers, there is normally only one database server per SAP instance and applications should be written to reduce the database load as much as possible.
Buffers:
  • Cross-user buffers: Shared objects, shared buffer, shared memory table buffer.
  • User-specific buffers: SAP memory, ABAP memory, program-specific buffering in internal tables.

Comments

Popular posts from this blog

Importance of Education In Society Essay

Zeal study shares you the composition for second term 2 new syllabus Importance of Education In Society First of all, Education helps in spreading knowledge in society. This is perhaps the most noteworthy aspect of Education. There is a quick propagation of knowledge in an educated society. Furthermore, there is a transfer of knowledge from generation to another by Education. Education helps in the development and innovation of technology. Most noteworthy, the more the education, the more technology will spread. Important developments in war equipment, medicine, computers, take place due to Education. Education gives us a knowledge of the world around us and changes it into something better. It develops in us a perspective of looking at life. It helps us build opinions and have points of view on things in life. People debate over the subject of whether education is the only thing that gives knowledge. Some say education is the process of gaining information about the surrounding world ...

The importance of forests

Man has been cutting down forests indiscriminately and today the trend is not only to save natural forests but to create artificial ones. Deserts are made to bloom! The Imperial Valley of the Sonoran desert in southern California has been converted into a green patch which yields crops all the year round. Forests are not to be considered merely as a direct source of wealth; they are to be considered in relation to the national economy and geography. Forests serve many purposes. They hold together the soil and prevent or minimize soil erosion. The oxygen in the air is replenished by forests and plankton in the sea. Trees and plants, during photosynthesis, absorb carbon dioxide and release oxygen. Scientists fear that if forests are destroyed indiscriminately, there will be an increase in carbon dioxide and eventually the sun's rays will become hotter, the polar caps will melt and the ocean level rise and submerge much of our land. Vegetable mould that forests supply increases the fe...