Extract Programming Conventions
Extract Programming Conventions
COM
Naming Conventions
All ABAP programs should follow the following naming convention:
Zwwxnnym
Where:
ww is the 2 character SAP module code (e.g. SD = Sales and Distribution, MM =
Materials Management).
x is the programs use, either: I (interface),
or R (report),
or T (take-on)
or F (SAPScript Form driver)
nn is a consecutive number.
y is the program type, either: B,
or I (include).
m is a consecutive number.
Programming Considerations
The following guidelines should be considered when writing ABAP code:
1. A program header comment should be at the top of every new Executable
program, with the following information:
1.
2.
3.
4.
5.
6.
Program Name.
Program Title.
Author.
Date Written.
Reference (Project name, Work Request or Help Request number).
Description.
Date
Author
Reference (Project name, Work Request or Help Request number)
Amendment Description
Amendment Scan Code (xx where xx is a consecutive number).
Amendments made to Include programs should be commented in the
header of the Executable program which uses the Include the only
exception is where an Include may be used in more than one
Executable program, in which case the Include should be
commented.
Efficiency Considerations
ABAP SQL SELECT statements can easily be made more efficient using the
following guidelines:
1. Keep the result set small.
Use the WHERE clause to ensure that as few records as possible are
retrieved from the Database Server.
2. Minimise data transferred between the Database and Application
Servers.
Never use the SELECT * FROM form instead select only the required
fields e.g. SELECT VBELN POSNR FROM VBAP INTO. This will also
remove the need for a TABLES statement at the top of the program. Up to
40% improvement.
If it is necessary to directly update a table, use the
UPDATESETWHERE statement, rather than selecting and updating.
This avoids any data retrieval, only sending an instruction to the Database
Server. It is however, limited to setting fields to a specific value or simple
increments/decrements. Up to 40% improvement.
Use aggregate functions (COUNT, SUM, MAX, MIN, AVG) where possible,
rather than manually computing these values. This retrieves only the result of
the function and not all the records needed to calculate that result. Up to 58%
improvement with MAX function.
Note that calculations on the Database Server may use NULL values,
potentially producing different results to ABAP, e.g. AVG(1, 3, 0, 0) = 1 but
AVG(1, 3, null, null) = 2.
3. Minimise the number of transfers between the Database and
Application Servers.
When selecting several records from a Dictionary table, use
SELECTFROMINTO TABLE to retrieve records into an internal table
in a single move. Up to 65% improvement