You are on page 1of 15

Naming Conventions

Document Change Control

Release
1.1

Description
Local / Country naming conventions

Created By
Kannan Gopal

Date
20th July

Reviewed By

Date

Approved

Date

Naming Conventions for ABAP/4


1.1 1.2 Definitions in the Data Dictionary (SE11) ABAP/4 programming objects

1.3 Conventions for Data Declarations 1.3.1 Variables 1.3.2 Types 1.3.3 Constants 1.3.4 Other 1.4 Naming Conventions for ABAP-Object Oriented 1.4.1 Global Conventions 1.4.2 Local Conventions 1.4.3 Class-local Conventions 1.4.4 Data definitions (variables) 1.4.5 Guidelines and Conventions for JAVA development 1.4.6 Conventions from Other Areas 1.4.7 CRM-specific Naming Conventions 1.5 1.6 Application area Country Codes

1.7 ABB Mandatory Naming Conventions 1.7.1 LSMW 1.7.2 SAPSCRIPT

Programming Guidelines ABB V 0.1.doc

Page 1 of 15

Naming Conventions

Naming Conventions for ABAP/4


Naming conventions are the result of agreement among customer and implementation partner to use standard generic prefixes when assigning names to development objects, for example, function modules, programming elements, or variables. The system itself does not usually check that these naming conventions are adhered to. The responsibility for this lies with the individual developer. Legend: In the following text <Z> is representing the customer name range and <AS> the application specific id of the customer project and <CN> the country codes. It has to be GL for global developments and two letter country code for country specific developments. The details of these are specified in section 2.5 and 2.6

Definitions in the Data Dictionary (SE11)


Dictionary Element Database table Views Data element Structure Append Structures Table type Domain Search help Lock object Notes: Also names for customer specific lock objects must start with an E. Naming Convention <Z><AS><CN>_<name> <Z><AS><CN>_V_<name> <Z><AS><CN>_<name> <Z><AS><CN>_S_<name> <Z><AS><CN>_<database table>_<name> <Z><AS><CN>_IT_<name> <Z><AS><CN>_<name> <Z><AS><CN>_H_<name> E<database table> Example ZMMIN_AVDK ZMMIN_V_AVDK ZMMIN_WERKS ZMMIN_S_AVDK ZMMIN_MARA_COLOR ZMMIN_IT_AVDK ZMMIN_WERKS ZMMIN_H_AVDK EZMMIN_AVDK

ABAP/4 programming objects


The N in package/Development class and message class stands for number Object type Package / Development class Transaction codes Naming Convention <Z><AS>N <Z><AS><CN><text><numbe r> Example or Comment ZMM0 It makes sense to follow the SD convention that a suffix in the form of digits refers to the function: 01 = Create

Programming Guidelines ABB V 0.1.doc

Page 2 of 15

Naming Conventions
02 = Change 03 = Display Message class Report <Z><AS>N <Z><AS><CN>_<name> ZMM0 Test and check programs are created in the development class $TMP (local objects). Include names are proposed by the SAP system and structured logically by the developer. Follow the naming conventions from the ABAP fundamentals course. Further includes: Pattern: ZAAGLnnnXmm AA = Application GL = Global nnn = 001 to 999 consecutive number within the application X = Type of content: F = FORM-Routines I = PAI Routines O = PBO Routines mm = 01 to 99 consecutive number of the include Module Pool Menu Dynpro Function modules Function Group Enhancements <Z><AS><CN>_<name> Z<AS><CN><Menus> Number >= 9000 Z<AS><CN> _<text> Z<AS><CN>_<Text> Z<AS><CN>_<Text> ZMMIN_STRMAT_INBOUND ZMMGL_PURCHASE_ORDER ZFIGL_GLCHECK

Includes

<Z><AS><CN>nnnXmm

For country perspective it is followed as given below :


Object type Package / Development class Naming Convention <Y><AS><CN>N Example or Comment YMMIN0

Programming Guidelines ABB V 0.1.doc

Page 3 of 15

Naming Conventions
Transaction codes <Y><AS><text><number> It makes sense to follow the SD convention that a suffix in the form of digits refers to the function: 01 = Create 02 = Change 03 = Display Message class Report <Y><AS>N <Y><AS>_<name> YMM0 Test and check programs are created in the development class $TMP (local objects). Include names are proposed by the SAP system and structured logically by the developer. Follow the naming conventions from the ABAP fundamentals course. Further includes: Pattern: ZAAGLnnnXmm AA = Application GL = Global nnn = 001 to 999 consecutive number within the application X = Type of content: F = FORM-Routines I = PAI Routines O = PBO Routines mm = 01 to 99 consecutive number of the include Module Pool Menu Dynpro Function modules Function Group Enhancements <Y><AS>_<name> <Y><AS><Menus> Number >= 9000 Z<AS><CN> _<text> Z<AS><CN>_<Text> Z<AS><CN>_<Text> ZMMIN_STRMAT_INBOUND ZMMGL_PURCHASE_ORDER ZFIGL_GLCHECK

Includes

<Y><AS>nnnXmm

Programming Guidelines ABB V 0.1.doc

Page 4 of 15

Naming Conventions Conventions for Data Declarations


Variables
There are the following general naming conventions for variables: <Visibility><Data type>_<Name> Vi sib ilit y L Local G I E C S Global Import parameter (nonchangeable) Export parameter Changing / referenced Static variable R REF O Range table / selection table Pointer (type ref to data) Objects (instances) Data Type

V S T

Variable (optional) Structure Table

Note: Tables with header lines should not be used anymore.

Types
T y p e D at a T y p e V S T

T Typ e

Variable (optional) Structure Table

Range table / selection table

Type pools are no longer used!

Programming Guidelines ABB V 0.1.doc

Page 5 of 15

Naming Conventions
Constants
Constants are defined globally with the prefix "GC" (or "global" or "constant".) Cons tants GC

Constant

Other
Other P SO Selection parameters Selection options

TCTRL Table control TSTRP Tabstrip Example:


Types Program-internal type Program-internal type with structure Program-internal table type Value TV_mytype TS_mytype TT_mytype

Constants Constant (global) Variables Local variable Local structure Local table Global variable Global structure Global table Statics variable Statics structure Statics table Import variable Export variable

Value GC_myconst Value LV_myvar LS_mystruc LT_mytab GV_myvar GS_mystruc GT_mytab SV_myvar SS_mystruc ST_mytab IV_myvar EV_myvar

Programming Guidelines ABB V 0.1.doc

Page 6 of 15

Naming Conventions

Changing variable Import structure Export structure Exchange structure Import table Export table Changing table Parameter Selection option Local pointer

CV_myvar IS_mystruc ES_mystruc CS_mystruc IT_mytab ET_mytab CT_mytab P_mypara SO_mysel LREF_mypointer

Naming Conventions for ABAP-Object Oriented


The following additional conventions apply to the use of ABAP-OO: Legend: In the following text <Z> is representing the customer name range (Z or Y or /name range/) and <AS> the application id of the customer project and <CN> the country code.

Global Conventions
Classes and interfaces in the class library must be defined in the customer namespace Z**. Class in the class library* <Z><AS><CN>CL_<class name> The class name must consist of nouns and always be singular. <Z><AS><CN>CL_COMPANY_CODE, <Z><AS><CN>CL_GENERAL_LEDGER_ ACCOUNT Interface in class library* <Z><AS><CN>IF_<interface name> The same naming conventions are used for interfaces as are used for classes <Z><AS><CN>IF_STATUS_MANAGEMA NT, <Z><AS><CN>IF_CHECKER Type in DDIC* <type name>

Programming Guidelines ABB V 0.1.doc

Page 7 of 15

Naming Conventions
Program-local class (recommendation) LCL_<class name> The class name must consist of nouns and always be singular. LCL_TREE_MANAGEMENT Program-local interface (recommendation) LIF_<interface name> The same naming conventions are used for interfaces as are used for classes LIF_PRINTER The objects marked with * are protected by the global TADIR. They do, however, have the same namespace as data elements, tables, structures, and types.

Local Conventions
Classes and interfaces in the class library must be defined in the customer namespace Y**. Class in the class library* <Y><AS>CL_<class name> The class name must consist of nouns and always be singular. <Y><AS>CL_COMPANY_CODE, <Y><AS>CL_GENERAL_LEDGER_ACCO UNT Interface in class library* <Y><AS>IF_<interface name> The same naming conventions are used for interfaces as are used for classes <Y><AS>IF_STATUS_MANAGEMANT, <Y><AS>IF_CHECKER Type in DDIC* Program-local class (recommendation) <type name> LCL_<class name> The class name must consist of nouns and always be singular. LCL_TREE_MANAGEMENT Program-local interface (recommendation) LIF_<interface name> The same naming conventions are used for interfaces as are used for classes LIF_PRINTER

Class-local Conventions
Method name
Programming Guidelines ABB V 0.1.doc

<method name>
Page 8 of 15

Naming Conventions
The method name must start with a verb. GET_STATUS, CREATE_ORDER, DETERMINE_PRICE Event <event name> Event names must be assigned as follows: <Noun>_<Verb in past tense>. BUTTON_PUSHED, COMPANY_CODE_CHANGED, BUSINESS_PARTNER_PRINTED Class-local type definitions YV/S/T_<type name> (recommendation) YV_INTERNAL_TYPE, YS_STRUCTURE, All type definitions that are not YT_TABLE defined in the DDIC are marked with Y+_ Data definition (constant) (recommendation) C_<constant name> C_MAX_LINE

Data definitions (variables)


Visibility of data in classes has 2 dimensions: Public / Private / Protected Instance / Static To meet these dimensions the following conventions are recommended: Instance Public Private Protected GIV/GIS/GIT_<variable name> gis_mara TYPE mara LIV/LIS/LIT_<variable name> lis_mara TYPE mara SIV/SIS/SIT_<variable name> sis_mara TYPE mara Notes: Always use the V in the prefix for definition of variables to avoid misunderstanding. In normal ABAP GS_<variable_name> represents a structure! Static GSV/GSS/GST_<variable name> gsv_matnr TYPE matnr LSV/LSS/LST_<variable name> lsv_matnr TYPE matnr SSV/SSS/SST_<variable name> ssv_matnr TYPE matnr

Programming Guidelines ABB V 0.1.doc

Page 9 of 15

Naming Conventions
Avoid using verbs at the start of names for variables in a class (CLASS-DATA, DATA), because they will conflict with method names. Protected data definitions start with an S in accordance to the super statement for the access from a subclass to these data.

Note: (recommendation) means that the specified prefix is NOT mandatory. However, if prefixes are used, then they must be the prefixes described above. Attribute access SET_<attribute name> name>, GET_<attribute

Attribute accesses for every kind of attribute must have the prefix GET_ or. SET_ GET_STATUS, SET_USE_COUNT Methods that deal with an event ON_<event name> Methods that deal with an event must start with ON, and the name must include the event that they deal with. ON_BUTTON_PUSHED, ON_BUSINESS_PARTNER_PRINTED Methods that carry out type conversions Methods that deliver a Boolean value These methods must not return any EXCEPTIONs Recommendation: The Boolean value should be represented by the values SPACE/X for false/true Check methods These methods are different from the IS_<adjective> methods in that they include the option of returning EXCEPTIONS. CHECK_<objective> CHECK_AUTHORIZATION, CHECK_PROCESS_DATE AS_<new type> AS_STRING, AS_ISOCODE IS_<adjective> IS_OPEN, IS_EMPTY, IS_ACTIVE

The parameters are seen from the point of view of the method that implements them:

Programming Guidelines ABB V 0.1.doc

Page 10 of 15

Naming Conventions
IMPORTING-Parameter EXPORTING-Parameter CHANGING-Parameter RESULT EXCEPTIONS IV/S/T_<parameter name> EV/S/T_<parameter name> XV/S/T_<parameter name> RV/S/T_<result> See EXCEPTIONs

Note:

The use of prefixes in NOT mandatory. However, if prefixes are used, then they must be the prefixes described above.

Exceptions Agreeing on a standard name for EXCEPTIONS makes life easier for all developers. The following table contains meaningful EXCEPTIONS that can also be used generically. (Example: NOT_FOUND could be changed to DATE_NOT_FOUND) EXCEPTION ACTION_NOT_SUPPOR TED CANCELLED Meaning The requested action or OK code is not supported. This EXCEPTION can be used if a dialog in a method has determined what is to be done (example: selection list) and the user chooses Cancel. An object that you want to create exists on the database already. The method was not able to carry out its task, due to the current environment situation. This exception is intended in particular for situations where the environment is temporarily in a constellation that makes it impossible to carry out task of the method. A subfunction of the method could not be carried out, due to the current environment situation. (OPEN_FAILED, CLOSE_FAILED, SELECTION_FAILED, AUTHORIZATION_FAILED) Data is locked by another user. Object data on the database is

EXISTING FAILED

..._FAILED

FOREIGN_LOCK INCONSISTENT

Programming Guidelines ABB V 0.1.doc

Page 11 of 15

Naming Conventions
inconsistent. ..._INCONSISTENT INVALID The subobject data of an object on the database is inconsistent. The specified object data is incorrect. (For example, company code not available) ( as opposed to NOT_QUALIFIED) The specified subobject data of an object is incorrect. (As opposed to NOT_QUALIFIED) The last resort. Use this EXCEPTION when all else fails and the error can not be narrowed down any further. The user is not authorized for the action. The requested object has been customized incorrectly. The subobject of the requested object has been customized incorrectly. The requested object had not been found. The subobject of the requested object has not been found. The combination of the input parameters is insufficient to trigger the function of the method. (As opposed to INVALID) A particular parameter of the method is not qualified. Error in the numbering. This EXCEPTION can be set when the Basis system returns an unexpected error code.

..._INVALID

INTERNAL_ERROR

NOT_AUTHORIZED NOT_CUSTOMIZED ..._NOT_CUSTOMIZED NOT_FOUND ..._NOT_FOUND NOT_QUALIFIED

..._NOT_QUALIFIED NUMBER_ERROR SYSTEM_ERROR

Guidelines and Conventions for JAVA development


The coding and naming conventions proposed by SUN would be used

Conventions from Other Areas


This section addresses additional or supplementary conventions from other areas of SAP development. These can be adopted as they are or used as a basis for developing corresponding conventions in SDP.

CRM-specific Naming Conventions


There are the following additional conventions for developments within the my.SAP.com component CRM.

Programming Guidelines ABB V 0.1.doc

Page 12 of 15

Naming Conventions
Includes Includes are subject to the following naming conventions Main program contains an include for all PBO modules in the program Ending O0O The module does not contain any coding, only Perform Call Sorted alphabetically Main program contains an include for all PAI modules in the program Ending I0I The module does not contain any coding, only Perform Call Sorted alphabetically The main program contains an include for each form routine in the program Ending F<**> (for Forms 01-ZZ) Sorted alphabetically The form routine name is entered as a comment, alongside the include name Constants: Ending CON Data definitions: Ending DAT Type definitions: Ending TYP Due to the technical restrictions of function groups, the last three characters give information on the type of Includes (PBO/PAI/Form/Function) Rules An include for each form routine (for less problems with support packages, avoid conflicts) An include for all PBO modules An include for all PAI modules The modules do not contain any coding except for the form routines call Sort new includes alphabetically in the main program and enter the routine names as a comment A smaller include for each theme area for data statements, constants, types, ...(Flexible implementation, definitions that are not required are not loaded)

Programming Guidelines ABB V 0.1.doc

Page 13 of 15

Naming Conventions Application area


SAP application area ID SD Sales and Distribution PS -- Project Systems MM Materials Management QM Quality Management PP FI Production Planning Finance PM Plant Maintenance CO - Controlling HR Human Resources CR - CRM Sales CS CRM Service PL - PLM EH - EHS

Country Codes
SAP Country Code ID ( for country specific) : IN India AU -- Australia MY -- Malaysia PK Pakistan PH Phillipines SG Singapore TH Thailand VN -- Viatnam NZ Newzealand ID - Indonesia For developments applicable to all countries: GL: Global

Programming Guidelines ABB V 0.1.doc

Page 14 of 15

Naming Conventions ABB Mandatory Naming Conventions


LSMW
Legacy system migration workbench. As this tool resides in a specific namespace, there is technically no SAP conventions on names. ABB Maintenance Projects Naming Sub-Project Naming Object Naming Local Z PPPP Z PPPP Meaningful name for the uploaded object

SAPSCRIPT
R/3 Documentation (SE61) When creating an object that documents a Workbench object, the document has the same name as the object. For dialogue texts, the name of the related workbench object (calling program) is to be used. For independent documents (e.g. general texts, chapters of an online manual etc.) you are free to allocate any name within the customer name range.

Programming Guidelines ABB V 0.1.doc

Page 15 of 15

You might also like