ABAP Programming Best Practices: Maintainability
Contents
Introduction
Maintainability Rules
1. Introduction
This document is a continuation of 'ABAP Programming Best Practices' which is intended to cover the basic Maintainability rules of good ABAP programming for ABAP developers and ABAP learners. In a normal SAP environment we use ABAP to write a code for doing a look-up in transformation or to code function modules to extract data from source systems. This process would generally involve declarations, selection of data, read the selected data to manipulate it or to perform calculations. I have taken into consideration only these basic steps for this document.
2. Maintainability Rules
Rule 1:The Programs which are copied from the Standard program must have the reference to the cloned program.
Rule 2: The Programs or the Routines that are called from the specific locations including User Exits, The documentation must be maintained which indicates the calling program or routine.
Rule 3: It is always recommended to use Data Dictonary Names for field texts on screen where ever applicable.
Rule 4: Always try to put Repetitive code into some Modularisation unit which must take into account the re-usablity and which should be kept short as possible.
Rule 5: Always try to keep the Main Program short as possible. And try to work with re-usable, structured and small Methods.
Rule 6: It is always recommended not to access the global variables in any object, instead always try to pass actual parameters via the object interface or signature.
Rule 7(Important): It is always recommended to pass internal tables via USING or CHANGING addition of the FORM or PERFORM statements instead of TABLES addition.
Rule 9:It is always good not to use TABLES section while defining new function module instead it is recommended to use DDIC table types as Importing, Exporting and Changing Parameters except for transmitting large amount of data.
Rule 10(Important): It is always recommended to encapsulate gloabl data in TOP-Include. The name of this include should be same as program name with suffix as '_TOP'.
Note: I will keep updating this document based on further corrections/suggestions.