KEMBAR78
ABAP Coding Standards and Guidelines | PDF | Class (Computer Programming) | Method (Computer Programming)
0% found this document useful (0 votes)
712 views103 pages

ABAP Coding Standards and Guidelines

The document outlines the ABAP Coding Standards and Guidelines for SAP R/3 development, focusing on naming conventions, programming standards, and development practices to ensure manageable maintenance of custom development objects. It applies to the ABAP team and any SAP projects executed by the ES team, excluding SAP BW/BI developers. The document includes detailed sections on responsibilities, reference documents, and specific coding standards for various ABAP program elements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
712 views103 pages

ABAP Coding Standards and Guidelines

The document outlines the ABAP Coding Standards and Guidelines for SAP R/3 development, focusing on naming conventions, programming standards, and development practices to ensure manageable maintenance of custom development objects. It applies to the ABAP team and any SAP projects executed by the ES team, excluding SAP BW/BI developers. The document includes detailed sections on responsibilities, reference documents, and specific coding standards for various ABAP program elements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 103

ABAP Coding Standards and Guidelines

Revision A Released Date AUG/11/17

Approver(S) Designation Date of Approval


Anil Menon IT Director AUG/11/17
Cynthia Kendall IT Director May/01/01
Distribution List
IT_STS_TECH_LEAD_ABAP SAP Development AMER & EUR
IT ES SAP Development-PENANG

Rev Date Originator(s) Change Details To see history of changes please click HERE.
A AUG/11/17 Paul Jackson Initial Release.
B May/01/01 Edwin Soh & Nisha Parihar 7.5 Coding Standards

1. Purpose

1.1. The purpose of this standard is to define naming conventions, programming standards, and
development practices that will be utilized as SAP R/3 development standards for all R/3 development.
By following these standards, the ongoing maintenance of custom development objects will be a
highly manageable entity.

2. Scope

2.1. This standard applies to the ABAP team, which develops code for implementation in applications or
systems.
2.2. This standard applies to any SAP project that requires development, which is executed by the ES
team.
2.3. This standard excludes SAP BW/BI developers who follow processes laid down by BI team
management

3. Definitions/ Terminology

3.1. ES - Enterprise Solutions & Application team


3.2. IT- Information Technology
3.3. SDLC- Software Development Lifecycle
3.4. DEV- Development environment
3.5. STG- Staging environment
3.6. PRD- Production environment

4. Responsibilities

4.1. ES team Management is responsible for ensuring this standard is implemented, maintained, and
effective.
4.2. The ES Team Director is responsible for maintaining and approving this document, as well as ensuring
communication to all levels of the STS organization.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 1 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

4.3. The ES Team ABAP developers are responsible for adhering to the coding standards and guidelines
described in this document. This includes permanent Jabil employees and independent
consultants/contractors.

5. Reference Documents

5.1. Reference Documents


5.1.1. 04-IT60-STS-001 ABAP Coding Standards and Guidelines
5.1.2. 04-IT30-STS-004 STS SDLC Development Phase – ABAP and Functional
5.1.3. 04-IT30-STS-005 ABAP Code Review
5.2. Supporting Documents
5.2.1. NA

6. Process
Contents
About This Guide ................................................................................................................... 6

Introduction ...................................................................................................................... 6

ABAP Program Elements ........................................................................................................ 7

Attributes.............................................................................................................................. 7

Executable program (1) ................................................................................................................ 7

Subroutine pool (S) ....................................................................................................................... 7

Interface pool (J)........................................................................................................................... 7

Logical Database .......................................................................................................................... 8

Unicode Checks Active.................................................................................................................. 8

Naming convention Packages ................................................................................................ 8

Example: Z_MM_OUTPUT ........................................................................................................... 9

ABAP Reports ............................................................................................................................... 9

Data Declaration ........................................................................................................................ 12

Data Dictionary ................................................................................................................... 14

Tables ......................................................................................................................................... 14

Views .......................................................................................................................................... 15

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 2 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Structures ................................................................................................................................... 16

Table Types ................................................................................................................................ 16

Fields/Domains/Data elements ................................................................................................. 16

Table Maintenance .................................................................................................................... 17

Message Classes ......................................................................................................................... 17

Naming ....................................................................................................................................... 17

New messages............................................................................................................................ 18

Transaction Codes (TCODE) ....................................................................................................... 18

ABAP Object Naming Conventions ....................................................................................... 21

ABAP Object Component Naming Conventions......................................................................... 22

Concrete Method Description Conventions .............................................................................. 23

Coding Standards ................................................................................................................ 23

ALV ................................................................................................................................. 36

Interface ......................................................................................................................... 37

IDocs ...................................................................................................................................... 37

Function Modules................................................................................................................ 56

Batch Data Communications (BDC) .................................................................................. 58

Customer Enhancement (user exits) ................................................................................. 58

CMOD / SMOD ....................................................................................................................... 59

BADI ....................................................................................................................................... 59

VOFM ..................................................................................................................................... 60

Dialog Programming ........................................................................................................ 61

PF-Status ................................................................................................................................ 61

Include programs ................................................................................................................... 62

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 3 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Screen painter........................................................................................................................ 63

Flow logic ............................................................................................................................... 63

Modules ................................................................................................................................. 64

ABAP Global Class Elements ............................................................................................ 66

Class builder ........................................................................................................................... 66

ABAP Web Dynpro .......................................................................................................... 70

Component Name ................................................................................................................. 70

Window Name: w_<name> .................................................................................................. 70

View Name: v_<name> ......................................................................................................... 70

Supply Function ..................................................................................................................... 70

Plugs....................................................................................................................................... 71

UI Elements Names................................................................................................................ 71

Assistance Class ..................................................................................................................... 72

Model Class............................................................................................................................ 73

General Guidelines for Web Dynpro Components ................................................................ 73

Generation Limit .................................................................................................................... 75

Development Tips .................................................................................................................. 75

SAPscript forms ............................................................................................................... 78

SAPscript forms – Naming convention .................................................................................. 79

SAPscript Development Class ................................................................................................ 80

Basic Settings Tab .................................................................................................................. 81

Layout Windows .................................................................................................................... 82

Paragraph Format .................................................................................................................. 82

Character Format................................................................................................................... 83

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 4 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Text Elements ........................................................................................................................ 84

General SAPscript Programming Guidelines ......................................................................... 85

Adobe Forms ................................................................................................................... 88

PDF Scenarios ........................................................................................................................ 88

Print program ........................................................................................................................ 89

Naming Conventions ............................................................................................................. 89

Configurable Objects ............................................................................................................. 95

Scripting ................................................................................................................................. 96

Master Pages ......................................................................................................................... 97

Documentation ...................................................................................................................... 97

Workflow ........................................................................................................................ 98

Workflow Naming Standards ................................................................................................. 98

Appendices ................................................................................................................... 100

Functional Areas .................................................................................................................. 100

Local Data Definition Naming Conventions ......................................................................... 102

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 5 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

About This Guide

Introduction
The purpose of this reference document is to define naming conventions, programming
standards, and development practices that will be utilized as SAP R/3 development
standards for all R/3 development. By following these standards, the ongoing maintenance
of custom development objects will be a highly manageable entity.

Convention Explanation

Tip boxes identify shortcuts or important


information that may make processing
easier.

Severity 1

Severity 2

Severity 3

Severity 4

Severity 5

Note : Hawkeye classifies each rule according to the degree of impact each rule could have
on the organization – from a scale of 1 (most impact) to 5 (least impact). Even though
severity 5 rules are on the lower impact end of the spectrum, they point out issues in the
code that should not be allowed for new development.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 6 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

ABAP Program Elements


Following is a discussion of each element, presented in the order they are usually required
when creating a new ABAP program.

Attributes
Authorization Group
Jabil requires that all custom developed programs have an authorization group assignment
that meets the Jabil’s SAP Security and Authorization Guidelines.

Package
Packages are used in the Transport system. They are used to group all objects that are
related to the same development to ensure they are transported together.

Type

Executable program (1)


Use this type only where technically necessary, such as background jobs. With regards to
ABAP Objects, these programs should not contain any operational statements outside of
local classes. The event block, START-OF-SELECTION, should be implemented merely
as an entry point, where a method of a local class is invoked.

Include program (I)


Automatically set by the ABAP Workbench.

Module pool (M)


Automatically set by the Screen Builder.

Function group (F)


Automatically set by the Function Builder.

Subroutine pool (S)


Use this type when programming business application functionality in local classes, where a method is invoked
by a transaction code. A subroutine pool that contains only methods can be directly compared to a Java
program that is executed by calling its main method.

Interface pool (J)


Automatically set by the Class Builder
Programmer Includes: Stephen will be consistent in his naming of includes.

Class pool (K)


Automatically set by the Class Builder.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 7 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Logical Database
Do NOT use a logical database as a program attribute. To use an existing logical
database, call it explicitly using the function module LDB_PROCESS from within a
method.

Unicode Checks Active


This must always be set on new development.

Fixed point arithmetic This


must always be set.

Naming convention Packages


Package names can be a maximum of 30 characters long.
To expedite the implementation of an automated transport process, please evaluate the
packages of all existing objects that you are modifying. If they do not belong to one of the
approved development classes, please reassign them to one. The list of approved
development classes and their descriptions can be found at the end of this document.
The use of the latest package capabilities is encouraged. Utilize package hierarchies and
interfaces:
• To improve the structure of the software
• To encapsulate software functions more strictly
• To make well-defined interfaces available to all applications To clarify
responsibilities
Position Description Value

1 Designates the type Y – Customer temporary/local objects


of objects contained Z – Customer objects for production
in the development Others – SAP objects
class.
2 Underscore To enable readability

3 to n Functional View Functional areas


assignment
n+1 Underscore To enable readability

n+2 to 30 Free form text Description of package. Use underscores


to enable readability.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 8 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Example: Z_MM_OUTPUT
When assigning a package to an object pay attention to the
transport layer property. For example:
Z_MM_ENHANCEMENTS is set to go to STG only (programs /
tables)
Z_MM_OUTPUT is set to go across clients and to STG (for
Smartforms)

ABAP Reports
ABAP program names may be up to 40 characters long.
Example: Z_MM_INVENTORY
Position Description Value
1 Designates type of Z – Customer program for
object production Y – Test program
2 Underscore To promote readability
3 to n Functional Area View Functional areas
n+1 Underscore To promote readability
n+2 to 40 Program description Descriptive, yet concise text. Use underscores
to enhance readability.

The following naming conventions are in accordance with Hawkeye Master Rules.

Severity 2
Follow the below naming conventions

Description Convention

NC - FIELD-GROUPS FG_

NC - CHANGING (FORM) CH_

NC - TABLES (FORM) T_

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 9 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

NC - USING (FORM) P_*

NC - CHANGING (FUNCTION) CH_

NC - EXPORTING (FUNCTION) EX_

NC - IMPORTING (FUNCTION) IM_

NC - TABLES (FUNCTION) T_

NC - CLASS-DATA (Global Class) GSV_

NC - CLASS (Global) ZCL

NC - CONSTANTS (Global Class) GC_

NC - DATA (Global Class) GV_

NC - EVENTS (Global Class) E_

NC - METHODS (Global Class) M_

NC - TYPES (Global Class) TY_

NC - CONSTANTS (Global) C_

NC - DATA (Global) GV_

NC - FIELD-SYMBOLS (Global) <FS>_

NC - INTERFACE (Global) IF_

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 10 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

NC - TYPES (Global) TY_

NC - CLASS-DATA (Local Class) LV_

NC - CLASS (Local) LCL_

NC - CONSTANTS (Local Class) C_

NC - DATA (Local Class) LC_

NC - EVENTS (Local Class) LE_

NC - METHODS (Local Class) LM_

NC - TYPES (Local Class) LT_

NC - CONSTANTS (Local) C_

NC - DATA/STATICS (Local) LV_

NC - FIELD-SYMBOLS (Local) <FS>_

NC - INTERFACE (Local) IF_

NC - TYPES (Local) LTY_


objects CO_, table types CT_, structures
NC - CHANGING (METHODS) CS_, others C_
objects EO, tables types ET, structures ES,
NC - EXPORTING (METHODS) others E_
objects IO, table types IT, structures IS_,
NC - IMPORTING (METHODS) others I_

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 11 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

object s RO, table types RT_, structures


NC - RETURNING (METHODS) RS_, others R_

NC - PARAMETER P_

NC - SELECT-OPTIONS SO_

NC - EXPORTING (EVENTS) EX_

NC - INTERNAL TABLES (Local) T_

NC - INTERNAL TABLES (Global) LT_

NC - VARIABLES (Local) LV_

NC - VARIABLES (Global) V_

Data Declaration
Internal tables
Internal tables should begin with a LT_ (T_ for local tables) and the remaining positions
should be filled with the table name that it most closely resembles from the data dictionary.
Internal tables should not use a header row.
All internal tables which will not need to be sorted more than once should be a sorted table
when possible. This enhances the performance. Below is an example if you needed all
data from the MARA table.
DATA:
t_mara TYPE SORTED TABLE OF mara
WITH UNIQUE KEY matnr.

When an internal table is used and the program only needs specific fields from the SAP
table(s); a TYPE should be created with those specific fields.
The following internal table is a subset of the material master table MARC.
TYPES:
BEGIN OF ty_marc, matnr
TYPE matnr, werks TYPE

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 12 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

werks_d, mmsta TYPE mmsta,


END OF ty_marc.
DATA:
t_marc TYPE SORTED TABLE OF ty_marc
WITH UNIQUE KEY matnr werks.

Variables
For variables that are defined after data dictionary fields (use them whenever possible),
begin the name with V_ (LV_ for local variables) and the remaining positions should be
filled with the field name from the data dictionary.
DATA: v_matnr TYPE matnr.

When the variable is a work area structure, include s_. For a global variable which is a
work area it would be s_marc; local variable with work area ls_marc. This is helpful for
maintenance of the program; other developers will be able to see in a quick glance this is a
work area (structured variable) rather than just a single value.
DATA: ls_marc TYPE ty_marc.

Field-symbols
When READing / LOOPing always assign to field symbols, rather than reading INTO a
structure. Always use fields symbols as local – can cause major issues if global field
symbols are used. This causes issues for future maintenance as well.
FIELD-SYMBOLS:
<l_lips_tot> TYPE ty_lips.

Select-options
Begin with so_, and the remaining positions should be filled with the field name from the
data dictionary:
SELECT-OPTIONS: so_matnr
FOR v_matnr.

Parameters
For parameters that are defined like data dictionary fields (use this whenever possible),
begin with a P_, and the remaining positions should be filled with the field name from the
data dictionary:
PARAMETERS: p_werks TYPE
werks_d.

Types
With the new ABAP OO standards the TYPES statement will be utilized when defining
structures for internal tables and work areas, and begin with TY_ (or lty_ for local –
however, most types should be used as global).
TYPES:

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 13 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

BEGIN OF ty_marc, matnr


TYPE matnr, werks TYPE
werks_d, mmsta TYPE mmsta,
END OF ty_marc.

Like vs. Type


Use TYPE .instead of LIKE, to be ABAP OO compliant.

Messages
All programs should contain at least one message of type S so that the user sees a
response from the system. When programs are scheduled to run in the background, the
only way to influence the job log is via message commands. All status and error messages
should be accessed via the message class libraries.

Data Dictionary

Tables
Technical attributes shall be determined according to the development specification.
The maximum name size for customer tables is 16 characters.
All indexes must be approved by the NetWeaver Team before
being moved to Production.

When receiving a warning message on activating a table


regarding enhancement category not assigned, DO NOT assign
an enhancement category, leave it as “Not Classified”.

Severity 1
This is a Data Dictionary Requirement that Client Specified Tables MUST have the first
field of the table defined as CLIENT (MANDT).

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 14 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Example: ZMM_LOOKUP
Position Description Value

1 Designates type Z – Customer program for production


of object Y – Test program

3 to n Functional Area View Functional areas

n+1 Underscore To promote readability

n+2 to 16 Program Descriptive, yet concise text. Use underscores to


description enhance readability.

Views
The creation of a view is to be used as a third option. Please try direct table selects, then a
table join before resorting to a view. If a view does need to be created, proper
documentation and reasoning must be presented at the time of the code review.
Views are transparent tables consisting of an alternate view or combination of multiple
tables, such as a joined table. The length of the view name will vary based on the primary
table name for that view. The maximum name length of a view is 16 characters.
Example: ZMM_V_MATERIALS
Position Description Value

1 Designates type of Z – Customer program for


object production
Y – Test program

2 to n Functional Area View Functional areas

n+1 to n+3 _V_ V – for view

Position Description Value

n+4 to 16 Program description Descriptive, yet concise text.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 15 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Structures
Used for common data layouts between programs.
Structure name length may be a maximum of 30.
Example: ZMM_S_INVENTORY
Position Description Value

1 Designates type of Z – Customer program for production


object Y – Test program

2 to n Functional Area View Functional areas

n+1 to n+3 _S_ S = Structure

n+4 to 30 Program description Descriptive, yet concise text. Use


underscores to enhance readability.

Table Types
Used for common data arrays between programs.
Table Type name length may be a maximum of 30.
Example: ZMM_T_INVENTORY
Position Description Value

1 Designates type of Z – Customer program for production


object Y – Test program

2 to n Functional Area View Functional areas

n+1 to n+3 _T_ S = Structure

n+4 to 30 Program description Descriptive, yet concise text. Use


underscores to enhance readability.

Fields/Domains/Data elements
Follow SAP naming conventions except for placing a Z in the first position.
Example: ZWERKS.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 16 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

The maximum length for table fields is 30 characters. Data Elements and Domain names
may be a maximum of 30 characters.

Table Maintenance
When creating a table maintenance view, create a new function group per table.

Message Classes
Creation of a message class or a new message should only be done if an accurate
message does not already exist in SAP. To search for a message, execute SAP
transaction SE16, choose table T100, and enter a portion of the message into the Text
field.
For example, if you are looking for a message with the word plant in it:

Naming
Example: Z_MM
Position Description Value

1 Designates Z – Customer message class for production


type of object Y – Test message class

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 17 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

2 Application
Area

New messages
Numbered 001 – 999, and the next free number should be used. Long text should be added
to all new messages to provide a course of action if the message is displayed in the
program.

Transaction Codes (TCODE)


Example: ZPLM_INV_RPT (PLM Inventory Report)
The maximum name length for transaction codes is 20.
Position Description Value

1 Designates type of Z – Customer


object program for
production Y – Test
program
2 to 20 Meaningful Descriptive, yet concise text.
transaction name Use underscores to enhance
readability.

Variants
Variants are program specific objects that define set parameters entries required at
program execution time. If the Variant is intended for use with a scheduled background
job, the Variant should be built in the DEV environment and moved to STG and PRD
with the program source.
The name of the variant should include the plant code / customer number or some text
that is self-explanatory.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 18 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Function Groups
A function group is the main program for the function modules it contains. Functions that
use the same data are normally assigned to the same function group. It is common
practice to place all function modules that use the same data in a single function group.
For example, if you have a set of function modules that all use the same internal table,
you could place them in a function group containing the table definition in its global data.
Example: ZMM1
Function Groups may be named using up to 26 characters.
Position Description Value

1 Designates type of Z – Customer program for production


object Y – Test program

2-N Functional assignment Use underscores to enhance


(freeform) readability.

Function Modules
Function modules should always reference data dictionary structures in the interfaces
for export, import, and tables. This is mandatory if the function module being created is
to be used for RFC (remote function call) interfaces.
Function Module names can be up to 30 characters.
Example: Z_MM_GET_BOM
Position Description Value

1 Designates Z – Customer program for production


type of object Y – Test program

2 Underscore To promote readability

3 to n Functional View Functional areas


Area
n+1 Underscore To promote readability

Position Description Value

n+2 to 30 Program Descriptive, yet concise text. Use


description underscores to enhance readability.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 19 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

HANA Connections
The naming standards for Stored Procedures will be SP_ (Module name)
_PROJECTNAME_FREE TEXT .
The Naming standards for views in HANA are as follows:
Attribute Views - AT_MODULENAME_FREE TEXT
Analytic View - AN_MODULENAME_FREE TEXT
Calculation Views - CA_MODULENAME_FREE TEXT
Example: Z_MM_HAN_MATERIAL_MOVEMENTS

Position Description Value

1 Z – Customer program for


Designates type of
production
object
Y – Test program
2 Underscore To promote readability

3 to n Functional Area View Functional areas

n+1 Underscore To promote readability

n+2 to n+5 Designates program HAN


using HANA
connection
n+6 Underscore To promote readability

n+7 to 40 Program description Descriptive, yet concise text. Use


underscores to enhance readability.

SAP Personas
All ABAP developments those developed to support Personas, unless otherwise stated
below should follow Jabil ABAP Development Coding Standards and Guidelines.
Function Group and Function Module naming:
Function group name should start with ZPERS and Function Module name should start
with Z_PERS.
Position Description Value

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 20 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

1 Z – Customer program for


Designates type of
production
object
Y – Test program
2 Underscore To promote readability

Position Description Value

3 to n Functional Area View Functional areas

n+1 Underscore To promote readability

n+2 to n+5 Designates program PERS


using HANA
connection
n+6 Underscore To promote readability

n+7 to 40 Program description Descriptive, yet concise text. Use


underscores to enhance readability.

ABAP Object Naming Conventions

• The following conventions are from the SAP Help Library for Class Builder.
• When naming the development objects use glossary terms instead of dictionary
terms. For example ZCL_PLANT is preferred over ZCL_WERKS.
• Use English Names.
• Since names are not case sensitive, use the underscore as a separator in the
name.
• Names should describe the action, not the implementation of the action. For
example:
PRINT_FORM is preferred over FORM_TO_SPOOL

ABAP Object Type Naming Conventions


Object Type Global Local Rule Example
Prefix Prefix

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 21 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Classes ZCL_ LCL_ Use singular ZCL_COMPANY_CODE


nouns
Interfaces ZIF_ LIF_ Use singular ZIF_STATUS_MANAGE
nouns MENT
Exception Classes ZCX_ LCX_ Use singular ZCX_STATUS_EXCEPTIO
nouns NS
Object Service ZCL_OS_ LCL_ Use singular
Classes OS_ nouns
Object Service ZIF_OS_ LIF_O Use singular
Interfaces S_ nouns
Object Service ZCX_OS_ LCX_ Use singular
Exception Classes OS_ nouns
BADI Classes ZCL_BADI_ n/a Use singular
nouns
BADI Interfaces ZIF_BADI_ n/a Use singular
nouns
BADI Exception ZCX_BADI_ n/a Use singular
Classes nouns

ABAP Object Component Naming Conventions


Component Prefix Rule Example
Methods n/a Should begin with a verb GET_STATUS
Events n/a Should have the form BUTTON_PUSHED
<noun>_<participle>
Local types within a TY Should consist of singular TY_TREE_LIST
class _ nouns
Variable attributes Avoid using verbs at the LINE_COUNT
n/a beginning of the name, in
order to avoid conflicts with
method names.
Constant attributes C_ C_MAX_LINE

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 22 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Concrete Method Description Conventions


Concrete Method Prefix Rule Example
Attribute Access SET_<attribute_name GET_ or SET_ GET_STATUS
>, must be used.
GET_<attribute_name
>
Event handler ON_<event_name> The event being ON_BUTTON_PUSHED
methods handled, must
be prefixed with
ON_, folllowed
by the event
name.
Methods that AS_<new type> Should consist of AS_STRING
perform type singular nouns
operations
Methods that IS_<adjective> These methods IS_OPEN, IS_EMPTY,
return a Boolean do IS_ACTIVE
value NOT return
exceptions.
Returned values
must be SPACE
= false and ‘X’ =
true.
Check methods CHECK_<objective> The objective CHECK_AUTHORIZATIO
should N,
consist of CHECK_PROCESS_DATE
singular
nouns.

Coding Standards
Below are the guidelines to be followed while using ABAP keywords and procedures. If
these rules are not followed while coding, it can result in risk depending on severity.

Selection Screen and Data Declaration

Severity 1

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 23 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• The parameter / select-option in the SUBMIT statement does not exist on the selection
screen of the called program. Verify that the parameters and select options match
between the SUBMIT statement and the called program selection screen.
• The parameter / select-option in the SUBMIT statement does not exist on the selection
screen of the called program. Verify that the parameters and select options match
between the SUBMIT statement and the called program selection screen.

Severity 3
• If leaving your select-options wide-open (i.e. no database selection restrictions) causes
long runtimes or times out, and is not intended to be used in that manner, add an AT
SELECTION-SCREEN check/error that at least some database selection fields have
been entered.
• Use keyword TYPE when declaring data objects rather than LIKE (which is an
old convention). LIKE should only be used when a data declaration refers to an
existing data object defined in your program. LIKE is also commonly used for
declaring the line type of an internal table i.e. LIKE LINE OF.
TYPE is a common convention found in most other modern programming
languages.
Note: In OO programming, any reference to a dictionary type MUST use the
keyword TYPE. LIKE will fail syntax check.
• Use the variable length statement STRING and XSTRING when declaring
character and byte data variables. It provides better use of memory than fixed
length text statements TYPE C and TYPE X.
• Avoid the declaration of global variables as much as possible. Avoid passing
Global to Subroutines and Methods.
Avoid setting global variables in too many places. A preferred approach to setting
global is to use dedicated recognized methods that follows best practice naming
convention such as SET_* A length declaration is required when using
offsets.
• Do not use implied defaults on data declarations. Be explicit when TYPING your
data variable. Always Specify the TYPE and Length
• Validate that the FIELDS are used in the program. It is possible that it is
referenced indirectly such as parameter passing to a procedure. If the field is not
used anywhere, remove unreferenced fields from the program.

Severity 4
• TITLEBARS should have a title defined.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 24 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Select

Severity 1

• When using "Select... For all Entries" the following rules MUST be followed: ·
Check to make sure driver ITAB is not empty · Always SORT the ITAB (driver
table) by keys.
· Specify all keys used in the WHERE clause.
· DELETE Adjacent Duplicates Comparing the keys that were sorted.
· All Primary Key Fields must be in the Select List.
· The WHERE clause must include INDEX fields to make use of index scan.
· If index fields are not available as part of the WHERE clause, then it is better
not to use FOR ALL ENTRIES. The better option would be a SELECT WHERE
into an ITAB. Any further filtering can be done using ABAP Memory.

• Select Single should provide all fields of the Primary Key. The purpose of a
select single is to retrieve a single unique row based on the unique primary key
fields(s). Without all key fields specified, there may be multiple rows that satisfy
the partial key criteria resulting in any one of the rows being returned. Therefore,
the specific record expected may not be the one returned.

• In Multi-Client production systems, regular ABAP application programs should


never select data across clients with the CLIENT SPECIFIED option since there’s
a risk with mixing data across clients / companies. Standard SAP always stays
within a client for regular application data and therefore custom code should
follow the same rule. The use of CLIENT SPECIFIED should be limited to system
tools.

• The database cursor may be lost as a result of certain call sequences that
contain COMMIT. For example, a Commit work or PERFORM inside a
SELECT/ENDSELECT is problematic.

• Dynamic token in Select statement should be avoided.

• Avoid using native SQL to ensure database independence and avoid


incompatibilities between different database tables.

Severity 2
• Avoid incomplete Select statement and errors.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 25 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• Use order by in Select statement.


• Avoid use of Select *.It leads to performance issues.
• Avoid LOOP/ENDLOOP blocks within SELECT...ENDSELECT statements. They
are very performance expensive.
• AT statement is used to perform some aggregate operations, in this if addition is
performed then SELECT with Aggregate can do the same thing

Severity 3
• When the same text literal is used repeatedly in an arithmetic or logical
expression, define the value as a Constant instead of a text literal and name the
constant descriptively. This check determines if there is hard coding contained in
the following statements: SELECT, DELETE, SORT, LOOP, WHEN, IF, READ.
• Do not create empty coding blocks inside blocks such as IF...ENDIF,
WHILE...ENDWHILE, SELECT MAX, etc. Empty coding blocks add no value and
are considered maintenance overhead.
• Select with aggregate function on buffered table.
• Avoid the use of CHECK statements after a SELECT. Instead use a WHERE
statement to filter the data.
• Avoid the use of SELECT ... INTO CORRESPONDING especially for tables with
a large number of fields. The CORRESPONDING clause results in DB overhead.
The corresponding target fields are not know until runtime and therefore need to
be rebuilt at execution. It has a negative effect on performance. Instead, specify
the individual fields required and define the work area to correspond to the fields
being selected.
• Avoid the use of buffered tables in a sub query to avoid bypassing the buffer.
• Use SELECT SINGLE with full key when accessing Single Record Buffered
Table or buffer will be bypassed.
• Consider using an inner or outer join operation within a single SELECT or use a
database view, rather than nested SELECT statements. Using the FOR ALL
ENTRIES IN option (inner join) is fast unless the number of rows is large (> 1000
approx). Be aware that specifying an empty table using the FOR ALL ENTRIES
IN option will return all records.
• AT statement is used to perform some aggregate operations, in this if addition is
performed then SELECT with Aggregate can do the same thing
• Unlinked fields in a join

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 26 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• Never use SELECT / ENDSELECT, unless doing a single select without the table
key in the where clause. Other than this case, SELECT / ENDSELECT should
never be used. SELECT.. INTO should be used instead.
SELECT matnr werks mmsta
INTO s_marc
FROM marc
UP TO 1 ROWS
WHERE werks IN so_werks.
ENDSELECT.

Loops

Severity 1

• Avoid LOOP at ITAB and then modifying by index in the loop. This can lead to
unpredictable results and performance costs. Avoid inserting new lines while
looping over an internal table. Recommendation: If you have to add new lines
inside the LOOP use APPEND to add the new line at the end of the internal
table.
• Avoid violations within loops hidden by PERFORM
• Internal tables - declare variable for loop counter
• Avoid Indirect Index Access to an Internal Table. All INSERT statements need to
be either placed within a LOOP or use a specific row INDEX. Duplicate records
for a unique internal table index will cause a program dump. For all internal table
operations make sure the system is clearly able to identify the internal table row
where the change, delete or insert needs to occur.
Severity 2
• Incorrect usage of DB ops and errors in loops.
• Avoid LOOP/ENDLOOP blocks within SELECT...ENDSELECT statements. They
are very performance expensive.
• Nested Loops can cause inefficient processing when programmed incorrectly.
Use parallel cursor technique for nested loops with standard tables. It is the most
efficient means of processing Nested Loops. The performance gains are
significant.
• Replace Updates inside a loop with a single set level process update to the
Database outside of the loop. This will reduce the trips to the Database and
improve performance.
• Avoid database accesses inside a loop to minimize performance issues.
• During LOOP Processing of an internal table, do not delete or overwrite the table
that is being looped.
Documentation Category Selective
Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 27 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• FOR BREAK LEVEL processing with the AT command inside a LOOP at ITAB,
sort by the break level fields before entering the LOOP.
Severity 3
• Nested loops can cause performance issues. This applies to any form of Nested
Loop i.e. WHILE or DO inside of a Loop or a LOOP inside of WHILE or DO. In
the case of a Loop within a Loop, explore the possibility of using a Parallel cursor
technique where checks are in place to ensure that the inner loop record exists
using READ and uses EXIT to exit inner loop when keys are different. With large
tables, the performance gains are significant.
• When using LOOP AT, ASSIGNING, MODIFY and UPDATE statements are
redundant. The Assigning is a pointer. Any changes to the row become explicit
on the row being processed so there is no need to issue the update or Modify
commands.
• Where statements should always include index fields for performance reasons,
especially for LARGE tables.
Severity 4
• Use LOOP AT ITAB and assign to a field symbol. This technique improves
performance on medium and large ITABs.
• Avoid using ON CHANGE OF statement for Break level processing.
Unpredictable results can occur with ON CHANGE OF because it is specific to a
single field whereas the AT... ENDAT triggers a break when any change occurs
in the field specified or fields left of the specified field.

Severity 5
• DO NOT LOOP an itab to retrieve a specific record when a single READ will do
the job.

Internal Tables

Severity 1

• An internal table was accessed with an invalid index


• Internal tables – declare variable for loop counter
• REFRESH/CLEAR internal tables are refreshed before using, not only at the
beginning of the program. It is preferred to refresh just before they are used
within a modular unit

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 28 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• When using the addition FOR ALL ENTRIES in ITAB, the driver table ITAB and
table fields must have the same type and length.

Severity 2
• When Processing a Standard Internal Table:
- Always use the Binary Search option i.e. READ ITAB with KEY Binary
Search.
- READ the Internal Table by Keys
- Be sure that table is sorted by same key that is used in the READ WITH
KEY statement (or data will be missed)
• During LOOP Processing of an internal table, do not delete or overwrite
the table that is being Looped.
• When sorting internal tables, always be explicit by using "SORT BY key1
? keyn", never just "SORT" on its own.
• FOR BREAK LEVEL processing with the AT command inside a LOOP at
ITAB, sort by the break level fields before entering the LOOP.
Severity 3
• Nested internal table passed by value
• Use the TRANSPORTING clause with READ and MODIFY wherever
possible to transport only the fields necessary.
• Avoid sequential access on internal tables. On large tables, this can be
costly. A sequential access will happen if internal tables have incomplete
keys or in the case of standard tables, Binary Search clause is missing.
For internal tables avoid using the obsolete version of READ TABLE ...
WITH KEY. Instead specify an appropriate UNIQUE or NON-UNIQUE
INDEX as part of the internal type definition and use READ TABLE ...
WITH TABLE KEY. Note: The addition BINARY SEARCH is still required
to avoid sequential reads when using STANDARD tables.
This rule also applies to change or delete access in internal tables, e.g.
deleting data in an internal table with a WHERE condition results in a full
scan of the internal standard table. A better solution is to define the table
as a SORTED table with a non unique (or unique) key. In the DELETE
statement use the WHERE condition in combination with WITH TABLE
KEY and the key fields. Now the access will be able to leverage the sort
sequence.
• For tables that need to be processed more than once in a program,
consider reading the database once, and storing the result in an internal
table, so that you don’t need to read the database a second time for the
same data, you read the internal table instead. For large internal tables
however, an inner/outer join may be faster.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 29 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• DELETE ADJACENT DUPLICATES should always be explicit by using the


COMPARING clause, even if there is only one field in the ITAB.

Severity 4
• Use LOOP AT ITAB and assign to a field symbol. This technique improves
performance on medium and large ITABs.
• When using Non-Numeric Index Value to delete rows from an internal
table, use the format 'DELETE ITAB FROM FS_PLAN.'

Severity 5
• Use the COLLECT statement only for hashed tables. Never for standard
and sorted tables.

IF/ENDIF, CASE, Logical Operators

Severity 1

• CASE preferred to IF (when it has more than one condition)

Severity 2
• Case Statement requires a- When Others- clause. Any condition that is
not met will have a fallout path. In the -When Others-, always provide an
action or a generic message so that the program can announce that an
unexpected situation has been encountered.
• WHEN must be the first statement after a CASE statement.
• Never duplicate a WHEN condition. Unexpected program behavior could
result with duplicated WHEN conditions.
Severity 3
• Do not create empty coding blocks inside blocks such as IF...ENDIF,
WHILE...ENDWHILE, SELECT MAX, etc. Empty coding blocks add no
value and are considered maintenance overhead.

Severity 4
• Use operators ( >=, <=, =, <>, >, <) rather than the obsolete words GE,
LE, EQ, NE, GT, LT

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 30 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• Use operators (+, -, *, /, =) rather than the obsolete words ADD,


SUBTRACT, MULTIPLY, DIVIDE, MOVE.
• Use the CASE statement rather than IF/ELSEIF/ENDIF construct when
there are multiple = conditions. If there is only one condition, then the
IF/ELSE/ENDIF statement is a good choice.

Code Analysis/Performance Check

Severity 1

• Avoid explicitly turning off the SAP Extended program check in ABAP
Code i.e. the SET EXTENDED Program Check OFF statement is not
permitted

Severity 2
• Usage of select on pool/cluster table
• Unrecommended use of secondary indexes
• Returning parameter - long field
• Parameter passed by value
• Large table should be normalized
• Incomplete table attributes Illegal buffering parameter
• Missing first field of index
• Missing index field in where
• Parallel cursor
• Avoid the use of Buffered Tables in a Join. This will cause bypass of the
buffer.
• Use a WHERE condition with appropriate indexes where possible.
• Replace Updates inside a loop with a single set level process update to
the Database outside of the loop. This will reduce the trips to the
Database and improve performance.
Severity 3
• Tables buffered in the SAP table buffer should be changed as seldom as
possible. In certain cases, local changes of a few records in a table can
Documentation Category Selective
Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 31 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

cause invalidation of the table in the buffer in other application servers.


This will result in entries no longer being current in the buffer and will
therefore have to be imported again from the database. Avoid any of the
following scenarios that will invalidate the buffer:
• - UPDATE/DELETE with a WHERE on single-record-buffered table.
• - UPDATE/DELETE dbtab, UPDATE/DELETE dbtab FROM WA and
UPDATE/DELETE dbtab FROM ITAB each invalidate only the specified
records
• - UPDATE/DELETE with a WHERE invalidates the entire table in the
buffer.
• - UPDATE/DELETE with a WHERE on generically buffered table and
generic key not fully specified. - UPDATE/DELETE with a WHERE, and
the generic key in the WHERE condition is not fully specified, all the
generic areas of the buffer are invalidated. -
INSERT/UPDATE/MODIFY/DELETE on completely buffered table. Each
change of a completely buffered table invalidates the table in the buffers
of the other application servers of the system. If the parameter "Only
'buffering switched on' " is set in the check, accesses to tables that allow
the option 'buffering' in their technical properties, but have 'switched off'
set, are not checked.
• Always specify the fields of a primary key in a single record buffered table.
• Use keys in tables to avoid bypassing the buffered table. In the case of
Generically Buffered Key Area, specify all keys that are part of the generic
buffered area as defined in the technical setting of the table.
Severity 4
• Avoid poor performing assignment of large amounts of data. This is
especially critical in the case of deep structures or large data elements.

Subroutines and Methods

Severity 1

• For Modularization and re-usability, always use methods as your first


choice over FORMS (subroutines) and function Modules. In OO context,
FORM...ENDFORM is considered obsolete.
• Check that FORM parameters are typed via the TYPE statement
• Never update system fields or pass system fields to Procedures (FORMS,
METHODS,

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 32 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Function Calls). There are some syst fields that are exempt: SY-
LSIND,
• The actual parameter category must match the formal parameter
category. This means that if a parameter is passed as a USING, it should
be received as a USING.
Severity 2
• USING parameters must match CHANGING parameters.
• Include program type attribute must be correctly set to indicate it is an
Include

Severity 3
• As a general rule, PASS BY REFERENCE should be used where possible
for performance reasons. This test examines whether it is possible to
improve the performance of a parameter transfer for a method, form,
function module, or event. However, there are programmatic reasons for
using by VALUE. i.e. in the case of a RETURNING parameters, it is
always by VALUE. Specifically, the test checks for the following situations:
· The type of the VALUE parameter contains tables whose row type in turn
contains internal tables. · The type of the VALUE parameter contains
tables with different row types. · The type of the VALUE parameter
contains strings, but no tables. · The parameter type is a flat field with a
length > 100 bytes/characters. · The type of the VALUE input parameter is
a flat field with a length <= the parameter
• Define USING parameters by VALUE. Define CHANGING and Internal
Tables by REFERENCE.
• Do not use TABLES statement when passing internal tables to FORMS.
This will result in an internal table with Header being created local to the
form. ITABS with header are obsolete.
• RETURN Statement should be used to exit a procedure (FORM, FMOD,
METHOD).
EXIT should not be used.
If a conditional statement (i.e LOOP, IF, etc. ) is in the procedure, the
programmer
can code either EXIT or RETURN depending on the desired exit
scenario i.e. is the intent to leave the conditional block or to exit the
procedure

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 33 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Authorization Checks

Severity 1

• RFC user is missing access to function group - Message contains key


data elements: User id + Function Group
• Check that tables that can be editted via SM30 are assigned to an
authorization group
• Authority check must exist for all organizational criteria using
ZLACMBASIS_AUTHORITY_CHECK include
• Database calls constructed dynamically (during runtime) can be used for
unauthorized access to database tables, particularly in situations where
the dynamic calls are constructed using USER input
• In a READ DATASET, if the file name was manipulated before the READ
DATASET statement. This can be used to access files in a directory
without proper authorization
• Missing Authority check in RFC Functions
• Missing or Insufficient Authority Check Before Call Transaction
• Editable tables (via SM30) should be assigned to an authorization group
Severity 2
• Authorization for object needs to be complete. Auth checks should use
all the fields within the auth check
• Authorization object does not exist in database.
• Authorization objects must have valid authorization fields. This rule covers
multiple scenarios. Make sure all fields defined in the SAP Authorization
object are used in the AUTHORITY-CHECK statement. Make sure that
only fields defined for the Authorization object are used in the
AUTHORITY-CHECK statement.
• Activity used in the AUTHORITY-CHECK is not valid. The Authorization
check has to use a permitted value as defined by the Authorization object
• Authority checks are needed in order to prevent potentially sensitive
information from being output by the unauthorized execution of ABAP
programs. Reports must use Standard delivered authorization objects or
Custom authorization objects where appropriate or in the case where a
Standard authorization objects is not suitable.
• All Authorization checks need to use meaningful values. 'DUMMY' and
SPACE (' ') are not considered valid values. Authority Object field
ACTIVITY needs to be checked against a numeric value
Severity 3

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 34 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• In general, authority checks should be avoided because they usually


involve hard-coding of security values. Normally, the security of the object
itself is all that is required.
• Authorization and permission access at the OS level is one of the most
frequent causes of an OPEN statement failing. Always Use the Message
clause on the OPEN statement to trap operating system errors. This
approach traps the Operating System error and therefore goes beyond the
standard subrc checking. Subrc only tells if the operation was successful
but does not give the specific reason why the operation failed. The
Message Clause reports specific application server errors such as
permissions, file existence, etc.

Data Insert / Update / Delete

Severity 1
• Under no circumstances should any program directly update SAP
delivered tables. Updating of SAP tables should be performed using pre-
delivered API's that perform the update
• Changing SAP system fields SYST is prohibited.
Severity 3
• Tables buffered in the SAP table buffer should be changed as seldom as
possible. In certain cases, local changes of a few records in a table can
cause invalidation of the table in the buffer in other application servers.
This will result in entries no longer being current in the buffer and will
therefore have to be imported again from the database. Avoid any of the
following scenarios that will invalidate the buffer: - UPDATE/DELETE with
a WHERE on single-record-buffered table. - UPDATE/DELETE dbtab,
UPDATE/DELETE dbtab FROM WA and UPDATE/DELETE dbtab FROM
ITAB each invalidate only the specified records - UPDATE/DELETE with a
WHERE invalidates the entire table in the buffer. - UPDATE/DELETE with
a WHERE on generically buffered table and generic key not fully specified.
- UPDATE/DELETE with a WHERE, and the generic key in the WHERE
condition is not fully specified, all the generic areas of the buffer are
invalidated. - INSERT/UPDATE/MODIFY/DELETE on completely buffered
table. Each change of a completely buffered table invalidates the table in
the buffers of the other application servers of the system. If the parameter
"Only 'buffering switched on' " is set in the check, accesses to tables that
allow the option 'buffering' in their technical properties, but have 'switched
off' set, are not checked.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 35 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• It is strongly recommended that all programs have a test mode parameter


(checkbox or radio button), which will run all the logic of the program
except it will not do any database updates.
• Create an update and/or insert and/or delete function module(s) that are
called in the update task to perform the updates. This ensures the entries
are logged, and could be re-applied if there was a serious system failure
and the basis team needed to rollforward from the system log after a
system restore.
• Always use lock objects (enqueue / dequeue) to secure the table entries
against concurrent updates
• When using LOOP AT ? ASSIGNING, MODIFY and UPDATE statements
are redundant. The Assigning is a pointer. Any changes to the row
become explicit on the row being processed so there is no need to issue
the update or Modify commands.
• Updates to the database should be encapsulated in V1 or V2 Update
function modules. This provides ful recovery and logging of activity when
performing INSERT, UPDATE, MODIFY and DELETE of Database tables.

ALV
All new reports should be done in the ALV format. Use Z_FI_COGS_ADJ_POSTING as
a template to creating a new ALV grid, using SALV. More program examples given by
SAP (which all start with SALV*) can be found as reference as well. There should be no
WRITE statements used in future programs. If there is a need to modify the data in the
grid then the original type of SAP classes should be used, for example
CL_GUI_ALV_GRID.
Use SAP Class / Methods instead of the older REUSE_ALV_... function modules. With
the exception of the REUSE_ALV_VARIANTXXX functions since the new class does
not give this as an option. Examples of the use of these are in the template mentioned
above.

Severity 3
• Use ABAP List Viewer instead of Classic Lists. WRITE statements and classic report
writing techniques are obsolete and should be replaced with ALV programming using the
SAP List Viewer Object model. Complete ABAP? OO programming is supported using
SALV that delivers user flexibility for output format, feature rich programming, and end
user capabilities without the need for additional programming. The area of report writing
has gone through several progressions. As a programmer you will encounter all flavors
of report programming as listed below. ? Classic List reporting using Write statements?
The first introduction of ALV with the REUSE* functions? This was then replaced with
the Class based ALV using CL_GUI_ALV_GRID? And now a complete delivery of the
ALV object model called SALV. All new report programming should use SALV* classes

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 36 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Severity 5
• List Processing Event Blocks are obsolete. All report programming should be performed
using the ALV object model. Therefore, any list processing events that are traditionally
used for controlling lists in classic programming are considered obsolete. This would
include Top-of-Page, End-of-Page, New-Page, at PF. Selection screen events are still
used to support selection screens.

Interface
IDocs
Message Types
A logical name for a packet of IDoc data being sent inbound/outbound to/from SAP R/3.
Example: ZMMFDR
Position Description Value
1 Required by SAP Z

2-3 Application area View Functional areas

4-30 Free form – meaningful

Position Description Value


acronym

Process Codes (Inbound/Outbound)


The code that identifies the process type. The process type determines which process
is used to convert and IDoc to a SAP document.
Process Code names may be up to 30 characters long.
Example: ZMMF
Position Description Value

1 Required by SAP Z

2-30 Free form – meaningful


acronym
Inbound Function Modules
Function modules that convert inbound IDocs into SAP documents/data.
Example: Z_IDOC_INPUT_ZMMFDR

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 37 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Position Description Value

1 Required by SAP Z

3-6 IDOC

8-12 INPUT

14-19 Idoc message type <message type>

Outbound Function Modules


Function modules that convert SAP documents/data into outbound IDocs
Example: Z_MASTER_IDOC_CREATE_ZMMFST
Another acceptable naming convention is Z_IDOC_OUTPUT_<message type>.
Position Description Value

1 Required by SAP Z

3-8 MASTER

10-13 IDOC

15-20 CREATE

22-27 Idoc message type <message type>

IDoc Types
SAP format that is used to interpret the data of a business transaction. An IDoc type
consists of the following components:
• A control record – It is identical for each IDoc type
• Several data records – One data record consists of a fixed key part and a variable data
part. The data part is interpreted using segments, which differ depending on the IDoc
type selected.
• Several status records – They are identical for each IDoc type and describe the
statuses an IDoc has already passed through or the status an IDoc has attained.
Example: Z_MM_FDR01
Position Description Value

1 Required by SAP Z

2 Application area View Functional areas

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 38 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

3-6 Free form – meaningful


acronym

7-8 Version number

Segments
Data record of an IDoc type.

User Defined Segments


Example: Z1FDRH1
Position Description Value

1-2 Required by SAP Z1

3-5 Free from – meaningful acronym

6 H – Header data
I – Item data

7 Hierarchical level of header or 1-9


item
Referencing SAP Segments
Example: Z1EDP16

Position Description Value

1-2 Required by SAP Z1

3-7 SAP Segment Name

Inline Declarations

Use inline declaration for omitting data type declaration. The operand type of write positions
is statically fixed and well known to the compiler, hence data type declaration can be
omitted.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 39 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Note: Only use inline declaration locally in the current


statement block.
Do not access the variable declared inline dynamically
before the declaration.

OLD NEW
DATA lv_var TYPE string. DATA(lv_var) = 'Hello World'.
lv_var = 'Hello World'.
DATA lv_tabix TYPE i. DATA(lv_tabix) = lines( lt_itab ).
lv_tabix = lines( lt_itab ).
DATA lt_scarr TYPE STANDARD TABLE OF SELECT * FROM scarr INTO TABLE @DATA(lt
scarr. _scarr).
SELECT * FROM scarr INTO TABLE lt_scarr.
FIELD- LOOP AT lt_scarr ASSIGNING FIELD-
SYMBOLS <fs_scarr> LIKE LINE OF lt_scarr SYMBOL(<fs_scarr>).
. ...
LOOP AT lt_scarr ASSIGNING <fs_scarr>. ENDLOOP
...
ENDLOOP.
DATA lv1 TYPE … lv_oref->meth( IMPORTING
DATA lv2 TYPE … e1 = DATA(lv1)
e2 = DATA(lv2)
lv_oref->meth( IMPORTING …
e1 = lv1 ).
e2 = lv2

).

Inline data declaration only works with table type with explicit key otherwise syntax error “A
value of the generic type <table type> cannot be constructed” will occur. If one doesn’t care
about the key, addition: “DEFAULT KEY” or “EMPTY KEY” can be used.

Note: Using the default key – either by chance or explicitly –


is almost always critical.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 40 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 41 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

OLD NEW
TYPES ty_itab TYPE STANDARD TABLE O TYPES ty_itab TYPE STANDARD TABLE OF st
F string. ring WITH DEFAULT KEY.
DATA lt_itab TYPE ty_itab. DATA(lt_itab) = VALUE ty_itab( ( |Hello| ) ( |Worl
APPEND 'Hello' TO lt_itab. d| ) ).
APPEND 'World' TO lt_itab.

Constructor Expressions

… operator type ( … ) …

operator is a constructor operator, use constructor expression to create a result at operand


position, ie: NEW|VALUE|CONV|CORRESPONDING|CAST|REF|EXACT|REDUCE|FILTER
|COND|SWITCH

Type is either the explicit data type or the character #. Use character # if data type at
operand position is unique and fully identifiable

Instance Operator

Use NEW operator to create an object or anonymous data object. It functions like a
statement CREATE OBJECT … TYPE ….

OLD NEW
FIELD-SYMBOLS <fs_date> TYPE data. DATA lv_dref TYPE REF TO data.
DATA lv_dref TYPE REF TO data. lv_dref = NEW datum( sy-datum ).

CREATE DATA lv_dref TYPE datum.


ASSIGN lv_dref->* TO <fs_date>.
<fs_date> = sy-datum.
DATA lv_oref TYPE REF TO cl_abap_datfm. DATA lv_oref TYPE REF TO cl_abap_datf
CREATE OBJECT lv_oref TYPE cl_abap_da m.
tfm. lv_oref = NEW #( ).

Or

DATA(lv_oref) = NEW cl_abap_datfm( ).

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 42 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Value Operators

Use VALUE operator to create a result of a data type specified by type or at operand data
type.

Note: Do NOT use VALUE operator to construct value for


elementary data type. Ie:
DATA(lv_datum) = VALUE syst_datum( sy-datum ).

OLD NEW
DATA lv_scarr TYPE scarr. DATA(lv_scarr) = VALUE scarr( carrid = 'AA'
lv_scarr-carrid = 'AA'. carrname = 'American Airlines'currcode = 'US
lv_scarr-carrname = 'American Airlines'. D' ).
lv_scarr-currcode = 'USD'.
DATA: DATA lt_r_carrid TYPE RANGE OF scarr-
lt_r_carrid TYPE RANGE OF scarr-carrid, carrid.
lv_carrid LIKE LINE OF lt_r_carrid. lt_r_carrid = VALUE #( ( sign = 'I' option = 'B
lv_carrid-sign = 'I'. T' low = 'AA' high = 'BA' )
lv_carrid-option = 'EQ'. ( sign = 'I' option = 'EQ' low = '
lv_carrid-low = 'AA'. UA' ) ).
APPEND lv_carrid TO lt_r_carrid.
lv_carrid-low = 'UA'. Or
APPEND lv_carrid TO lt_r_carrid.
DATA lt_r_carrid TYPE RANGE OF scarr-
carrid.
lt_r_carrid = VALUE #( sign = 'I' ( option =
'BT' low = 'AA' high = 'BA' )
( option = 'EQ' low = 'UA' ) ).

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 43 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Conversion Operators

Use CONV operator to convert value into a data type specified by type or at operand data
type. CONV closes the gap where VALUE cannot be used to construct value for elementary
data type.

Note: Use CONV to avoid declaring helper variable in order


to achieve specific data type.

OLD NEW
DATA lv_text TYPE char255. DATA lv_text TYPE char255.
DATA lv_helper TYPE string. DATA lv_xstr TYPE xstring.
DATA lv_xstr TYPE xstring.
lv_xstr = cl_bcs_convert=>string_to_xstring
lv_helper = lv_text. ( CONV #( lv_text ) ).

lv_xstr = cl_bcs_convert=>string_to_xstring
( lv_helper ).

Corresponding Operators

Use CORRESPONDING operator to assign component(s) using identical names or


mapping rules to populate structure or internal table of the specified data type.

Note:
• Whenever needed, use BASE addition to specify a
start value of the target structure or internal table
before the CORRESPONDING operator is evaluated.
• When CORRESPONDING is used by comparing two
internal tables, the second internal table has should
be sorted table or hashed table.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 44 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

OLD NEW
... ...
MOVE- lv_struct_2 = CORRESPONDING #( BASE (
CORRESPONDING lv_struct_1 TO lv_struct lv_struct_2 ) lv_struct_1 ).
_2. ...
... lt_itab_2 = CORRESPONDING #( lt_itab_1 )
MOVE- .
CORRESPONDING lt_itab_1 TO lt_itab_2.
... ...
TYPES ty_t_source TYPE STANDARD TABL TYPES ty_t_source TYPE STANDARD TAB
E OF ty_source WITH NON- LE OF ty_source WITH NON-
UNIQUE SORTED KEY mkey COMPONENT UNIQUE SORTED KEY mkey COMPONEN
S s1 s2. TS s1 s2.
DATA lt_source TYPE ty_t_source. DATA lt_source TYPE ty_t_source.
... ...
LOOP AT lt_target ASSIGNING <fs_target>. lt_target =
READ TABLE lt_source WITH TABLE KEY CORRESPONDING #(
mkey lt_target FROM lt_source
COMPONENTS s1 = <fs_target>- USING KEY mkey
t1 s2 = <fs_target>-t2 s1 = t1 s2 = t2
ASSIGNING <fs_source>. MAPPING
IF sy-subrc = 0. t3 = s3
<fs_target>-t3 = <fs_source>-s3. EXCEPT * ).
ENDIF.
ENDLOOP.

Casting Operators

Use CAST operator to perform up-cast or down-cast for an object inside the parentheses.

OLD NEW
DATA lv_oref_structdesc TYPE REF TO cl_a DATA lv_components TYPE abap_compdesc
bap_structdescr. r_tab.
DATA lv_components TYPE abap_compdesc lv_components = CAST cl_abap_structdescr(
r_tab. cl_abap_typedescr=>describe_by_name( 'S
lv_oref_structdesc ?= cl_abap_typedescr=>d CARR' ) )->components.
escribe_by_name( 'SCARR' ).
lv_components = lv_oref_structdesc-
>components.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 45 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Reference Operators

Use REF operator to construct data reference variable at operand position. It functions like
the statement GET REFERENCE.

OLD NEW
DATA: DATA:
lv_oref_sql lv_oref_sql TYPE REF TO cl_sql_statem
TYPE REF TO cl_sql_statement, ent,
lv_oref_result TYPE REF TO cl_sql_resul lv_oref_result TYPE REF TO cl_sql_resul
t_set, t_set,
lv_statement TYPE string, lv_statement TYPE string,
lt_result TYPE STANDARD TABLE OF sc lt_result TYPE STANDARD TABLE OF
arr WITH DEFAULT KEY, scarr WITH DEFAULT KEY.
lv_oref_output TYPE REF TO data. …
… lv_oref_result = lv_oref_sql-
lv_oref_result = lv_oref_sql- >execute_query( lv_statement ).
>execute_query( lv_statement ). lv_oref_result-
GET REFERENCE OF lt_result INTO lv_ >set_param_table( REF #( lt_result ) ).
oref_output. …
lv_oref_result-
>set_param_table( lv_oref_output ).

Lossless Operator

Use EXACT operator to execute either a lossless calculation or a lossless assignment. If


data is lost, the corresponding exception is raised.

Note: Always use exception class


CX_SY_CONVERSION_EXACT_NOT_SUP together with
EXACT operator.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 46 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

OLD NEW
DATA: TRY.
lv_exact_result TYPE decfloat34, DATA(lv_exact_result) = EXACT decfloat34
lv_rounded_result TYPE string, ( 5 / 3 ).
lv_exc TYPE REF TO cx_sy_conversio CATCH cx_sy_conversion_rounding INTO D
n_rounding. ATA(lv_exc).
TRY. DATA(lv_rounded_result) = lv_exc->value.
COMPUTE EXACT lv_exact_result = CATCH cx_sy_conversion_exact_not_sup.
5 / 3. ENDTRY.
CATCH cx_sy_conversion_rounding IN
TO lv_exc.
lv_rounded_result = lv_exc->value.
ENDTRY.

Reduction Operator

Use REDUCE as iteration expression to reduce a set of data object to: single data object or
summarized data object.

OLD NEW
... ...
DATA lv_tot_seat TYPE s_seatsocc. DATA(lv_tot_seat) =
LOOP AT lt_sflight ASSIGNING <fs_sflight> REDUCE s_seatsocc(
WHERE carrid = 'AA' . INIT seat = 0
lv_tot_seat = lv_tot_seat + <fs_sflight>- FOR ls_sflight IN lt_sflight
seatsocc. WHERE ( carrid = 'AA' )
ENDLOOP. NEXT seat = seat + ls_sflight-seatsocc
).
... ...
TYPES: TYPES:
BEGIN OF ty_summary, BEGIN OF ty_summary,
carrid TYPE sflight-carrid, carrid TYPE sflight-carrid,
connid TYPE sflight-connid, connid TYPE sflight-connid,
seatsocc TYPE sflight-seatsocc, seatsocc TYPE sflight-seatsocc,
END OF ty_summary, END OF ty_summary,
ty_t_summary TYPE STANDARD TABLE ty_t_summary TYPE STANDARD TABLE O
OF ty_summary WITH DEFAULT KEY. F ty_summary WITH DEFAULT KEY.

DATA lt_summary TYPE ty_t_summary. DATA lt_summary TYPE ty_t_summary.


DATA ls_summary LIKE LINE OF lt_summar
y. lt_summary =
REDUCE #(

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 47 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

FIELD- INIT lt_temp = VALUE #( )


SYMBOLS <fs_sflight> LIKE LINE OF lt_sfli FOR GROUPS <fs_group> OF ls_sflight IN
ght. lt_sflight
GROUP BY (
SORT lt_sflight BY carrid connid. carrier = ls_sflight-carrid
flight = ls_sflight-connid ) ASCENDING
LOOP AT lt_sflight ASSIGNING <fs_sflight>. LET
ls_summary-carrid = <fs_sflight>-carrid. lv_tot_seat =
ls_summary-connid = <fs_sflight>-connid. REDUCE sflight-seatsocc(
ls_summary-seatsocc = ls_summary- INIT lv_total = 0
seatsocc + <fs_sflight>-seatsocc. FOR <fs_sflight> IN GROUP <fs_group
AT END OF connid. >
APPEND ls_summary TO lt_summary. NEXT lv_total = lv_total + <fs_sflight>-
CLEAR ls_summary. seatsocc )
ENDAT. lt_members =
ENDLOOP. VALUE ty_t_summary(
BASE lt_members
( carrid = <fs_group>-carrier
connid = <fs_group>-flight
seatsocc = lv_tot_seat ) )
IN
NEXT lt_temp = lt_members
).

Filter Operator

Use FILTER operator to retrieve a subset of data in a new internal table from an existing
internal table based on the where condition specified.
FILTER with EXCEPT keyword can be used as a variant for table filter which works like ‘for
all entries’.

Note: As a prerequisite, the iterated table must have a


sorted or a hash key (primary or secondary), that is
evaluated behind the WHERE clause.

OLD NEW
LOOP AT lt_all_sflights ASSIGNING DATA( lt_sflight_lh ) = FILTER #( lt_all_sflights
<fs_flight> WHERE carrid = 'LH'. USING KEY carrid WHERE carrid = 'LH' ).
APPEND <fs_flight> TO lt_flight_lh.
Or (with EXCEPT variant)

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 48 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

CLEAR: <fs_flight>.
ENDLOOP. DATA(lt_no_lh) = FILTER #( lt_all_sflights
EXCEPT WHERE carrid = 'LH' ).

Conditional Operator

Use COND and SWITCH operator to construct a result of a data type specified by type or at
operand data type based on logical expressions inside the parentheses.

Note: Use THROW operator if exception is needed. It can


be placed after THEN and ELSE.

OLD NEW
DATA lv_format TYPE string. DATA(lv_format) =
CASE lv_dnot. COND string(
WHEN 'X'. WHEN lv_dnot = 'X'
lv_format = 'z,zzz,zzz.zz'. THEN 'z,zzz,zzz.zz'
WHEN 'Y'. WHEN lv_dnot = 'Y'
lv_format = 'z zzz zzz,zz'. THEN 'z zzz zzz,zz'
WHEN ''. WHEN lv_dnot = ''
lv_format = 'z.zzz.zzz,zz'. THEN 'z.zzz.zzz,zz'
WHEN OTHERS. ELSE
MESSAGE 'Format is not supported' TYP THROW cx_rs_format_not_supported( )
E 'E'. ).
ENDCASE.
DATA lv_format TYPE string. DATA(lv_format) =
CASE lv_dformat. SWITCH string( lv_dformat
WHEN '1'. WHEN '1'
lv_format = 'DD.MM.YYYY'. THEN 'DD.MM.YYYY'
WHEN '2'. WHEN '2'
lv_format = 'MM/DD/YYYY'. THEN 'MM/DD/YYYY'
WHEN '3'. WHEN '3'
lv_format = 'MM-DD-YYYY'. THEN 'MM-DD-YYYY'
WHEN OTHERS. ELSE
MESSAGE 'Format is not supported' TYP THROW cx_rs_format_not_supported( )
E 'E'. ).
ENDCASE.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 49 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Sub Expressions

FOR Operator

Use FOR operator as sub expression in specific main constructor expression (NEW, VALUE
and REDUCE) to perform an iteration.

Note:
• FOR with addition UNTIL or WHILE can replace
statement DO and WHILE to create conditional
iteration.
• FOR with addition IN can replace statement LOOP to
create table iteration.

OLD NEW
DATA lt_itab TYPE STANDARD TABLE OF DATA lt_itab TYPE STANDARD TABLE OF i.
i.
DATA lv_count TYPE i VALUE 11. lt_itab = VALUE #( FOR n = 11 THEN n + 10
WHILE n < 40 ( n ) ).
WHILE lv_count < 40.
APPEND lv_count TO lt_itab. Or
lv_count = lv_count + 10.
ENDWHILE. lt_itab = VALUE #( FOR n = 11 THEN n + 10
UNTIL n > 40 ( n ) ).
... ...
DATA lv_tot_seat TYPE s_seatsocc. DATA(lv_tot_seat) =
LOOP AT lt_sflight ASSIGNING <fs_sflight> REDUCE s_seatsocc(
WHERE carrid = 'AA' . INIT lv_seat = 0
lv_tot_seat = lv_tot_seat + <fs_sflight>- FOR ls_sflight IN lt_sflight
seatsocc. WHERE ( carrid = 'AA' )
ENDLOOP. NEXT lv_seat = seat + ls_sflight-seatsocc
).

LET Operator

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 50 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Use LET expression as sub expression in main constructor expression to construct auxiliary
field (helper variable) for holding data at runtime and to be used in main constructor
expression.

OLD NEW
... ...
DATA lt_scarr TYPE STANDARD TABLE O DATA lt_scarr TYPE STANDARD TABLE OF s
F scarr carr
WITH NON-UNIQUE WITH NON-UNIQUE
SORTED KEY id SORTED KEY id
COMPONENTS carrid. COMPONENTS carrid.
... ...
LOOP AT lt_sflight ASSIGNING <fs_sflight lt_itab =
>. VALUE #(
APPEND INITIAL LINE TO lt_itab ASSIG FOR ls_sflight IN lt_sflight
NING <fs_itab>. LET lv_airlines =
IF sy-subrc = 0. VALUE #(
<fs_itab>-carrid = <fs_sflight>-carrid. lt_scarr[
<fs_itab>-connid = <fs_sflight>-connid. KEY id
<fs_itab>-fldate = <fs_sflight>-fldate. COMPONENTS
READ TABLE lt_scarr WITH TABLE KEY carrid = ls_sflight-carrid
id ]-carrname OPTIONAL )
COMPONENTS carrid = <fs_sflight>- IN
carrid ( VALUE #(
ASSIGNING <fs_scarr>. BASE CORRESPONDING #( ls_sflight )
IF sy-subrc = 0. carrname = lv_airlines )
<fs_itab>-carrname = <fs_scarr>- ) ).
carrname.
ENDIF.
ENDIF.
ENDLOOP.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 51 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Table Expressions

Use ... itab[ ... ] to find row in question and returns it as the result at result position data type
or at operand data type. It can be used as an argument of the table function.

If the row in question is not found, a class exception CX_SY_ITAB_LINE_NOT_FOUND is


raised, except:
• when used with addition OPTIONAL or DEFAULT,
• when used in ASSIGN, where system field sy-subrc is set to 4,
• when used in table function line_exists, where “false” is returned,
• when used in table function line_index, where value 0 is returned.

OLD NEW
DATA lv_flight TYPE spfli. TRY.
READ TABLE lt_flight INDEX 1 INTO lv_flight. DATA(lv_flight) = lt_flight[ 1 ].
IF sy-subrc = 4. CATCH cx_sy_itab_line_not_found.
... ...
ENDIF. ENDTRY.

Or

DATA(lv_flight) = VALUE #( lt_flight[ 1 ] OPTION


AL ).

DATA lv_flight TYPE spfli. TRY.


READ TABLE lt_flight INDEX 1 USING KEY nd_k DATA(lv_flight) = lt_flight[ KEY nd_key INDEX
ey INTO lv_flight. 1 ].
IF sy-subrc = 4. CATCH cx_sy_itab_line_not_found.
... ...
ENDIF. ENDTRY.
DATA lv_flight TYPE spfli. TRY.
READ TABLE lt_flight WITH KEY carrid = 'AA' co DATA(lv_flight) = lt_flight[ carrid = 'AA' connid
nnid = '64' INTO lv_flight. = '64' ].
IF sy-subrc = 4. CATCH cx_sy_itab_line_not_found.
.... ...
ENDIF. ENDTRY.

Or

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 52 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

DATA ls_flight TYPE sflight.


...
DATA(lv_flight) =
VALUE #( lt_flight[
carrid = 'AA' connid = '64'
] DEFAULT ls_flight ).

DATA lv_flight TYPE spfli. TRY.


READ TABLE lt_flight WITH TABLE KEY nd_key DATA(lv_flight) = lt_flight[ KEY nd_key cityfro
COMPONENTS cityfrom = 'SAN FRANCISCO' cit m = 'SAN FRANCISCO' cityto = 'NEW YORK' ].
yto = 'NEW YORK' INTO lv_flight. CATCH cx_sy_itab_line_not_found.
IF sy-subrc = 4. ...
.... ENDTRY.
ENDIF.

Table Functions

Line Existence
line_exists checks the existence of the row in question. It returns “truth” or “false” as result.
Note: It does not fill the system fields ie: sy-tabix and sy-subrc.

OLD NEW
READ TABLE lt_flight INDEX 1 TRANSPORTING IF line_exists( lt_flight[ 1 ] ).
NO FIELDS. ...
IF sy-subrc = 0. ENDIF.
...
ENDIF.

Line Index
line_index returns the number of row found of the row in question. If it is not found, no
exception is raised, value 0 is returned instead.
Note: It does not fill the system fields ie: sy-tabix, and sy-subrc.

OLD NEW
DATA lv_idx TYPE sy-tabix. DATA(lv_idx) = line_index( lt_flight[ carrid = 'AA' ] ).
READ TABLE lt_flight WITH KEY carrid = 'A
A' TRANSPORTING NO FIELDS.
lv_idx = sy-tabix.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 53 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

String Expression

String expression chains two or more operands to create character string. String expression
consists of string operator or string template.

String Operator

Use string operator && to concatenate two or more operand in a string expression.

DATA lv_text TYPE string VALUE 'Hello'.


lv_text = lv_text && ' ' && 'world' && |!|.

String Template

String template is enclosed by two characters | within the same line to create character
string.

Use operator && or & to join multiple string template.


DATA lv_text TYPE string.
lv_text = |Hello| &
|| &
|World| &
|!|.

Use prefix \ as escape character to display special character |, {, } or \ in the output.

DATA lv_text TYPE string.


lv_text = |Characters \|, \{, and \} have to be escaped by \\ in literal text.|.

Use control characters: \n, \r and \t to display line break, return and tabulator in the output.
lv_text TYPE string.
lv_text = |First line.\r\ttab\ttab\n\ttab\ttab\rLast line.|.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 54 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Use embedded expression { … } within string template. Depends on the effect, some can be
used together.

DATA lv_text TYPE string.


lv_text = |{ ( -10000 / 3 ) SIGN = LEFT DECIMALS = 3 ZERO = YES COUNTRY = 'US ' }|.

lv_text = |{ 'Hello World' WIDTH = 20 ALIGN = CENTER CASE = UPPER PAD = '*' }|.

Below are the predefined format of embedded expressions and the effects

Predefined format Effect


WIDTH = len defines the length of the string displayed
based on the value of len.
ALIGN = LEFT | RIGHT | CENTER defines the alignment of the string.
PAD = c defines the character used to pad any excess
places in the result.
CASE = RAW | UPPER | LOWER defines the case of the string.
SIGN = LEFT | RIGHT | LEFTPLUS | defines the format of the +/- sign in string
RIGHTPLUS | LEFTSPACE | LEFTSPACE
EXPONENT = exp defines exponent as the value of exp when
formatting floating point numbers.
DECIMALS = dec defines the number of decimal places as the
value of dec.
ZERO = YES | NO defines the format of the numeric value zero.
XSD = YES | NO formats the value of the embedded
expression in the axXML format.
STYLE = SIMPLE | SIGN_AS_POSTFIX | defines the style of decimal floating point
SCALE_PRESERVING | SCIENTIFIC numbers.
CURRENCY = cur defines the number of decimal places when
formatting numeric values.
NUMBER = RAW | USER | ENVIRONMENT defines the format of the decimal and
thousand separators.
ALPHA = IN | OUT | RAW adds leading zeroes to numeric sequences or
removes them.
DATE = RAW | ISO | USER | defines the format of a date.
ENVIRONMENT
TIME = RAW | ISO | USER | ENVIRONMENT defines the format of a time.
TIMESTAMP = SPACE | ISO | USER | defines the format of a time stamp.
ENVIRONMENT
TIMEZONE = tz converts the date and time information of a
time stamp to the local date and the local
time of the specified time zone.
COUNTRY = cty defines a temporary formatting setting for
NUMBER, DATE, TIME, and TIMESTAMP.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 55 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Function Modules

Function Modules and Function Groups

Severity 1

• The EXCEPTIONS clause is ignored for asynchronous update function modules.


Clean up the function by removing the superfluous Exceptions.
• For Modularization and re-usability, always use methods as your first choice over
FORMS (subroutines) and function Modules. In OO context, FORM...ENDFORM
is considered obsolete.
• Illegal use of function module
• All components of a Function Group must pass internal consistency check. If the
consistency check error occurs, it is possible that some internal objects have
been corrupted. This can result in the function module not being stored in the
database table TFDIR or possibly stored under a different name.
• RAISE statements should only be used in FUNCTION groups.
Severity 2
• Unreleased function modules shouldn’t used.
• There may be cases where SAP delivered functions do not have defined
exceptions. It is still recommended to provide exception handling when Calling
the function. This enables that the code still works without a run-time error in the
event that SAP adds an exception to the Function Module interface. For example
the application of an OSS Note is able to introduce a new exception for the
function module. Setting all exceptions to 0 in the CALL FUNCTION statement is
not a good practice because it basically ignores the exceptions.
The programmer should always check the exception returned from a function.
DO NOT not count on an importing parameter being returned to the calling
program as a sign of successful execution. An assumption holds true that a field
is not set if an exception is returned, but that could change during a future
enhancement of the function.
Exception: Excluded from this rule are system functions that don't return any
exceptions, i.e. function module DEQUEUE. For these system functions that do
not have defined exceptions, it does not make sense to check for SY-SUBRC
after the function call.
Note: Customer defined functions should always have Exceptions defined.
Recommendation:
==> If a function module has exceptions defined, you have to handle them. An
empty IF statement is not enough

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 56 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

==> If a function module has no exception defined, CodeExcellence


recommends using
 EXCEPTION OTHERS = 1 and handle the exception

==> If a function module has no exception defined, and the programmer is


not using  EXCEPTION OTHERS = 1 you can't check sy-subrc after the
function module call since the sysubrc will not be set by the function call
• Using Obsolete Function Modules should be avoided. It will cause upgrade
issues as they are not forward compatible or supported by SAP?.
• Function Module must be assigned as a component of a CMOD enhancement.
Severity 3
• When calling a function, always include the exceptions clause. There is no value
in checking sysubrc if the exceptions clause is not part of the CALL Function
statement. Don't add an empty IF SY-SUBRC = 0 ... ENDIF block or a CHECK
SY-SUBRC = 0 after a function call without exceptions. A function should be
defined with exceptions unless it is a special purpose function such as update
task, asynchronous, RFC, etc.
• Generic Messaging after a function call is not recommended. Anytime the
PATTERN function in the workbench is used to insert a function, it automatically
inserts a generic message of the form:
"MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1
sy-msgv2, sy-msgv3, sy-msgv4?.
This statement assumes that SY variables have been filled with meaningful
values by the function itself. However, often times, this is not the case and the
message will be meaningless. The generic message should only be used in the
case where the function and all nested functions that are called use the
Message...Raising format consistently throughout the function chain. The
Message...Raising format sets the sy-message and other sy variables. Only
then, can you be assured that a generic message statement can be used to
present a proper error message. However, since this situation is most likely not
the case, a good developer will handle the message themselves and not count
on the generic format to provide a meaningful message relevant to the situation.
• Always check the results of your BAPI call. If successful, and the BAPI does
updates, always call
BAPI_COMMIT_WORK. If unsuccessful and the BAPI does updates, always call
BAPI_TRANSACTION_ROLLBACK, and communicate to user/system than an
error has occurred. Best practice is to provide as much information about the
error as possible to the user or interfaced system.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 57 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Batch Data Communications (BDC)

BDCs are very performance intensive and all measures should be taken to NOT
create BDCs unless absolutely necessary. First check for an existing BAPI and if
it does not exist, check for new BAPIs on OSS (possible to add them to our
current system).
Batch data input sessions should be limited to approx. 250 @actions per BDC
group. This number can vary greatly depending on the quality of the data being
processed. Large batch ABAP programs are to be avoided due to the single-
threaded nature of the batch environment. These programs are to be broken up
into smaller batch programs, where appropriate.
Utilize transaction code SHDB to record an R/3 transaction and generate a
program skeleton contains all screen and field information in the required BDC
format. Replace the field entries you wish to convert as variables and add the
necessary file handling logic to the generated program.
Note:
BDC technology relies on screen layouts. If a screen layout changes, the code
stops working. This makes the code highly unreliable during the application of
Support Packs, Enhancement Packs and Upgrades. Therefore programs need to
use BAPIs to submit business functions. - Submitting database operations
directly from ABAP by calling database functions directly (e.g.
'DB_COMMIT"). Any use of these functions introduces a high risk of transaction
inconsistencies and needs to be avoided.

Customer Enhancement (user exits)

• When creating a new user exit, always create a new INCLUDE for your specific
task, unless this is a BADI implementation. This will keep the code separate
from other developers and will allow changes for multiple projects.
• Verify the version you are working on is the same as the version in production. If
not work with other developer who is working on the user exit to make sure these
will move to production in the proper order, without overwriting one another’s
code.
• Do not use CALL TRANSACTION, COMMIT WORK, CHECK, EXIT statements
or add any new popup windows within a user exit. Any of these statements can

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 58 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

have adverse effects. If you must call a function or transaction that will do a
COMMIT WORK, call it in a SEPARATE TASK so it does not have any negative
effect on the current transaction.
Example: change is needed in MV45AFZZ, find the place you need the code
and insert the following code (named according to your project) and make all
changes within the include:
INCLUDE z_sd_mv45afzz_2225_gof.
Note: Be certain to not use EXIT statements in this new INCLUDE,
because if there are multiple INCLUDES after yours they may not get
executed.

CMOD / SMOD
Transaction SMOD is used to view SAP Enhancements. CMOD is used to implement
an enhancement into a project.

BADI
Note: To see what BADIs are called for any given transaction, go to
se37 and put a break-point within the function
SXV_GET_CLIF_BY_NAME. View the name field when the break-
point is hit – this will give you all BADIs which are executed.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 59 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

SAP has implemented numerous areas where custom development can be placed
using BADIs. When possible, the development team should attempt to implement a
BADI rather than a CMOD or basic user exit because there can be multiple
implantations of these without any issues.
To view BADIs available through transaction se18; to create a BADI use transaction
se19.

VOFM
The VOFM transaction is used for Requirement and Formulas. The functional analyst
should tell you the menu path and the original requirement to copy from. For example
the requirement may be for a new Scale Based formula, the functional spec should
specify to follow the menu path:

The functional spec should also state which is the source:

The developer should create a new routing (by entering a 3 digit number starting with 9,
when double clicking on the new routine number, the developer will be asked for an
object access code. The developer should screen print this and send the request to
your development manager (along with the PR / SR and description of use). The
development manager will approve it and send the request to the IT BSG Netweaver
team to get the access code. Once this has been received, the developer can then
copy the code from the original routine into the new routine and make required changes.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 60 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Dialog Programming

If your ABAP program demands user input, Dialog programming is used.


A user dialog is any form of interaction between the user and the program and could be
any of the following:

• Entering data
• Choosing a menu item
• Clicking a button
• Clicking or double clicking an entry
Position Description Value

1–3 Always SAP


contains
this static
value ->
4 Module M – Screen module pool
pool type D – Dialog module pool
U – Update module pool
F – Subroutine module pool

5 Designation Z – Customer module pool

6 Application View Functional areas


area

7-8 User
defined;
should be
meaning
full for the
application

PF-Status
PF Status is a custom status bar defined to be used by a screen, or interactive program
to enable user actions. The standard SAP format must be used. The table below

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 61 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

defines the usage of standard function keys. These function keys do not have to be
enabled but when used, must comply- with the standards defined in this section.
These function keys are not to be replaced by user-defined keys.
PF Key OK-CODE Description

01 HELP Display help screen for current field

02 SELE Select entry (same as double-


click)
03 BACK Exit current transaction.
Overrides mandatory entries

04 LIST List Possible Entries

09 MARK Select

10 Menu bar

11 SAVE Save entries

12 CANCEL Cancel current request,


Mandatory entries override

13 PRINT Print

14 DELETE Delete

15 EXIT Exit (Fast EDIT) leave


transaction. Same as PF03

21 TOP First page of document

22 PAGE_UP Previous page

23 PAGE_DOWN Next page

24 BOTTOM Last page of document

Include programs
Position Description Value

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 62 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

1–5 Same as
positions 4-8
in Module pool
name
6–8 Object name TOP – Data declarations
Onn – PBO modules (nn = 01 – 99)
Inn – PAI modules (nn = 01 – 99)
Fnn – Forms (subroutines) (nn = 01
– 99)

Screen painter
SAP screens are referred to as dynpros. Standard SAP components, such as
transactions, menus and tables contain dynpros and the associated processing logic. A
developer may also create customized dynpros.
The identification of a screen painter dynpro consists of an ABAP program name and a
four-digit dynpro number. The number range reserved for custom dynpros should be
between 9000-9999. The initial screen number for a given transaction should be 9000
and additional screen numbers increment by 10. Example: Module Pool: SAPMZF01
Screen #: 9000

Flow logic

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 63 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

***************************************************************
Process Before Output.
module SET_STATUS. " Called by all screens

*Enter screen specific modules here i.e. dynamic screen *locking, etc.

***************************************************************
Process After Input.
* Process fast-exit commands
module PAI_EXIT AT EXIT-COMMAND. “Called by all screens

* Save OK-CODE pressed

module PAI_INITIALIZE. " Called by all screens *

* Enter screen specific modules here i.e. Field checks, Loops, * Table
Controls etc.

* Process user command ( OK-CODE ) after all checks completed.


Module USER_COMMAND.

Modules

Process before output (PBO)


**INCLUDE MZxxxOO 1 .
***************************************************************
* Module SET_STATUS OUTPUT
***************************************************************
* <descriptive text>
***************************************************************
MODULE SET_STATUS OUTPUT.
CASE SY-DYNNR. " Interrogate screen number
number. WHEN ‘0100’. “Screen description of
screen 100 SET PF-STATUS ‘100MAIN’.
SET TITLEBAR ‘100’.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 64 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

WHEN ‘0200’. “ Screen description for screen 200


SET PF-STATUS ‘200MAIN’.
SET TITLEBAR ‘200’.
WHEN OTHERS.
* ... Add any subsequent screens
ENDCASE.
ENDMODULE. “ SET-STATUS OUTPUT

Process after input

************************************************************
* Module PAI_INPUT INPUT
************************************************************
* <descriptive text>
************************************************************ MODULE
PAI_INPUT INPUT.
CASE SY-DYNNR. " Interrogate screen number
WHEN ‘0100’. "Screen 0100
SET SCREEN 0.
LEAVE SCREEN.
WHEN ‘0200’. "Screen 0200
* First process any de-queuing of entries, pop-ups to confirm data loss, etc.
CASE SY-UCOMM. " Interrogate system field to find out which fast
exit pressed
WHEN ‘RW’.
SET SCREEN 0.
WHEN OTHERS.
SET SCREEN 0100.
ENDCASE
LEAVE SCREEN.
*... Add any subsequent screens
ENDCASE.

ENDMODULE. “ PAI_INPUT INPUT


************************************************************ *
Module PAI_INITIALIZE INPUT
************************************************************
* <descriptive text>
************************************************************
MODULE PAI-INITIALIZE INPUT.
* set new ok code.
SAVE_OK= OK_CODE.
* clear ok code.
CLEAR OK_CODE.
ENDMODULE. “ PAI_INITIALIZE

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 65 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

INPUT
************************************************************
* Module USER_COMMAND INPUT
************************************************************
* <descriptive text>
************************************************************
MODULE USER_COMMAND INPUT.

CASE SY-DYNNR. " Interrogate Screen number


WHEN ‘0100’. " Screen 100 ( enter description )
PERFORM PROCESS_0100_OK_CODES. “(Form routine to
process OK
“codes
WHEN ‘0200’. " Screen 200 (enter description)
PERFORM PROCESS-0200-OK-CODES. “(Form routine to
process OK

“codes
*... Add subsequent screens
ENDCASE.

ENDMODULE. “USER_COMMAND INPUT

ABAP Global Class Elements


Class builder
Global vs. Local
Create global classes only if the class objects will be re-used, or are expected to
be reused, by more than one application. Otherwise, local classes should be
used.
While building classes, restrict the number of public components. All components that
can be private should be private.
The naming conventions are documented at the end of this section.

Class Properties
Instantiation
Consider using private instantiation and offer appropriate factory methods. This allows
you to:
-Control the instantiation of your class from within the class.
-Control the parameters passed to the constructor.
-Share the instances of your class effectively by passing the same object reference to
different clients when appropriate.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 66 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Final
Set classes as ‘Final’. Remove the ‘Final’ setting only when sub-classes are needed
for inheritance.
Use inheritance moderately. When in doubt, prefer interfaces to achieve polymorphism.
Inheritance is one of the most powerful, but also one of the more subtle features ABAP
OO offers. If you use inheritance (e.g. for reusing method implementations), keep the
paths of your inheritance tree short and terminate them with final classes. For the reuse
of interfaces, exploit the concept of interface composition in favor of inheritance.
General Data

Field Setting
Released internally Always blank.
Fixed point arithmetic Always marked to on.
Unicode checks active Always marked to on.
Shared Memory-Enable Optional.
Message Class Optional.
Program Status Set to ‘Customer Production Program’

Forward Declarations
Forward Declarations replace Type-Pools and Include statements. Therefore, use
‘Forward Declarations’ to pull in pooled statements rather than coding the TYPE-
POOLS or INCLUDE statement within class methods.

Documentation
Note: Class history (flowerbox) should be maintained at the bottom of the
Class Documentation.
See the class ZCL_AU_ STANDARDS_EXAMPLE.
• Use the Method Documentation editor to document all class methods. It is
mandatory to document all public and protected methods. Documentation for
Private methods is optional. However, complex logic should be documented within
the method to enable easier maintenance.
• Use the Class Documentation text editor to document the Class and include links to
the public method documentation. Links are added by using the menu path Insert-
>Link and then choose ‘Class-Method’.
• Class history (flowerbox) should be maintained at the bottom of the Class
Documentation. To paste in the template while editing Class Documentation,

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 67 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

navigate the menu path: Insert →Text → Documentation. On the pop-up screen,
enter “Z_MAINTENANCE_LOG” for the text name and select the option ‘Expand
Immediately’. Once the template is pasted into your class documentation, modify as
desired.

Attributes
Note: The visibility preference of attributes is private or protected over
public. When public visibility is required, they should be declared as
‘READ-ONLY’, unless there is justification. Public attributes that are not
declared as ‘READ-ONLY’ compromise the encapsulation property of
object-oriented programming.
• Always declare attributes as private or protected where possible.
• If public attributes are required, they should be declared as ‘READ-ONLY’,
unless there is a requirement to reduce encapsulation.
• Only create a global attribute if the attribute is used by more than one method
or by external classes. Otherwise keep attributes defined within their local
methods.
• Like vs. Type
In data definitions, use TYPE instead of LIKE to be ABAP OO compliant.

Methods
• Methods that can be set with ‘Private’ or ‘Protected’ visibility, must be set
accordingly.
• Document all public and protected methods using the method documentation
editor, with the exception of the CONSTRUCTOR and
CLASS_CONSTRUCTOR classes. Method documentation is not required for
the CONSTRUCTOR and CLASS_CONSTRUCTOR methods.
• The cyclomatic number of a method (the number of branches due to tests)
should not be greater than 10.
• See the section ABAP Object Component Naming Conventions, for method
naming convention.
• Use exception classes for error processing.
• The use of static methods, such as CLASS_CONSTRUCTOR, should be
limited. Instantiation is preferred over the direct use of classes via static
methods are that you can: o Use inheritance and method redefinition, if
needed.
Documentation Category Selective
Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 68 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

o Control the moment of instantiation and the lifetime of the object

• Method parameters are regarded from the point of view of the method that
implements them. Please see the section, Data Definition Naming
Conventions, for method parameter naming conventions.

Class-local types
When defining local classes and local types within a global class, separate the local
class definition and types from the local class implementations, into their proper
locations. See the workbench menu for Class-local types in the class builder.

Macros
Use methods or procedures to modularize the functionality of a program, rather than
macros.
The use of macros is discouraged for the following reasons:
• They increase difficulty of reading code.
• Their implementation provides only bare minimum of functionality.

• The de-bugger cannot be used on macro-generated code.

Exception Classes
• In exception processing use class-based exceptions.
• Do NOT catch exceptions by specifying the abstract root classes of the
exception tree: CX_ROOT, CX_STATIC_CHECK, CX_DYNAMIC_CHECK
and CX_NO_CHECK. Only use the abstract root classes when catching
exceptions at the highest levels of software architecture (e.g., some global
dispatcher, garbage collector, network connection, etc). When creating a
new exception sub-classes, determine the right exception type super-class:
CX_STATIC_CHECK, CX_DYNAMIC_CHECK or CX_NO_CHECK.

Changes to Super Classes


Additional consideration should be given when making changes to existing
superclasses
• Changes to superclasses should be made only if absolutely necessary
• ALL changes to superclasses require TDRC approval
• The developer who changes a super class is responsible for identifying where
else it is used and arranging regression testing

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 69 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

1 Mostof these ABAP OO standards are reproduced from the articles “An insider guide to writing awesome
ABAP programs Part 1 -3”. Authored by Andreas Blumenthal and Horst Keller. These articles appeared in
the SAP Professional Journal January-March 2006.

ABAP Web Dynpro


Component Name
Example :ZWD_SD_<any_desc>
Position Description Value

1–4 Webdynpro
component name
should start with
zwd_.

5-6 Application area

7 underscore

8-30 Any relevant


name

Window Name: w_<name>


The window that will host the most views should be named MAIN. If there are multiple
windows, these should be named as per function like w_initial_<desc>,
w_startup_<desc>, w_Popup_<desc>.

View Name: v_<name>


View name should be given according to their position in process flow. E.g,
Initial/startup view, Main view, Empty view

Supply Function
Supply_<name>

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 70 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Plugs
Outbound plug: TO_<target view name>
Inbound plug FR_<source View name>

UI Elements Names
Element Name
BTN_<any_name>
Button

Caption CAPTION_<any_name>

Check box CB_<any_name>

CheckBoxgroup CBG_<any_name>

DropDownbyIndex DDBI_<any_name>

DropDownbyKey DDBK_<any_name>

FileDownload FD_<any_name>

FileUpload FU_<any_name>

Group GR_<any_name>

Horizontalgutter HG_<any_name>

Inputfield INP_<any_name>

ItemlistBox ILB_<any_name>

Image IMG_<any_name>

Label LBL_<any_name>

MessageArea MSA_<any_name>

PageHeader PH_<any_name>

RadioButton RB_<any_name>

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 71 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

RadioButtonIndex RBGI_<any_name>

Tab T_<any_name>

Table TBL_<any_name>

Tableheader TBLH_<any_name>

TableColumn TBLC_<any_name>

TableCellEditor TBLCE_<any_name>

TableColumnHeader TBLCH_<any_name>

TabScript TS_<any_name>

TableContainer TC_<any_name>

TextEdit TXTE_<any_name>

TextView TXTV_<any_name>

ToolBar TB_<any_name>

Tree TR_<any_name>

TreeItemType TIT_<any_name>

TreeNodeType TNT_<any_name>

TriStateCheckBox TSCB_<any_name>

ViewContainerElement VC_<any_name>

Assistance Class
ZCL_SD_ASSIST_ <desc>
In the description/documentation of Assistance class provide full name of webdynpro
component.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 72 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• Use Assistant class for coding that is required within the component, but is not linked
directly with the layout or with the function of a controller. This could be, for example,
a call of the application layer or UI-based editing of the data.
• All text elements should reside in Assistance class.

Model Class
Model class name should follow Jabil Class naming standards. In addition, provide web
Dynpro component in description field.

General Guidelines for Web Dynpro Components


• No database selection logic in Webdynpro component. Use Assistance class for
application layer call or data base call.
• Instead of creating methods in Webdynpro controller, use assistance class/
Model Class.
• Define a mapping to context nodes of used components only in exceptional
cases. This can cause a drop in performance, and any changes within the used
component can cause errors in the main component. Use assistance / Model
Class attributes to pass data.
• For complex applications, use ALV component only if Sorting and filtering is
required on screen.
Alv component is performance intensive, use Table UI control instead.
• Context should only contain data that is required for UI element binding.
• Avoid deep nested contexts.
• Avoid dynamic contexts due to performance reasons.
• Restrict your components to a maximum of 15 views.
• If a view needs to appear multiple times in a window, make it a separate
Webdynpro component and reuse it multiple times in a window.
• To improve performance, Use matrix layout for complex layouts, however use
flow or Grid for simple layouts.
• Generic components are more difficult to maintain than explicitly programmed
components, make all your components only as generic as they absolutely need
to be.
• While making enhancement to a standard webdynpro component, pick best spot
according to call sequence.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 73 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• Number of controllers used by each controller should not exceed 8. For example,
if you are using component controller and custom controllers.

At runtime web Dynpro component will create a load which depends to a


great extent on the number of views, UI elements,
Controllers, controller usages, and the size of the context nodes. If
this load is too big, the system produces a warning telling you that limited
resources are available at runtime for the WDA application

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 74 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Generation Limit
Generation limit check should return all green lights when applied for Web Dynpro
components.
Right click on Webdynpro Component -> Check -> Generation Limit.

Development Tips
Dos and Dont's: Web Dynpro Components
• Use Web Dynpro components only for managing the views and context. Note
that Web Dynpro components are not lightweights!
• Delete all Web Dynpro component instances as soon as they are no longer
needed. To do that,
useIF_WD_COMPONENT_USAGE=>DELETE_COMPONENT.
• Use dynamic navigation or dynamic component usages only if it is absolutely
necessary. Set the lifetime of a view to when visible, if the view is displayed
only once in an application.

Although memory consumption is reduced by the lifespan of


when visible, when visible can affect performance since in
this case the view has to be initialized every time it is
displayed.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 75 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Dos and Dont's: Web Dynpro Context


• Do not put all your data into the context.
• Do not create a mega context for all data belonging to one application.
• Use singleton nodes if nesting’s (master detail) are necessary.
• Do not use dynamic attributes (IF_WD_CONTEXT_NODE_INFO-
>ADD_ATTRIBUTE) Do not create long context mapping chains.
• A context mapping is a mechanism that enables you to make static connections
between different contexts in different controllers. Depending of the size of the
context node (number and structure of the subnodes, and the absolute size of
the data), this can have a significant effect on the performance of the application.
So consider carefully which context nodes you actually require in multiple
contexts, and which nodes you only require locally. Avoid unnecessary mappings
in your component.
• Define a mapping to context nodes of used components only in exceptional
cases. This can cause a drop in performance, and any changes within the used
component can cause errors in the main component.

An alternative to this is the shared usage of an


assistance class instance. Please see example
DEMO_COMMON_ASSISTANCE1 and examine its
implementation in your system in package
SWDP_DEMO.

• Singleton Node:
When you create a context node below the root node, the Singleton checkbox
is selected by default. If you have deep data structures with large amounts of
data, consider only loading the data for the selected element of the main node
into the memory. The other factor to consider, however, is the performance loss
connected to the required invalidation and refilling of the corresponding context
node or nodes. You need to decide whether to minimize the memory load
created by large amounts of data or minimize the runtime caused by invalidation
and filling actions. Use singleton nodes only if the data in the memory will reach
a critical amount if you take no action. If not, you may prefer to work with non-
singleton nodes and delete any data that you do not yet need, or will never need,
from the memory explicitly.
• Supply function:
▪ Supply functions can only access context data that is contained in the
corresponding parent node or is contained in another node that is on a
next-highest level compared to the node filled by the corresponding supply
function.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 76 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

▪ Avoid raising an exception in a supply function or in a method called by a


supply function. Since supply functions are often called during rendering,
these exceptions cannot be processed sufficiently. Use WDDOINIT
instead.
▪ Make sure that you never modify the CONTEXT_NODE_INFO of a
context node within a supply function. A supply function must also never
modify the value set of a node. This causes complications since the order
of the steps performed at runtime may no longer match the values.
• Context Change Log: Use the Context Change Log functions to detect user
input. This has particular performance benefits while a user of the application
modifies only a small amount of data in a view while displaying a large amount of
mixed data.
• Properties of Context Attributes: Each context attribute has four predefined
properties readOnly, visible, state and enabled. The values of these properties
can be set with the interface IF_WD_CONTEXT_ATTR. Web Dynpro Framework
allows UI element properties with the same name to be bound to the respective
attribute property, which means the number of the nodes can be significantly
reduced in the context. This improves performance and reduces memory
requirement.
• Using Object References: Do not keep any references to context nodes and
elements because these could become invalid in the interim. Instead, only
retrieve the references when you actually need them. If you really need to keep a
reference for longer, apply method IS_ALIVE to the reference and check the
result before you continue working.

Dos and Dont's: Web Dynpro UI Elements


• The ALV component includes functions such as filters, sort functions, and total
functions. However, each additional ALV component you use increases runtime
significantly; the table UI control is quicker for displaying simple tables. Use the
ALV component only if you are sure you need its extra functions. Always choose
a simple Web Dynpro table if sufficient for your application.
• Do not use container scrolling (scrollingMode=none) Do not use the scrolling
function of the browser window.
If the application screen is to be used for display only and not for user
input, as an exception, you can use browser scrolling to avoid
unnecessary server roundtrips

• Create application screen that fit into a typical browser window


• Use the scrolling features of Table, MultiPane, andRowRepeater Avoid
deep nestings of Containers, Groups, andTabStrips.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 77 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Server and client performance is strongly affected by nesting. It


may also occur that deeply nested contents are not shown on the
front end as a result of browser restrictions which cannot be
influenced by the Web Dynpro ABAP framework.

• Do not insert any TransparentContainer UI elements into Container UI elements,


for example,Groups.
• To minimize nesting depths, if possible, swap theRootUIElementContainer UI
element (TransparentContainer) with other Container UI elements, such as
Table, TabStrip, and Group.
• It is best to arrange logically nested contents into rows
• As far as possbile, do not use the UI element tree
• To display tree structures use a Table with eitherTreeByKeyTableColumn
orTreeByNestingTableColumn.

TabStrip: Make visible for active tab only


Each tab of a TabStrip is to make another view visible. For each tab a
ViewContainerUIElement must be created, and this in turn must have a view container
in the window. The view to be displayed is embedded in the view containers. Since
there must always be a default view for each view container, they are therefore all
default views. This means that all views are immediately instantiated. Please see
example implementation Example application DEMO_TABSTRIP_VIEWS, Method
HANDLESHOW_TAB in Window.

Dialog Box
Dialog boxes / popups are special display elements that open alongside a running
application. Dialog boxes always start a separate phase model instance, which means
that their source window cannot be refreshed or edited while the dialog box is open
(while the phase model instance still exists). You can avoid dialog boxes in many cases
by displaying content in an additional window view. This removes the source of many
errors and improves performance.

SAPscript forms

When customizing SAPscript forms for Jabil, follow these standards. Properties
(language key, default text format, etc.) that are not mentioned in this document should
use the SAP defaults.
Documentation Category Selective
Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 78 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Note:
• SAPscript forms are client-dependent objects, please create them in the
Configuration client, DEV 010, and transport them to the other DEV clients for
unit testing.
• SAP script form design and configuration should be in dev010, but the
subroutines which can be called from inside script should be done in dev20
(since it is an ABAP report). If you write your own SAP script program (called
print program), you should do it in dev020 too (Because it is an ABAP report).
• The user settings determine how information is presented to the user. Although
the same standards apply whichever settings are chosen, this document
contains screens based on the settings shown below. From the initial SAPscript
screen (SE71) follow Settings > Form Painter.

SAPscript forms – Naming convention


Do not modify SAP standard forms. Always make a copy and modify the copy. Use the
documentation object to record the original form’s name and any related transactions.
The Form name can be up to 16 characters.

Position Description Sample values

1 Jabil custom indicator. Z

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 79 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

2-4 Use JBL if form is a Jabil 0114 BEDFORD, TX


standard. Use company code
if form is customized 0201 Jabil Circuit Scotland
specifically for a plant. JBL – If not site specific

5 Separator _

Remaining space up to 16. Descriptive text


*See exceptions below.

Exceptions to Descriptive POR – Purchase Order


Text. Z0114_POR (Bedford custom PO)
Special naming conventions RFQ – RFQ
for these form types. Z0115_RFQ (San Jose custom
Three char code. RFQ)
Output Indicator. If Form is a SAC– Schedule Agreement and
Vidifax, add ‘X’ to end of Contract
name. Z0701_SAC

X – Vidifax
Z0114_PORX (Bedford custom
Vidifax)

SAPscript Development Class


Forms must be assigned to a defined SAPscript development class.

Position Description Sample values

1 Custom indicator Z

2 Underscore _

3-4 2-char functional SD, MM, FI


assignment

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 80 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

5 Underscore _

6-11 OUTPUT OUTPUT


Note: If the development class does not exist, it must be created and documented.

Basic Settings Tab


The following settings should be used unless otherwise specified. From SE71 follow
Utilities > Change Page format, to change page format. From DINA4 to Letter for
example.
Page format INCH11

All other settings Use original form setting unless otherwise necessary.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 81 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Layout Windows
Windows should have descriptive names.
• MAIN – Contains Line item information.
• XXXXADDR – Address (XXXX – 4-char description of address).
• XXXTOTAL – Total (XXX – 3-char description of total (QTY, INV, etc.))
• HEADER – Header Information
• FOOTER – Footer Information
• LOGO – Jabil Logo

Paragraph Format
Paragraph name: Length 2. First character must be a letter.

Paragraph The default paragraph should be named AS. Define


the settings for the default paragraph.

Use default settings unless necessary.


Standard attributes:

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 82 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Note: Be cautious when changing an SAP defined paragraph, a change can have odd
results if it’s used in other parts of the form. It’s better to make a copy in most cases.

Character Format
Character Format Name: Character length 2.

Standard attributes: Use default SAP setting unless


required by layout form.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 83 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Text Elements
Names should be descriptive. Spaces are not allowed per SAP.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 84 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

General SAPscript Programming Guidelines


Documentation
Use the Documentation sub-object to record helpful information. Items that should be
noted include the name of the original SAP standard form you copied, output
configuration transcodes, and any information on how to create and display form test
data.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 85 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Windows
Window Name: 8-char (as descriptive as possible)

Window Types

MAIN Used for the MAIN window only.

VAR Window with variable contents. The text


can vary on each page in which the window
is positioned.
Variable windows are formatted for each
page.
CONST
Do not use this type. As of release 4.0 it
* Only seen when not
behaves the same as VAR anyway.
using the Graphical
Using type VAR will avoid confusion.
Painter.
Page Names and Counter attributes
Most forms will need only these three pages.
• FIRST – Initial page
• NEXT – Subsequent Pages

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 86 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• LAST – Last Page (if required)


When additional Pages are required, use descriptive names. The Page numbering type
should be Arabic unless requested otherwise.

Control Commands - Address


When possible, use the following when formatting the address:
• /: ADDRESS [DELIVERY] [TYPE t] [PARAGRAPH a] [PRIORITY p] [LINES l]
• /: TITLE title
• /: NAME name1[,name2[,name3[,name4]]]
• /: PERSON name of natural person [TITLE form of address]
• /: PERSONNUMBER number of the person
• /: DEPARTMENT department
• /: STREET street name HOUSE house number
• /: LOCATION additional location information
• /: POBOX po box [CODE post code / zip code] [CITY city]
• /: POSTCODE post code / zip_code
• /: CITY city1[,city2]
• /: NO_UPPERCASE_FOR_CITY
• /: REGION county / state
• /: COUNTRY recipient country [LANGUAGE language code]
• /: COUNTRY_IN_REC_LANG
• /: LANG_FOR_COUNTRY language key
• /: FROMCOUNTRY sender country
• /: ADDRESSNUMBER address number

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 87 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• /: ENDADDRESS

Fonts
When possible, use the same font type throughout the form. Also, use the same font
sizes for the main body of the layout. Use bold characters to highlight text.

Window coordinates
In specifying window coordinates and sizes, use whole numbers as much as possible.

Printer
In order to make sure that the layout set functions properly, the configuration of the
output device should be checked. Confirm that the print control device defined for the
printer is capable of printing the text formats (font type, font size, character pitch) and
paper size. For double-sided printouts, the printer definition should be checked.

Advanced modifications
Do not modify the Print Program unless other options have been ruled out. This is due
to the complexity of the maintenance issues. Most modifications can be met with
SAPscript Form commands. In SAPscript, you can use the PERFORM command in a
window to carry out advanced functions like:
• Obtain data from the database that is needed at print time
• Access tables not declared in the print program
• Carry out complex ABAP calculations
• Format data
Do not confuse the SAPscript PERFORM command with the ABAP PERFORM
statement. A special table structure is used with the SAPscript PERFORM command.

Adobe Forms

PDF Scenarios
Print Forms
Print forms are PDF forms that are used for output purposes only. No user interaction is
possible.

Online Scenario
Online scenarios feature the following characteristics;
• access to an SAP system is required and possible

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 88 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

• integration with other user-interface technology (such as a web browser)

Offline Scenario
Offline scenarios feature the following characteristics;
• no access to an SAP system is possible or required
• independent from other user-interface technologies

Print program
In order to call PDF form either Print form or Offline interactive form, program should
follow below sequence of function module;
• FP_JOB_OPEN
• FP_FUNCTION_MODULE_NAME (Form name never hard coded)
• CALL <Name_Returned_From_ FP_FUNCTION_MODULE_NAME>
• FP_JOB_CLOSE

To avoid hard coding form name in program to get its function module
name, while defining output type in NACE, remember to add form name in
“PDF/Smartform Form” field and “Form Type” as PDF. At runtime, NAST
structure field SFORM will contain form name.

Unless a specific output device is required, the default printer should be set to ‘PDF1’.
This will resolve to the default PDF printer for any user.
Note:
For print program syntax, follow ABAP coding standards as laid out in the ABAP
sections of this document.

Naming Conventions
Interface
Interface Name
Position Description Value

1-3 Always contains ZIF


this static value ->
4 Underscore To promote readability

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 89 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

5-n Functional Area View Functional areas

n+1 Underscore To promote readability

n+2 to 30 Interface Descriptive, yet concise text. Use underscores to


description enhance readability.
OR
SAP Interface Note:
name When the interface is a copy of a standard SAP
interface, the description should be the SAP
interface name

Interface Elements
Position Description Value

1-n Always contains this Form Interface


static value -> I Import
E Export

EX Exceptions

Position Description Value

Global
Definitions
(Global Data)
V Variable
S Structure

T Table

TY Types
<fs> Field Symbols

Initialization
IO Code Initialization

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 90 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

n+1 Underscore To promote readability


n+2 Element description Descriptive, yet concise text. Use underscores to
enhance readability.

Forms
Naming an Adobe form will depend on whether the form has been copied from a
standard SAP form template or created entirely as custom. If the form has been copied
from a standard SAP template, the original name of the form needs to be included in the
form name. This creates a logical link between the two and also simplifies the process
of locating existing versions of the template.
For Example:
VICS_BOL as Z_SD_VICS_BOL
Print Forms
Position Description Value
1 Always contains this static Z – Customer program for production Y –
value -> Test program

2 Underscore To promote readability

3 to n Functional Area View Functional areas

n+1 Underscore To promote readability

n+2 to 30 Form description Descriptive, yet concise text. Use underscores to


enhance readability

Note:
When the form is a copy of a standard SAP form, the
description should be the SAP form name

Interactive Forms:
Position Description Value
1 Always contains this Z – Customer program for production
static value -> Y – Test program
2 Underscore To promote readability
3 to n Mode ONLI for Online form
OFFL for Offline form
n+1 Underscore To promote readability

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 91 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

n+2 to 30 Form description Descriptive, yet concise text. Use underscores to


enhance readability

Note:
When the form is a copy of a standard SAP form, the
description should be the SAP form name

Objects and Components Context Objects:


Position Description Value

1-3 Always contains this GRA Graphic Node


static value -> ADR Address Node
TXT Text node

FOL Folder

DTA Data

STR Structure

LOP Loop

4 Underscore To promote readability


5-n Description Descriptive, yet concise text. Use underscores to
enhance readability

Standard Objects
Position Description Value

1-3 Always contains this CNT Content area


static value -> IMG Image
IMF Image field

SUB Subform

NUM Numeric

Position Description Value

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 92 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

TBL Table

IOF Input/output field

STX Static text

TXT Text

DEC Decimal

DAT Date

TIM Time

LIB List box

DDL Drop down list

CIR Circle

REC Rectangle

LIN Line

BAR Barcode

4 Underscore To promote readability


5-n Description Descriptive, yet concise text. Use underscores to
enhance readability

Form Builder Components


Position Description Value

1-5 Always contains this FBLFD Localized full Date


static value -> FBLLD Localized long date
FBLMD Localized medium date

FBLSD Localized short date

FBTBC Table Calcs

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 93 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

6 Underscore To promote dability


rea
7-n Description Descriptive, yet concise text. Use underscores to
enhance readability

Web Dynpro Components


Position Description Value

1-n Always contains this WDS Submit


static value -> WDCHKF Check Fields
WDEDL Enumerated drop-down list

WDREV Review Copy

Position Description Value

WDXS ActiveX Submit

WDXCHKF ActiveX Check Fields

WDXEDL ActiveX Enumerated drop-down


list
WDXREV ActiveX Review Copy

WDNS Native submit

WDNCHKF Native Checkfields

WDNEDL Native Enumerated drop-down list

n+1 Underscore To promote dability


rea
n+2 Description Descriptive, yet concise text. Use underscores to
enhance readability

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 94 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Webdynpro ActiveX components are not recommended unless the


“xACF Layout” form layout is used.
Webdynpro Native Components are not recommended unless the
“ZCI Layout” form layout is used.

Configurable Objects
Form Interface
While creating form Interface, keep all interface parameters as optional. This will allow
more flexibility to use same Interface for multiple forms.

Adding program logic in Form Interface is not allowed for all custom print programs.

For all SAP Standard Print Programs, copy to a Z Program and make necessary
modifications. If Standard Program not feasible to be copied, we can write code in
Interface in below cases:

▪ Minor additions like Address, Logo, Header/Footer text etc needs to be displayed in
output.
▪ Existing internal table / Structure available in Form Interface parameters is short of
fields to be displayed and additional data at item level needs to be added. The data
retrieval logic will be added only for newly added fields with simple data selection
logic. Complex data selection logic should be avoided in order to have good
performance.
Note:
Before starting the development, requirement to add logic in Interface, please make
sure to discuss with any of the Tech Leads.
Standard Texts
Texts should not be placed directly onto a form but created as Standard Texts in
transaction SO10 ’s and defined in the form context in ADLC.
Image Library
Form graphics (such as logo’s, signatures, etc) should be created in the SAP Form
Graphics library (transaction SE78) and bound to a graphics node in the form context in
ADLC.
Address Nodes

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 95 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Address lines should not be passed directly to a form unless a specific format
unsupported by ADLC is required. Address nodes should be created in the form
context in ADLC and bound to an address number for automatic formatting.

Context View

Address Node

Image Node

Text Node

Scripting
For Adobe print forms scripting should be kept to a
minimum. FormCalc should always be used over Java
Script.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 96 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Use of Java Script may degrade performance, hence FormCalc is the


preferred scripting language.

Master Pages
Master pages should be used sparingly and should only contain template objects that
should appear on multiple pages. In the case of a single page form, only objects that
would logically appear on multiple pages should be placed on the master page.

Examples;
Page numbers, logo’s, headers and footers, layout guides

For a complex requirement it is acceptable to use multiple master pages in a single


form, however this does not exempt the form from following the master page usage
guidelines listed here.

Documentation
Form documentation should be maintained. To maintain form documentation navigate
to menu path Goto→Documentation→Change from the Form Builder.

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 97 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Form history (flowerbox) should be maintained at the bottom of the Form


Documentation. To paste in the template while editing Class Documentation, navigate
the menu path: Insert Text
Documentation. On the pop-up screen, enter “Z_MAINTENANCE_LOG” for the text
name and select the option „Expand Immediately‟. Once the template is pasted into
your class documentation, modify as desired.

Form history (flowerbox) should be maintained at the bottom of the Form


Documentation using text name Z_MAINTENANCE_LOG

Workflow
Workflow Naming Standards
Packages
Workflow related developments will be grouped under separate package for each
functional area. Z_MM_WF
Z_SD_WF
Z_FI_WF
Z_PP_WF
Z_SM_WF
Z_QM_WF
Z_PM_WF
Z_HR_WF
Z_CA_WF
Position Description Value

1 Designates the type of Y – Customer


objects contained in the temporary/local objects
development class. Z – Customer objects
for production
Others – SAP objects
2 Underscore To enable readability

3 to n Functional assignment View Functional areas

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 98 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

n+1 Underscore To enable readability

n+2 to n+3 Workflow Identifier WF

Workflow Templates\Task\Rule
Abbr.: Start with ZMM_PURQ
Position Description Value

1 Designates the type of Y – Customer


objects contained in the temporary/local objects
development class. Z – Customer objects
for production
Others – SAP objects
2 to 3 Functional assignment View Functional areas

4 Underscore To enable readability

5 to 12 Short abbreviation Short abbreviated text


relevant to WF functionality

Name: ZMM_Purchase Requisition


Position Description Value

1 Designates the type of Y – Customer


objects contained in the temporary/local objects
development class. Z – Customer objects
for production
Others – SAP objects
2 to 3 Functional assignment View Functional areas

4 Underscore To enable readability

5 to 40 Free form text Brief text relevant to WF


functionality

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 99 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

Business Object
Subtype Naming Standards i.e. BUS0022
Object Type: Example ZBUS0022
➔ Uses prefix ‘Z’ along with complete BO name.

Object Name: Example Z_WF_OBJ_BUS0022


➔ Prefix Z_WF_OBJ_ to business object
Name: Same as object Name
Program: Z_FI_BUS0022
➔ Leverage normal report naming standards

Appendices
Functional Areas
Abbreviations
SD – Sales/distribution
BD – Basic Data
BI – Billing
CS – Sales Support
CX – Common across SD
ED – EDI
IS – Sales Info system

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 100 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

SH – Shipping
SL – Sales
SO – Sales Order Management
TR - Transportation
MM – Material management
BD – Basic Data
CM – Common across MM
ED – EDI
IM – Inventory Mang.
PI – Purchasing Info System
IV – Invoice Verification
PR – Purchasing
WM – Warehouse Mang.
CB – Consumption- Based Planning
PP – Production planning
PD – Plant Data Collection
AO – Assembly Orders
PC – Planning & Control
PO – Production Orders
MD – Material Requirements Planning
CP – Capacity Planning
MP – Master Planning
SP – Sales & Operations Planning
FI – Financial
AP – Accounts Payable
AR – Accounts Receivable
CF – Common across FI
ED - EDI
FC – Financial Controlling
FM – Funds Management
GL – General
Ledger LC –
Consolidation
SM – Service management
QM – Quality management
QP – Quality Planning

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 101 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

QI – Quality Inspection
QC – Quality Control
CA – Quality Certificates
QN – Quality Notifications
PM – Project management
HR – Human Resources
BD – Basic Data
CC – Common across HR
PA – Personal Administration
TI – Time Management
IW – Incentive Wages
BN –
Benefits PY
- Payroll
CA – Cross-Application Components
AU – ABAP Development Utilities
MD – Master Data Management

Local Data Definition Naming Conventions


Classic Programming & Class Attributes
Data type Global Prefix Local Prefix
Type ty_ lty_
Table t_ lt_
Structure s_ ls_
Variable v_ lv_
Constant c_ lc
Object o_ lo_

ABAP OO Programming
Parameter Data Type Prefix Rule Example
Type
Importing single fields, i_ singular nouns i_document_number
generics,
numeric
objects io_ singular nouns io_grid

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 102 of 103
ABAP Coding Standards and Guidelines
Revision A Released Date AUG/11/17

structures is_ singular nouns is_bapiret2


table types it_ singular nouns it_bapiret2_tab
Exporting single fields, e_ singular nouns e_document_number
generics,
numeric
objects eo_ singular nouns eo_grid
structures es_ singular nouns es_bapiret2
table types et_ singular nouns et_bapiret2_tab
Changing single fields, c_ singular nouns c_document_number
generics,
numeric
objects co_ singular nouns co_grid
structures cs_ singular nouns cs_bapiret2
table types ct_ singular nouns ct_bapiret2_tab
Returning single fields r_ singular nouns r_document_number
objects ro_ singular nouns ro_grid
structures rs_ singular nouns rs_bapiret2
table types rt_ singular nouns rt_bapiret2_tab

8. Revisions History & Change Details: Go back to cover page – click HERE

Rev Date Originator(s) Change Details


A AUG/11/17 Paul Jackson Initial Release.
Edwin Soh & Nisha
B May/01/01 7.5 Coding Standards
Parihar

Documentation Category Selective


Jabil Proprietary and Confidential Printed copies are reference only 04-IT60-STS-001 Rev A
Page 103 of 103

You might also like