0% found this document useful (0 votes)
159 views20 pages

ABAP Guidelines

This document provides guidelines for ABAP programming including documentation standards, naming conventions, code formatting, transport request descriptions, coding best practices, and other miscellaneous topics. It covers areas like program headers, comments, naming of objects, formatting code, modularization, and database access. The guidelines are intended to promote consistency and quality for custom ABAP development.

Uploaded by

preetham gowda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
159 views20 pages

ABAP Guidelines

This document provides guidelines for ABAP programming including documentation standards, naming conventions, code formatting, transport request descriptions, coding best practices, and other miscellaneous topics. It covers areas like program headers, comments, naming of objects, formatting code, modularization, and database access. The guidelines are intended to promote consistency and quality for custom ABAP development.

Uploaded by

preetham gowda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Small

ABAP Guidelines Document

Document Reference : NA
Version : 1.0
Document Status : Final

Author: KPMG

Last Revision Date: 10/03/2020


Date Created: 21/04/2015
Date Printed: NA

Approval and Distribution


Small ABAP Guidelines

Approved by Name Role Signature Date

Document History

Version Reason for change Date


1.0 Initial version
1.1
1.2
1.3

2
Small ABAP Guidelines

Table of Contents
1 DOCUMENTATION............................................................................................................................................................................4
1.1 MAIN DOCUMENTATION BLOCK............................................................................................................................................4
1.2 PROGRAM FUNCTION HEADER.............................................................................................................................................5
1.3 PROGRAM COMMENTS........................................................................................................................................................5
1.4 OBJECT LEVEL DOCUMENTATION.........................................................................................................................................6
2 NAMING CONVENTIONS FOR THE CUSTOM OBJECTS.........................................................................................................................6
2.1 APPLICATION PROGRAMS....................................................................................................................................................6
2.2 INCLUDE MODULES.............................................................................................................................................................6
2.3 VARIANTS...........................................................................................................................................................................7
2.4 NAMING CONVENTION GUIDELINES FOR THE LOCAL OBJECT(S) IN PROGRAM(S)......................................................................7
2.5 MODULE POOL...................................................................................................................................................................8
2.6 SCREEN NUMBER...............................................................................................................................................................8
2.7 MENUS...............................................................................................................................................................................8
2.8 FUNCTION KEYS.................................................................................................................................................................8
2.9 TITLE BARS.........................................................................................................................................................................9
2.10 PF STATUS........................................................................................................................................................................9
2.11 FUNCTION GROUPS.............................................................................................................................................................9
2.12 FUNCTION MODULE...........................................................................................................................................................10
2.13 SAP SCRIPT.....................................................................................................................................................................10
2.14 SMARTFORMS...................................................................................................................................................................10
2.15 SMARTSTYLE....................................................................................................................................................................11
2.16 MEMORY ID......................................................................................................................................................................11
2.17 STRUCTURE......................................................................................................................................................................11
2.18 TABLE TYPE......................................................................................................................................................................11
2.19 SEARCH HELP..................................................................................................................................................................11
2.20 TRANSPARENT TABLES......................................................................................................................................................12
2.21 DOMAIN............................................................................................................................................................................12
2.22 DATA ELEMENT.................................................................................................................................................................12
2.23 VIEWS..............................................................................................................................................................................12
2.24 LOCK OBJECTS.................................................................................................................................................................12
2.25 TRANSACTION CODES.......................................................................................................................................................13
2.26 AUTHORIZATION GROUPS..................................................................................................................................................13
2.27 BADI’S.............................................................................................................................................................................13
2.28 ENHANCEMENT.................................................................................................................................................................13
2.29 CUSTOMER EXIT...............................................................................................................................................................14
2.30 CLASSES..........................................................................................................................................................................14
2.31 STANDARD TEXTS.............................................................................................................................................................14
3 CODE FORMATTING FOR ABAP PROGRAMMING..............................................................................................................................14
3.1 ONE COMMAND ONE LINE.................................................................................................................................................14
3.2 PRETTY PRINTER..............................................................................................................................................................14
3.3 PROGRAM VARIABLES.......................................................................................................................................................15
3.4 SUBROUTINES...................................................................................................................................................................15
3.5 TEXT SYMBOLS.................................................................................................................................................................15
4 GUIDELINES FOR THE DESCRIPTION OF TRANSPORT REQUEST (TR)................................................................................................16
5 CODING GUIDELINES.....................................................................................................................................................................17
5.1 GENERAL.........................................................................................................................................................................17
5.2 DATABASE........................................................................................................................................................................17
5.3 MODULARIZATION..............................................................................................................................................................17
5.4 DATA PROCESSING...........................................................................................................................................................17
6 MISCELLANEOUS...........................................................................................................................................................................18
6.1 SYST STRUCTURE ACCESS..............................................................................................................................................18
7 APPENDIX.....................................................................................................................................................................................19
7.1 APPENDIX A – COUNTRY CODES.......................................................................................................................................19
7.2 APPENDIX B – MODULE NAMES.........................................................................................................................................19
7.3 APPENDIX C – OBJECT TYPES...........................................................................................................................................19
7.4 APPENDIX D – APPLICATION PROGRAM TYPE.....................................................................................................................20

3
Small ABAP Guidelines

1 Documentation
Documentation is required for all programs or function modules. A program needs to include four types of
documentation:
 Main documentation block
 Program Function header
 Program Comments
 Object level documentation

1.1 Main Documentation Block


The program / object should start with a main documentation block. This block will have the details of the
object; like the title, object type, author and the exhaustive description of the functionality the object is
meant to perform.
***********************************************************************
* Program Title: *
*                                                                   
  *
* Created by   :                                   Date : MM/DD/YYYY *
*                                                                   
  *
* Description  : *
*                                                                   
  *
* Module name  : *
*                                                                   
  *
* Type         : *
*                                                            
*
* Special note : *
*---------------------------------------------------------------------*
* Related Objects: Transaction Code <T-CODE> *
*---------------------------------------------------------------------*
*                       Modification History *
*---------------------------------------------------------------------*
* Date     | USER ID       | CR#   | Transport  | Mod.Key *
*----------|---------------|-------|------------|---------------------*
*          |               |       |            | Intital Version
*
*----------|---------------|-------|------------|---------------------*
*          |               |       |            | Mod01 *
*----------|---------------|-------|------------|---------------------*
*          |               |       |            | Mod02 *
*----------|---------------|-------|------------|---------------------*
*          |               |       |            | Mod03 *
*---------------------------------------------------------------------*
*Mod01:

*---------------------------------------------------------------------*
*Mod02:

*---------------------------------------------------------------------*
*Mod03:
*---------------------------------------------------------------------*

4
Small ABAP Guidelines

*Mod04:
*---------------------------------------------------------------------*

*---------------------------------------------------------------------*
* Include for Data declaration
*---------------------------------------------------------------------*

*---------------------------------------------------------------------*
* Include for Selection Screen
*---------------------------------------------------------------------*

*---------------------------------------------------------------------*
* Include for ALV data declaration
*---------------------------------------------------------------------*

*---------------------------------------------------------------------*
* Include for Forms
*---------------------------------------------------------------------*

*---------------------------------------------------------------------*
* Initialization
*---------------------------------------------------------------------*

*---------------------------------------------------------------------*
* AT selection-screen
*---------------------------------------------------------------------*

*---------------------------------------------------------------------*
* START-OF-SELECTION
*---------------------------------------------------------------------*

*---------------------------------------------------------------------*
* END-OF-SELECTION
*---------------------------------------------------------------------*

Note: Place the version number in each line of your correction by adding a comment with the version
number in each line of code. If you are incorporating a large number of new lines of code, then place your
code in following manner:
** Begin of changes <Mod#>
Insertion of code
** End of changes < Mod#>
Whenever you do new changes in old programs follow the new coding standards and no need to follow
the existing standards. Also, no section of the old code should be deleted while making changes in the old
programs. Instead, comment the old code and add the new code using the version number.

1.2 Program Function Header


The program function header should be displayed at the beginning of any modular unit of the program.
This documentation will have the details of the function / utility of the modular unit. In case of modular
units with parameters, this part of the documentation must also list all the parameters.

5
Small ABAP Guidelines

1.3 Program Comments


These comments must be present throughout the program to highlight the process flow or logic
implemented. Tough there would be no rule to govern this, there are certain expectations when it comes
to implementation of the same. As a rule of thumb, we suggest that at least every block of 10 ABAP/4
statements should contain one or more comment lines, describing the purpose of a coding block.

 Ensure that the comments are simple, yet clear and concise making the reader aware of the utility of
the code written.
 Ensure that the comments add value for the reader and they are not the copy of the code written.
 Ensure that the comments are updated as and when the code gets updated/changed.

1.4 Object Level Documentation


In case of the objects where SAP provides the object level documentation option, the developer has to
use them. For example, in case of function module(s) the function module documentation can be used to
explain the detailed purpose of the function module.

2 Naming Conventions for the Custom Objects


Any custom object being developed must follow the naming convention as prescribed below.

2.1 Application Programs


All executable program are 11 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6-8 Any meaningful description determined by the developer
9-11 Incremental number starting with ‘001’ and incremented subsequently by 1.
Programs other than executable programs are 12 characters in length and should follow the below
naming convention.
Positio Description
n
1 Z – Must be a literal i.e. Z
2 Must identify the type of program. Please refer to Appendix D
3-4 Country Code. Please refer to Appendix A
5-6 SAP Module for which the program is developed. Please refer to Appendix B
7-9 Any meaningful description determined by the developer
10-12 Incremental number starting with ‘001’ and incremented subsequently by 1.
In addition, the following points should be noted about executable programs:
 All executable programs and corresponding includes should be assigned with the relevant
authorization group.
 The description for the main program, all includes and transaction code should be same and should
follow the below naming convention;
<Module Name><:><Description specifying the purpose of the program>
6
Small ABAP Guidelines

2.2 Include Modules


The following naming convention should be used for include modules.

Positio Description
n
1-11 Main program name for reports
12 Underscore “_”
2.3 Variants
13-20 Freely definable classification, e.g. _SEL, _FORMS, _TOP etc.
The

Positio Description
n
1 Z – Must be a literal i.e. Z
2 Underscore “_”
2.4 3-14
Naming A unique 12 character
Convention Guidelines mnemonic name
for the representing
local object(s)usein
and purpose
program(s)
 Any local variable / attribute in the program must follow a proper naming convention which must start
with the prefixes.
Prefix Variable Type

LC_ Local Constant

GC_ Global Constant

CL_ Classes

CNT_ Counters

CV_ Changing Parameter of a Function Module / Method of a Class

EV_ Export Parameter of a Function Module / Method of a Class

EX_ Custom exception raised in a Function Module

FS_ Field Symbol

GO_ Global Instance of any class(in case of OOP)

GS_ Global Structure / Work Area

GT_ Global Internal Table

GV_ Global Variable

IV_ Import Parameter of a Function Module / Method of a Class

LO_ Local instance of any class

LS_ Local Structure / Work Area

LT_ Local Internal Table

LV_ Local Variable

P_ Parameter

R_ Range Table

7
Small ABAP Guidelines

R_ Return Parameter of Method of a Class

S_ Select Option

T_ Table Parameter of a Function Module

TY_ Local type defined within the program

 The above prefixes must be followed by a descriptive meaningful word which will specify the purpose
of the variable/attribute.
 Use of the technical names of the variables must be preferred over the business name/description.
E.g. lv_bukrs must be preferred over lv_co_code for the local variable meant for company code.
 Use of vague names should be completely avoided. E.g temp1, lv_temp1.

2.5 Module Pool


The following naming convention should be used for all module pool programs.

Positio Description
n
1-3 SAP
4 x, must be replaced as given below
5 “Z”
6-16 Transaction Code
The fourth character “x” in the above naming conventions varies depending on the type of module pool
program being created and should be replaced with the appropriate values as given below:
 M: Screen
 L: Function Module

Include programs inside the module pool should follow the below naming conventions
Positio Description
n
1-16 Program name
17 Underscore “_”
18 Type of include, i.e. F for Forms, O for PBO and I for PAI
19-20 Numeric value starting from 00 to 99
2.6 Screen Number
Screen number is 4 characters in length. The number range for this numeric field is 9000 to 9999.

2.7 Menus
SAP menus are based on a combination of SAP Dynpro and ABAP CUA items. The menus should be of
four characters in length starting with “Z” followed by 3 descriptive characters. For example, ZCUS –
Customer Menu.

2.8 Function Keys


Function keys are used to navigate within a transaction. They can be custom defined.

Positio Description
n
1 “Z”
2-3 Incremental number starting from 00 to 99

8
Small ABAP Guidelines

Developers are free to use the any function keys in the program. However, there are certain keys used by
SAP which are as follows:
Function Key Assignment

F1 Help

F2 Choose

F3 Back

F4 Possible entries

F9 Select

F10 Jump to Menu Bar

F11 Save / Generate

F13 Cancel

Shift+F1 Print

Shift+F2 Delete

Shift+F5 Open

Shift+F9 First Page(during scroll)

Shift+F10 Previous Page(during scroll)

Shift+F11 Next Page(during scroll)

Shift+F12 Last Page(during scroll)

2.9 Title bars


The title bar is the Dynpro or pop-up window header. It should describe the task as well as the window
itself. The title bar is declared in the process before output (PBO) section of the screen.
Positio Description
n
1 “Z”
2-20 Descriptive characters

2.10 PF Status
The PF status can be up to 20 characters in length. The name should always begin with literal “Z”.

2.11 Function Groups


Function group name can be up to 12 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2 Must identify the type of program. Please refer to Appendix D
3-4 Country Code. Please refer to Appendix A
5-6 SAP Module for which the program is developed. Please refer to Appendix B
7-9 Any meaningful description determined by the developer
9
10-12 Incremental number starting with ‘001’ and incremented subsequently by 1.
Small ABAP Guidelines

2.12 Function Module


Function module name can be up to 30 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6 Underscore “_”
7-30 Any meaningful description highlighting the purpose of the function module
The
parameters used in the interface of the function module must follow the below prescribed naming
convention.
Position Description Prefix
1-2 Import Parameter I_*
1-2 Export Parameter E_*
1-2 Changing C_*
Note: Tables parameters are obsolete, hence must not be used.

2.13 SAP Script


SAP Script name can be up to 30 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6 Underscore “_”
7-30 Any meaningful description highlighting the purpose of the function module

2.14 Smartforms
Smartform name can be up to 30 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6 Underscore “_”
7-30 Any meaningful description highlighting the purpose of the function module
The
interface parameters of the Smartform should follow the same naming conventions as for Function
Modules.

2.15 Smartstyle
Smartstyle name can be up to 30 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A 10
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6 Underscore “_”
7-30 Any meaningful description highlighting the purpose of the function module
Small ABAP Guidelines

2.16 Memory ID
The developer may use the SAP Global memory during any development. Given to understand the nature
and sensitivity of the SAP memory IDs, it is necessary for it to be unique across the system. The naming
convention for memory storage ID’s is given below.

Positio Description
n
1 “Z”
2 Underscore “_”
3-10 Calling Object
11 Underscore “_”
12-20 A unique and descriptive name representing use or purpose
2.17
Structure
Structure name should be 12 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6-9 Any meaningful description determined by the developer
10-12 Incremental number starting with ‘001’ and incremented subsequently by 1.

2.18 Table type


Table type name should be 12 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6-9 Any meaningful description determined by the developer
10-12 Incremental number starting with ‘001’ and incremented subsequently by 1.

2.19 Search Help


Search help name should be 12 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6-9 Any meaningful description determined by the developer
10-12 Incremental number starting with ‘001’ and incremented subsequently by 1.

11
Small ABAP Guidelines

2.20 Transparent Tables


Transparent table name should be 12 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
2.21 6-9 Any meaningful description determined by the developer
10-12 Incremental number starting with ‘001’ and incremented subsequently by 1.

Domain
As far as possible, all Z fields should refer to standard available domains. In case a standard domain is
not available, domain name can be created using the following naming conventions.

Positio Description
n
2.22 1-2 Z – Must be a literal i.e. Z
3-20 Corresponding SAP standard domain

Data Element
As far as possible, all Z fields should refer to standard available data elements. In case a standard data
element is not available, data element name can be created using the following naming conventions.

Positio Description
n
2.23 1 Z – Must be a literal i.e. Z
2-20 Corresponding SAP standard data element

Views
View name should be 12 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6-9 Any meaningful description determined by the developer
10-12 Incremental number starting with ‘001’ and incremented subsequently by 1.

2.24 Lock Objects


Lock object name should be 13 characters in length.

Positio Description
n
1-2 “EZ”
3-4 Country Code. Please refer to Appendix A
5-6 SAP Module for which the program is developed. Please refer to Appendix B
7-10 Any meaningful description determined by the developer
11-13 Incremental number starting with ‘001’ and incremented subsequently by 1.

12
Small ABAP Guidelines

2.25 Transaction Codes


Transaction codes should be 11 characters in length. For executable programs, transaction codes should
be same as main program name.

Positio Description
2.26
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6-9 Incremental number starting with ‘0001’ and incremented subsequently by 1.

Authorization Groups
All custom objects should be assigned with the relevant authorization group. The following authorization
groups have already been created in the system per module.
Module Module Code
ZGCO Controlling
ZGFI Financial
ZGMM Materials Management
ZGSD Sales and Distribution

2.27 BADI’s
Any custom BADI implementation name can be up to 20 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6 Underscore “_”
7-20 A unique and descriptive name representing use or purpose

2.28 Enhancement
Any custom enhancement implementation name can be up to 30 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
2.29 6 Underscore “_”
7-30 A unique and descriptive name representing use or purpose

Customer Exit
The length of the exit can be up to 8 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6 Underscore “_”
7-20 A unique and descriptive name representing use or purpose
13
Small ABAP Guidelines

2.30 Classes
The length of the class can be up to 20 characters in length.

Positio Description
n
1 Z – Must be a literal i.e. Z
2-3 Country Code. Please refer to Appendix A
4-5 SAP Module for which the program is developed. Please refer to Appendix B
6 Underscore “_”
7-20 A unique and descriptive name representing use or purpose

2.31
Standard Texts
Standard texts should be 23 characters in length.

Positio Description
n
3 Code1 Formatting
Z – Must be for ABAP
a literal i.e. Z programming
2-3 Must identify the type of program. Please refer to Appendix D
4-5 Country Code. Please refer to Appendix A
6-7 SAP Module for which the program is developed. Please refer to Appendix B
8-11 Must identify the organizational element code such as plant, company code,
sales org etc.
12-20 A unique and descriptive name representing use or purpose, for example,
PLANTADDR, CCODEADDR, SAORGADDR
21-23 Incremental number starting with ‘001’ and incremented subsequently by 1.
ABAP code written in any object will be governed by the following rules.

3.1 One Command One Line


Every command must start on a new line and end with a period.

3.2 Pretty Printer


 The developer must use the Pretty Printer function to indent the code.
 The developer must ensure that the pretty printer is set to the Keyword uppercase option (as shown in
figure 3.1).

14
Small ABAP Guidelines

3.3 Program Variables


 The variables in the program must be named as per the guidelines in the relevant section (Refer
Naming Convention Guidelines for the local object(s) in program(s)).

3.4 Subroutines
 Any code that is executed more than once in a normal flow of a program, must be placed in a
subroutine. Subroutines make the program readable and easier for maintenance.
 The name of the subroutine must be descriptive enough for the reader to understand its purpose.
 The variables used inside the subroutine must be locally defined.
 Any subroutines that is being used by multiple programs, must be define as a function module.
 The developer must document the functionality of the routine (refer Program Function Header
Documentation).
 Any parameter which is expected to be changed in the subroutine must be defined as a changing
parameter while the ones which are only referred to inside the subroutine must be defined as using.
 The naming convention that must be followed for the parameters of the subroutine is as below.

Type Using Changing

Variables FUV_ FCV_

Work Area / Structure FUW_ FUW_

3.5 Text Symbols


 Any text to be used in the program must be defined using text symbols.
 The usage of the text must be based as described below.

15
Small ABAP Guidelines

Message Number Usage

I00 to I99 Text for Information Message

E00 to E99 Text for Error Message

S00 to S99 Text for Success Message

T00 to T99 Text for output message

W00 to W99 Text for Warning Message

000 to 999 Text for Selection Screen

 Usage for the text symbols must be as follows :


MESSAGE 'Invalid Company Code'(e01) TYPE gc_error.

 The developer must always adjust the text symbols.(Goto -> Text Elements -> Utilities -> Adjust ->
Text Symbols ).

4 Guidelines for the description of Transport Request (TR)


 The developer must ensure that the objects pertaining to a single development are a part of a single
transport request.
 The naming convention for the TR must be as follows :

W/C Countr Underscor Ticket Underscor Modul Underscor Descriptio


(1 y e Numbe e e e n
Char (2 (1 Char) r (1 Char) (2 (1 Char) (N
) Char) (7 Char) Characters
Char) )
Only
for
suppor
t

 The first character of the TR description must be “W” in case of workbench request and “C” for
Customizing request.
 Next two character must specify the country for which the development/configuration is being done
(refer Appendix A).
 The next character must be an underscore acting as a separator.
 (WHERE APPLICABLE) The next seven characters must be the ticket number, in case of support
project.
 (APPLICABLE INCASE THERE IS A TICKET NUMBER PRECEDED) The next character must be an
underscore acting as a separator.
 The next two characters will specify the module for which the development / configuration has being
done (refer Appendix B).
16
Small ABAP Guidelines

 The next character must be an underscore acting as a separator.


 The next N characters must specify a meaningful description to the contents of the TR.

5 Coding Guidelines

5.1 General
 Any change to the existing code or creation of new object should be with reference to an approved FS
/ CR Only.
 Any ABAP code must have the proper documentation blocks(refer to Documentation for details)
 The data declarations must be adequately documented.
 The data declarations must follow the naming conventions (refer Naming Convention Guidelines for
the local object(s) in program(s)).
 Variables defined must be based on the dictionary object.
 The scope of the variables must be decided properly. If any variable is needed just during the lifetime
of the subroutine, viability of declaring it as a local variable must be checked.
 The reusable variables (or all, at times) must be cleared before they are being used in the context of
the program.
 If the code is no longer needed, it must be eliminated (and not just commented).
 Text symbols must be used in the program as directed (refer Text Symbols).
 Authorization checks must be implemented in the code wherever necessary.
 Transparent tables and programs must be assigned to an authorization group in all the cases.

5.2 Database
 Enhancement category must be specified for any transparent table.
 The client specific tables must have a client (MANDT) field in the key fields.
 Any table with a maintenance view, must be provided with a transaction code.
 SELECT and READ statements must be followed by a SUBRC check and action must be taken
accordingly in case of failures.
 FOR ALL ENTRIES must be preceded by a NOT INITIAL check on the table referred to in the FOR
ALL ENTRIES clause.
 Columns in the select query must be explicitly listed instead of a * and they must include the
maximum possible key fields of the table.
 SELECT ENDSELECT must be avoided. FOR ALL ENTRIES must be used instead in conjunction
with READ statement.
 Use of negative logic in the SELECT query must be avoided.
 ORDER BY clause but be avoided in the select query. SORT statement must be used instead.
 Standard tables must not be updated directly. BAPIs / Standard Screens must be used.
 Array operation must be used instead of single record operation in INSERT/UPDATE/DELETE.
 COMMIT and ROLLBACK must not be used in standard exit.
 Any custom table being modified, must be locked before modification and released post modification.

5.3 Modularization
 There must be no unnecessary duplication of the code. Appropriate modularization units must be
used.
 Globally re-usable code must be defined in a well-documented FM/Class Method.

17
Small ABAP Guidelines

5.4 Data Processing


 Standard Function Modules must be used for date manipulation operations.
 MOVE-CORRESPONDING statement must be used appropriately.
 CASE must be used instead of ELSEIF.
 All the BREAK-POINTS (or BREAK <USER_NAME> ) must be removed from the code.
 Pretty Printer must be used (refer Pretty Printer).
 All the fields on the Selection Screen must be validated to have a proper input. In case of failures,
proper messages must be displayed to the user.
 In case of arithmetic operation(s) like the division, the denominator must be checked for not being a
ZERO.
 Any hard coded value must not be used in the code for the variables like the customer code, company
code etc. (Constants declared in the data declarations may be used in exceptional cases).
 LOOP AT..WHERE or READ TABLE must be used wherever possible.

6 Miscellaneous

6.1 SYST Structure Access


 ECC 6.0 Release 7.0 implements a new class CL_ABAP_SYST which consists all the static methods
that may be used for modification of the system provided values during the program runtime.
 The developer must use the static class for retrieval of the values in system field.

System Field Method Name Description

SY-MANDT GET_CLIENT Returns the logon client of the current user

SY-CPROG GET_CURRENT_PROGRA Returns the current program name


M

SY-HOST GET_HOST_NAME Returns the Host Application Server Name

- GET_INSTANCE_NAME Returns the Application Server Instance Name

SY-LANGU GET_LANGUAGE Returns the Logon Language of the current user

SY-UNAME GET_USER_NAME Returns the user name of current user

SY-TCODE GET_TRANSACTION_COD Returns the current transaction code


E

18
Small ABAP Guidelines

7 Appendix
7.1 Appendix A – Country Codes
Country Country Code

G Global

IN India

7.2 Appendix B – Module Names


Module Module Code
CO Controlling
FI Financial
MM Materials Management
SD Sales and Distribution

7.3 Appendix C – Object Types


Type Program
AO Authorization Object
BA BADI
CL Class
DE Data Elements
DO Domain
EI Enhancement Implementation
FG Function Group
FM Function Module
G Authorization Group
IF Interface
IN Include Program
LD Logical Database
LO Lock Object
MC Message Class
SC SAP Script
SF Smartform
SH Search Help
SS Smart Style
ST Structure
TB Transparent Table
TT Table Type
VA Variant
VW View
EX Customer Exit

19
Small ABAP Guidelines

7.4 Appendix D – Application Program Type

Type Description Explanation

M Module Pools for Screen Contain processing steps for screen modules
Painter Screens
I Includes Contain program code that cannot be run on its own
S Subroutines Contain parts of programs (FORM routines) that can be called
using external PERFORM statements.
F Function Groups Contain function modules
J Interface Pools Contain interfaces
K Class Pools Contain interfaces
ST Standard Text SO10 texts

20

You might also like