Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
Showing results for 
Search instead for 
Did you mean: 
Evolution gives birth to new practices. Over a period of time with the evolution of SAP from 4.7 to ECC and then to S/4 HANA, several features have been changed so far. With the arrival of new frameworks, screens, and guidelines, several modern practices are developed and they are adopted in many modules, customization, and also in programming. And my focus in this blog is ‘ABAP Programming’ developments. My personal experience of ABAP development depicts that in general, there are three phases: Programming, Quality Check and Testing. And every phase requires a certain investment of proven practices in order to develop quality robust software.

I have tried to list down ten practices, worth adopting to transform ABAP developments into optimized, informative, modern, and quality robust. The practices explained below act as a check-list worth not ignoring while programming.

1. Declaration of Internal table: Be specific about the type of internal table declaration. The default is not always to declare the internal table as the standard type. In fact one must invest some time to decide which category the internal table is falling:

  • Sorted internal table with Unique Key

  • Sorted internal table with non-unique key components X Y

  • Sorted internal table with non-unique sorted key components A B C

  • Hashed Table with Unique Key


Internal Table

Two reasons why this practice is important. The first is, the processing of data from the performance point of view and the second is reading the data in a faster way.

2. Usage of Dynamic SQL: The second thing one should invest in building dynamic SQL query for the where clause.  It helps to compress your development from being lengthy to just a few lines. You don't require to write SQL queries multiple times. Instead, build a dynamic SQL query once and use it several times. Suggest to use this whenever required.

However making source table as dynamic is not encouraged. Hence Select (fieldname) from (source tab) where XYZ is not allowed.


Dynamic SQL

3. Progress Indicator: Check if you have used the Progress Indicator while processing the data in a loop. It gives useful information about the number of records processed, displays on the screen while running. It is one of the practice to make the development informative.

Progress Indicator and Packet Processing of data

4. Processing of data in packets: As highlighted above within a box is another practice to allow the loop to process the business logic only after a certain number of records. By doing so, the data packets are formed that become fast performing. It is a good practice for performance optimization.

For example, by applying a statement like ‘IF lv_tabix MOD 1500 =0’ inside a loop, the control will follow for further processing only after a packet of 1500 records is formed. Record by record processing takes longer compared to processing data in packets.

5. Using RTTS: The practice of using Runtime Type Services can save a lot of effort from developing the customized coding. By adopting this practice, the type definition of data objects at run time and making the data type generic can be made possible. RTTS is a dynamic approach for programming which is an optimization technique for handling several data objects having different data types efficiently at run time.

SAP has provided several standard classes and a few important ones are given as below:

  • CL_ABAP_TYPEDESCR: Useful for creating type attributes at runtime

  • CL_ABAP_DATADESCR: Useful for handling data types at run time

  • CL_ABAP_STRUCTDESCR: Useful for creating and describing structure at run time

  • CL_ABAP_TABLEDESCR: Useful for creating and describing table at run time

Sample Example for declaring and using:


6. Authority Check Object: Another habit is of using the authority check object. Not relying solely on the role assignment, the authority check object can secure your development from the execution by the user departments. Sample Example:

7. Using Data reference operator: Sometimes it becomes important to create the dynamic table and structure which has type defined only at run time. In that case, the practice of using the data reference can save a lot of your effort. With the help of the de-referencing concept and the field symbols, one can easily deal with dynamic data types. One such sample example is given below:

8. Dynamic Creation of Class Objects through Factory Classes: When you need to deal with several custom classes in a report or any ABAP development, it is better to adopt the practice of using the factory class. All the custom classes when maintained in some kind of framework as part of the customization, the developer should create one factory class to instantiate the objects dynamically at run time based on the requirement. The practice below shows the example of creating the instance of a class dynamically at run time.

9. Using New Syntax: Evolution from 4.7 to ECC has introduced the new syntax for development. With the introduction of new syntax, the readability and the ability to modular the programming has been enhanced. Especially for Object-Oriented programming new syntax has been a great help. As a modern developer one should adopt the practice of using the new syntax for ABAP development.

Here are a few references:

10. ABAP Test Cockpit(ATC):

This is a practice for quality check. After the development is finished, how robust it is can be determined by ATC. It provides to check the quality of ABAP development with respect to standard guidelines of performance, authorization and usage of variables declared as global and local.

From the option: Program->Check->ATC, you can execute the Cockpit

The remarks for improvement the quality are shown as below which should be worked upon.

Conclusion and Summary

As I mentioned in the beginning that every evolution gives birth to new practices. So ABAP programming is no different and in the time when ECC is moving to S/4 HANA; it is time to adopt new practices for the development of quality robust software. There are several articles and blogs available in SDN for a few of the topics in detail as I explained above. Hence it is worth investing some time to go through each topic and understand them in depth. Good practice makes things easy and brings quality and the same goes for the ABAP development.

Let me know if this was useful for you.
Labels in this area