100% found this document useful (1 vote)
198 views138 pages

ABAP - Fundamental Tasks and Tools

ABAP - Fundamental Tasks and Tools

Uploaded by

franck_marot
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
100% found this document useful (1 vote)
198 views138 pages

ABAP - Fundamental Tasks and Tools

ABAP - Fundamental Tasks and Tools

Uploaded by

franck_marot
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/ 138

Tasks

PDF download from SAP Help Portal:


http://help.sap.com/saphelp_nw74/helpdata/en/4e/c7a39d6e391014adc9fffe4e204223/content.htm
Created on April 29, 2016

The documentation may have changed since you downloaded the PDF. You can always find the latest information on SAP Help
Portal.

Note
This PDF document contains the selected topic and its subtopics (max. 150) in the selected structure. Subtopics from other structures are not included.
The selected structure has more than 150 subtopics. This download contains only the first 150 subtopics. You can manually download the missing
subtopics.

2016 SAP SE or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose
without the express permission of SAP SE. The information contained herein may be changed without prior notice. Some software products marketed by SAP
SE and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are
provided by SAP SE and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP
Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set
forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional
warranty. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE in
Germany and other countries. Please see www.sap.com/corporate-en/legal/copyright/index.epx#trademark for additional trademark information and notices.

Table of content

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 1 of 138

Table of content
1 Tasks
1.1 Fundamental Tasks and Tools
1.1.1 Working with ABAP Projects
1.1.1.1 Creating ABAP Projects
1.1.1.1.1 Using a Predefined System Connection from the SAP Logon Pad
1.1.1.1.2 Defining a Manual System Connection
1.1.1.2 Duplicating an Existing System Connection
1.1.1.3 Adding or Removing a Favorite Package
1.1.1.3.1 Adding by Using the Favorite Packages Node
1.1.1.3.2 Adding from the System Library Node
1.1.1.3.3 Deleting an ABAP Package from the Favorites List
1.1.1.4 Browsing Development Objects in the Project Explorer
1.1.1.5 Closing ABAP Projects
1.1.1.6 Re-Opening a Closed ABAP Project
1.1.1.7 Deleting ABAP Projects
1.1.2 Working with Development Objects
1.1.2.1 Opening Development Objects
1.1.2.2 Opening Development Objects in Another System
1.1.2.3 Opening Development Objects in the SAP GUI
1.1.2.4 Selecting a Main Program for Multiple-Use ABAP Includes
1.1.2.5 Registering for an ABAP System or SAP Objects
1.1.2.6 Creating Development Objects
1.1.2.6.1 Creating ABAP Classes
1.1.2.6.2 Creating ABAP Exception Classes
1.1.2.6.3 Creating an ABAP Function Group
1.1.2.6.4 Creating an ABAP Function Module
1.1.2.6.4.1 Adding a Definition Part and Implementation Part to a Function Module
1.1.2.6.5 Creating an ABAP Function Group Include
1.1.2.6.5.1 Adding Include Suffixes
1.1.2.7 Working with Messages and Message Classes
1.1.2.7.1 Creating a Message Class
1.1.2.7.2 Adding a Message to a Message Class
1.1.2.7.3 Adding a Long Text to a Message
1.1.2.7.4 Previewing a Message Long Text
1.1.2.7.5 Filtering Messages in Message Classes
1.1.2.7.6 Opening a Message from the Source Code in the Message Class Editor
1.1.2.7.7 Sharing Links of Selected Messages
1.1.2.7.8 Searching the Usage (Where-used) of a Message
1.1.2.8 Adding Code Templates to an ABAP Exception Class
1.1.2.9 Modifying Development Objects in the SAP Namespace
1.1.2.10 Adding Local Objects of Other Users to Favorites
1.1.2.11 Copying and Duplicating Source Code Based Objects
1.1.2.11.1 Copying Source Code Based Objects
1.1.2.11.2 Duplicating Source Code Based Objects
1.1.2.12 Sharing a Link to a Development Object
1.1.2.12.1 Linking to Open Development Objects in Another ADT Installation
1.1.2.12.2 Linking for Displaying ABAP Source Code in a Web Browser
1.1.2.12.3 Linking to Selected Parts of ABAP Source Codes
1.1.2.13 Displaying Properties of Development Objects
1.1.2.14 Displaying Source Code Plug-ins
1.1.2.15 Navigating from Source Code Plug-ins to External Objects
1.1.2.16 Creating and Editing Text Elements
1.1.2.17 Checking ABAP Syntax
1.1.2.17.1 Working with Manual ABAP Syntax Check
1.1.2.17.2 Working with Automatic ABAP Syntax Check While Programming
1.1.2.18 Activating Development Objects
1.1.2.18.1 Troubleshooting for ABAP Syntax Errors
1.1.2.18.2 Troubleshooting for Dictionary Activation Errors
1.1.2.19 Unlocking Development Objects
1.1.2.20 Running Executable Objects

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 2 of 138

1.1.2.20.1 Running as ABAP Development Object


1.1.2.20.2 Running in the ABAP Source Code Editor
1.1.2.20.3 Running from the Project Explorer
1.1.2.21 Deleting Development Objects
1.1.3 Searching in ABAP Projects
1.1.3.1 Searching ABAP Source Code
1.1.3.2 Searching Development Objects
1.1.3.3 Searching Usages (Where-Used)
1.1.4 Editing ABAP Source Code
1.1.4.1 Working with Code Completion
1.1.4.1.1 Keyword Completion
1.1.4.1.2 Non-Keyword Completion
1.1.4.1.3 Code Completion
1.1.4.1.3.1 Using Code Completion Automatically
1.1.4.1.3.2 Inserting a Full Signature Automatically
1.1.4.1.3.3 Inserting or Overwriting Source Code
1.1.4.2 Working with Source Code Templates
1.1.4.3 Closing Brackets and Literals Automatically
1.1.4.4 Formatting ABAP Source Code
1.1.4.5 Changing Colors for ABAP Source Code
1.1.4.5.1 Changing Font Color of Texts
1.1.4.5.2 Changing Colors of Annotation Types
1.1.4.6 Editing Comments in ABAP Source Code
1.1.4.6.1 Editing ABAP Doc Comments
1.1.4.6.1.1 Adding ABAP Doc Comments
1.1.4.6.1.2 Adding Documentation of Parameters and Exceptions in ABAP Doc Comments
1.1.4.6.1.3 Formatting ABAP Doc Comments
1.1.4.6.1.4 Importing Descriptions of Class and Interface Components from the Class Builder
1.1.4.6.2 Editing ABAP Comments
1.1.4.7 Displaying Information of ABAP Source Code Elements
1.1.4.7.1 Displaying Details of Source Code Elements
1.1.4.7.2 Displaying the Method Definition within ABAP Source Code
1.1.4.7.3 Displaying Details in the ABAP Element Info View
1.1.4.7.4 Displaying Details in the Code Completion List while Programming
1.1.4.8 Marking Occurrences in the Source Code Editor
1.1.4.9 Viewing the Outline
1.1.4.10 Viewing the ABAP Type Hierarchy
1.1.4.11 Getting Orientation in the Source Code Using Breadcrumbs
1.1.4.12 Using Quick Views
1.1.4.12.1 Quick Outline
1.1.4.12.2 Quick Type Hierarchy
1.1.4.13 Managing Version Conflicts
1.1.4.14 Switching between Inactive and Active Versions of a Source-based Object
1.1.5 Applying Quick Assists
1.1.5.1 Refactoring ABAP Source Code
1.1.5.1.1 Renaming Identifiers
1.1.5.1.1.1 Renaming Elements in a Single Source Unit
1.1.5.1.1.2 Renaming Elements in All Includes of an ABAP Program
1.1.5.1.2 Extracting Methods
1.1.5.1.2.1 Extracting Methods from Statements
1.1.5.1.2.2 Extracting Methods from Expressions
1.1.5.1.3 Extracting Constants
1.1.5.1.3.1 Extracting Constants from Literals
1.1.5.1.3.1.1 Code Example Before Execution
1.1.5.1.3.2 Reusing Existing Constants
1.1.5.1.3.2.1 Code Example Before Execution
1.1.5.1.4 Extracting and Converting Variables
1.1.5.1.4.1 Extracting Local Variables from Expressions
1.1.5.1.4.1.1 Code Example Before Execution
1.1.5.1.4.2 Converting Locals to Class Members
1.1.5.1.4.2.1 Code Example Before Execution
1.1.5.1.4.3 Converting Local Variables to Parameters

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 3 of 138

1.1.5.1.4.3.1 Code Example Before Execution


1.1.5.1.4.4 Assigning a Statement to a New Variable
1.1.5.1.4.4.1 Code Example Before Execution
1.1.5.1.4.5 Declaring Inline Variables Explicitly
1.1.5.1.4.5.1 Code Example Before Execution
1.1.5.1.4.6 Declaring Variables from Usage
1.1.5.1.4.6.1 Code Example Before Execution
1.1.5.1.4.7 Using Similar Variables
1.1.5.1.4.7.1 Correcting Misspelled Variables
1.1.5.1.4.7.1.1 Code Example Before Execution
1.1.5.1.4.7.2 Correcting an Interface Attribute Access
1.1.5.1.4.7.2.1 Adding the Interface Name
1.1.5.1.4.7.2.1.1 Code Example Before Execution
1.1.5.1.4.7.2.2 Generating an Alias
1.1.5.1.4.7.2.2.1 Code Example Before Execution
1.1.5.1.4.8 Deleting Unused Variables
1.1.5.1.4.8.1 Code Example Before Execution
1.1.5.1.5 Moving Members
1.1.5.1.5.1 Changing Visibility of Members
1.1.5.1.5.1.1 Code Example Before Execution
1.1.5.1.5.2 Pull-up Members to Superclass
1.1.5.1.5.2.1 Code Example Before Execution
1.1.5.1.5.3 Pull-up Members to Interface
1.1.5.1.5.3.1 Code Example Before Execution
1.1.5.1.6 Exception Handling
1.1.5.1.6.1 Propagating an Exception
1.1.5.1.6.2 Extracting an Exception Variable from a RAISE Statement
1.1.5.2 Applying ABAP Quick Fixes

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 4 of 138

Fundamental 1 Tasks and Tools


Context
The general idea of ABAP Development Tools (ADT) is to provide one Eclipse client that is installed on the developer's PC and can connect to several ABAP
back-end systems, even systems of different releases. The connection between the client and the back-end is achieved through the HTTP/RFC protocol.
The development paradigm is still server-based. This means that the development objects are stored solely in the ABAP repository of the back-end system
(no local copies via check-in and check-out), and services such as syntax-check, search, and where-used run on the back-end system.

Figure 1: Architecture view of the new integrated development environment for ABAP

The client part of ABAP Development Tools (ADT) provides a set of standard development tools such as the Project Explorer for system browsing and a
variety of creation wizards, search, and other views. In addition, there are specific editors available for ABAP development object types, such as ABAP
classes, function modules, and other ABAP programs.
The ADT provides the well-known ABAP capabilities (transport, activation, version management, where-used list, and others) combined with an Eclipse-based
state-of-the-art UI and user interaction capabilities in a new integrated development environment.
ADT integrates two different types of tools:
Eclipse-based tools: Front-end tools of this type have been implemented fully using native Eclipse technology means and they integrate seamlessly
into the Eclipse environment.
GUI-based tools: Not all development tools that are available in the new ABAP IDE are integrated into the native Eclipse environment. Some tools are
made available in the new IDE through the SAP GUI, which is installed locally together with the Eclipse-based client.

Related Information
Working with ABAP Projects
Working with Development Objects
Searching in ABAP Projects
Editing ABAP Source Code
Getting Feeds
Accessing ABAP Language Help
Working with Bookmarks

1.1 Fundamental Tasks and Tools


Context
The general idea of ABAP Development Tools (ADT) is to provide one Eclipse client that is installed on the developer's PC and can connect to several ABAP
back-end systems, even systems of different releases. The connection between the client and the back-end is achieved through the HTTP/RFC protocol.
The development paradigm is still server-based. This means that the development objects are stored solely in the ABAP repository of the back-end system
(no local copies via check-in and check-out), and services such as syntax-check, search, and where-used run on the back-end system.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 5 of 138

Figure 1: Architecture view of the new integrated development environment for ABAP

The client part of ABAP Development Tools (ADT) provides a set of standard development tools such as the Project Explorer for system browsing and a
variety of creation wizards, search, and other views. In addition, there are specific editors available for ABAP development object types, such as ABAP
classes, function modules, and other ABAP programs.
The ADT provides the well-known ABAP capabilities (transport, activation, version management, where-used list, and others) combined with an Eclipse-based
state-of-the-art UI and user interaction capabilities in a new integrated development environment.
ADT integrates two different types of tools:
Eclipse-based tools: Front-end tools of this type have been implemented fully using native Eclipse technology means and they integrate seamlessly
into the Eclipse environment.
GUI-based tools: Not all development tools that are available in the new ABAP IDE are integrated into the native Eclipse environment. Some tools are
made available in the new IDE through the SAP GUI, which is installed locally together with the Eclipse-based client.

Related Information
Working with ABAP Projects
Working with Development Objects
Searching in ABAP Projects
Editing ABAP Source Code
Getting Feeds
Accessing ABAP Language Help
Working with Bookmarks

1.1.1 Working with ABAP Projects


Context
ABAP projects form the starting point for the ABAP developer's work in the Eclipse-based IDE. An ABAP project mediates between an ABAP backend
system and the Eclipse-based IDE, and it provides a framework for the creation, processing, and testing of development objects.
In this part of the documentation you will find detailed descriptions of the elementary activities in the area of ABAP projects. These will be important to you,
particularly during the introductory phase.

Related Information
ABAP Projects
Creating ABAP Projects
Adding or Removing a Favorite Package
Browsing Development Objects in the Project Explorer
Closing ABAP Projects
Deleting ABAP Projects

1.1.1.1 Creating ABAP Projects


Context
Before you start with ABAP development in the Eclipse-based IDE, you first need to create an ABAP project. An ABAP project is used to manage the system
connection and also serves on the frontend as a container for all ABAP development objects that are located in the back-end system.
You have the following options for creating an ABAP project:
Using a Predefined System Connection from the SAP Logon Pad: if the corresponding ABAP system is already connected in your SAP Logon Pad and
you want to use the predefined settings.
Defining a Manual System Connection: if you want to define the system connection without using the SAP Logon Pad.
Duplicating an Existing System Connection: if you want to define a new manual system connection on base of an existing one.

Related Information
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 6 of 138

Related Information
ABAP Projects
ABAP Packages
User Authentication on Front-End Client
Adding or Removing a Favorite Package

1.1.1.1.1 Using a Predefined System Connection from the SAP


Logon Pad
Prerequisites
You need to specify the connection data for the ABAP back-end system you want to work with. Therefore, make sure that a corresponding entry for the
respective ABAP system is already defined in the SAP Logon Pad.
For security reasons, check whether the Secure Network Communication (SNC) is enabled for the selected system connection. If it is not so, enable
SNC first using the SAP Logon Pad.

Recommendation
For the sake of convenience and again for security reasons, use also the single sign-on (SSO) option for system authentication.

Context
You want to connect your Eclipse-based IDE using the standard settings of an ABAP system that is already connected in the SAP Logon Pad.

Procedure
1.
2.
3.
4.

From the menu, choose


File
New
Project...
to launch the project creation wizard.
Select the project type
ABAP
ABAP Project
and choose Next.
Select the Select system from SAP Logon option in order to reuse an existing ABAP system connection.
In the Connection field, enter the ABAP system ID or choose Browse... for system selection. Then choose Next.

Tip
When editing the system ID, you can avail of the content assistant functionality by pressing Ctrl + Space.
5. Enter the logon data, such as Client, User, Password (not required for SSO system connection).
6. [Optional:] If you want to change the default language, select the Change Default Language checkbox.

Note
The default language predefines the original language of the new development objects that will be created in the corresponding ABAP system.
Consequently, all new development objects will automatically be created in this language. But your ABAP project may contain development objects
in different original languages if, for example, you copy development objects from other systems.

Tip
Use the content assistant for language selection.
7. Choose Next to select your favorite packages or Finish to start the creation.
8. [Optional:] If you want to limit the number of displayed elements in the Project Explorer to one or more working sets, select the Add project to
working sets checkbox. Then choose the corresponding working set(s) using the Select button.

Note
A working set enables you to keep a clear structure and partition in the Project Explorer if you for example, you are also working with Java projects
in your Eclipse installation. See further information about working sets in the Eclipse help.
9. [Optional:] If you want to change the project name, enter a new Project Name.

Note
When you create the project, you already have the option of including individual packages in your Favorites list. In the standard version, the
temporary package $TMP is provided as a default for this purpose. If you wish to add a further package, choose Add... and enter the name of the
package in the corresponding input field (must be available in the system!).

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 7 of 138

Figure 1: Adding packages to Favorites when creating an ABAP project

10. Start creation of the ABAP project with Finish.

Results
The ABAP project is created and added in the Project Explorer . Because, the project is referencing a system connection in the SAP Logon Pad, a decorator
is added to project icon

. This decorator reflects the connection to the SAP Logon.

To check the results of the procedure, switch to the Project Explorer and expand the first level of the project structure. Verify that the project structure
already includes the following nodes:
Favorite Packages contains the packages that you have added to favorites (temporary package $TMP by default).
System Library contains all system packages.

Related Information
ABAP Projects
ABAP Packages
User Authentication on Front-End Client
Adding or Removing a Favorite Package
Defining a Manual System Connection

1.1.1.1.2 Defining a Manual System Connection


Context
You want to define the connection of your Eclipse-based IDE to an ABAP system directly without using the SAP Logon Pad. This enables you to adopt certain
properties like the connection type, message server, instance number, and so on.

Note
This functionality is provided for all SAP NetWeaver releases that support ABAP Development Tools.
Example
You can create an individual configuration in the following use cases:
You have installed ABAP Development Tools on a Mac OS X operating system.
You want to work in a user specified system.
You want to connect manually because you do not have configuration files that contain value helps. As a result, access through the SAP Logon Pad
would be more laborious.

Note
The connection data to an ABAP system is stored in the workspace.
Whenever you select an item from a drop down list box, the subsequent entries may or may not be editable.

Procedure
1. From the menu, choose

File

New

Project...

to launch the project creation wizard.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 8 of 138

2.
3.
4.
5.

Select the project type


ABAP
ABAP Project
and choose Next.
Select the Define manually option in order to define an individual connection to an ABAP system.
In the System ID field, enter the ABAP system ID to which you want to connect.
From the Connection Type drop down list box, you can select one of the following items:
Custom Application Server: Select this if you want to define the System ID, Application Server, Instance Number, and SAProuter String
Elements
Group Selection: Select this if you want to define the System ID, Message Server, Group, Message Server Port, and SAProuter String elements.
6. With the Secure Network Communication (SNC) drop-down list box, you can define the SNC mode by selecting one of the following items:
Disabled: Select this if you want to turn SNC off.
User agent authentication ensured: The system verifies the identity of the communication partners. This is the minimum protection level offered
by SNC.
Integrity ensured (signed content): The system also detects any changes or manipulation of data that may have occurred between the two end
points of a communication.
Encryption ensured: The system encrypts the messages being transferred, which makes eavesdropping impossible. Privacy protection also
includes integrity protection of the data. This is the maximum level of protection provided by SNC.
Highest available security level: The highest security level provided by the security product you are using is selected automatically for your
connection.

Note
When you make your selection, the security level is set by the security product used. The authentication is secure whatever the case. Encryption
and integrity protection of application data is used if the security product provides these functions.
For security reasons, check whether the Secure Network Communication (SNC) is enabled for the selected system connection. If it is not, enable
SNC.
7. [Optional:] In the SNC Name field, specify the target name of the communication partner.
8. From the Single Sign-On (SSO) drop down list box, you can choose:
Enabled for SNC Logon with Single Sign-On to enable secure points of access to your systems in open environments, such as the Internet.
Disabled for SNC Logon without Single Sign-On to log on to the selected SAP system using user name and password.
9. In the Message Server input field, enter the name or the IP address of the message server that is part of the instance.
10. In the Group input field, enter the name of the load balancing group that you are using to logon.
11. [Optional:] In the Message Server Port input field, add the number of a message server port.
12. Enter the host name of the Application Server you want to connect to.
13. Specify the Instance Number you want to connect to.
14. [Optional:] If you are accessing the application server through the SAP router program, enter the routing entry in the SAProuter String input field.
15. Then choose Next.
16. Enter the logon data, such as Client, User, Password (not required for SSO system connection).
17. [Optional:] If you want to change the default language, select the Change Default Language checkbox.

Note
The default language predefines the original language of the new development objects that will be created in the corresponding ABAP system.
Consequently, all new development objects will automatically be created in this language. But your ABAP project may contain development objects
in different original languages if, for example, you copy development objects from other systems.

Tip
Use the content assistant for language selection.
18. Choose Next to select your favorite packages or Finish to start the creation.
19. [Optional:] If you want to limit the number of displayed elements in the Project Explorer to one or more working sets, select the Add project to
working sets checkbox. Then, choose the corresponding working set(s) using the Select button.

Note
A working set enables you to keep a clear structure and partition in the Project Explorer if, for example, you are also working with Java projects in
your Eclipse installation. See further information about working sets in the Eclipse help.
20. [Optional:] If you want to change the project name, enter a new Project Name.

Note
When you create the project, you already have the option of including individual packages in your Favorites list. In the standard version, the
temporary package $TMP is provided as a default for this purpose. If you wish to add a further package, choose Add... and enter the name of the
package in the corresponding input field (must be available in the system!).

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 9 of 138

Figure 1: Adding packages to Favorites when creating an ABAP project

21. Start creation of the ABAP project with Finish.

Results
To check the results of the procedure, switch to the Project Explorer and expand the first level of the project structure. Verify that the project structure
already includes the following nodes:
Favorite Packages contains the packages that you have added to Favorites (temporary package $TMP by default).
System Library contains all system packages.

Related Information
ABAP Projects
ABAP Packages
User Authentication on Front-End Client
Adding or Removing a Favorite Package
Using a Predefined System Connection from the SAP Logon Pad

1.1.1.2 Duplicating an Existing System Connection


Context
You can create a new ABAP project and reuse the connection data of an existing project.

Procedure
1. In the Project Explorer , select the project whose connection data you want to reuse.
2. In the context menu, select Duplicate.
The creation wizard is opened. The data of the existing project is provided in the input and selection fields..
3. Adopt your changes and choose Next.

Note
See the description from the values of the input fields and selections fields here Defining a Manual System Connection.
4. [Optional:] Change the logon data, such as Client, User, Password (not required for SSO system connection).
5. Choose Next to define the project name and to select your Favorite Packages.
6. In the Project Name field, enter the name of your new project.

Note
ADT automatically proposes a name of the base project, plus the suffix of the original language and a consecutive number.
7. [Optional:] You can add and remove Favorite Packages or use Working Sets to enrich your project.

Note
ABAP Development Tools automatically proposes all existing favorite packages of the source project. If you do not want to reuse them, select the

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 10 of 138

Remove button.
8. Start the creation of the ABAP project with Finish.

Results
The ABAP project is created and added in the Project Explorer .
To check the results of the procedure, switch to the Project Explorer and expand the first level of the project structure. Verify that the project structure
already includes the following nodes:
Favorite Packages contains the packages that you have added to Favorites (temporary package $TMP by default).
System Library contains all system packages.

Related Information
ABAP Projects
ABAP Packages
User Authentication on Front-End Client
Adding or Removing a Favorite Package
Defining a Manual System Connection
Using a Predefined System Connection from the SAP Logon Pad

1.1.1.3 Adding or Removing a Favorite Package


Prerequisites
In ABAP projects, you can only add packages (not other types of development objects) to your favorites list.

Context
As an ABAP developer, you will generally work with a limited selection of ABAP packages. Therefore, it is appropriate to include in your favorites list for your
ABAP project exactly those packages that are relevant for your work. The packages listed there remain assigned to the ABAP project on a permanent basis.
There are following possibilities to add or remove packages to/from the list of favorites:
Adding by Using the Favorite Packages Node
Adding from the System Library Node
Deleting an ABAP Package from the Favorites List
Or when Creating ABAP Projects

Related Information
ABAP Projects
ABAP Packages
Creating ABAP Projects

1.1.1.3.1 Adding by Using the Favorite Packages Node


Context
To add a package to your favorites list using the Favorite Packages node, proceed as follows:

Procedure
1. In the Project Explorer, expand the first level of your ABAP project.
2. Select the Favorite Packages node, open the context menu and choose Add a Package....
3. In the dialog box that appears, enter a valid name of a package and confirm with OK.

Tip
When entering the name of the package, you can benefit from the content assistant functionality by editing the first letters and then pressing Ctrl
+ Space.

Related Information
Adding or Removing a Favorite Package
Adding from the System Library Node
Deleting an ABAP Package from the Favorites List

1.1.1.3.2 Adding from the System Library Node


PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 11 of 138

1.1.1.3.2 Adding from the System Library Node


Context
To add a package to your favorites list starting from the System Library node, proceed as follows:

Procedure
1. In the Project Explorer, expand the navigation tree of the System Library node until you find the package you wish to work with.

Tip
For the package search, you can also use CTRL + Shift + A in connection with the activated Link with Editor. The node of the package found
is then displayed at the corresponding position within the expanded project tree.
2. Select the package node, open the context menu, and choose Add to Favorites.

Related Information
Adding or Removing a Favorite Package
Adding by Using the Favorite Packages Node
Deleting an ABAP Package from the Favorites List

1.1.1.3.3 Deleting an ABAP Package from the Favorites List


Context
To remove an individual package from your favorites list, proceed as follows:

Procedure
1. Expand the Favorite Packages node.
2. Open the context menu for the package in question.
3. Choose Remove from Favorites.

Related Information
Adding or Removing a Favorite Package
Adding from the System Library Node
Deleting an ABAP Package from the Favorites List

1.1.1.4 Browsing Development Objects in the Project Explorer


Context
The contents of an ABAP project are usually displayed in the Project Explorer. The root of an ABAP project contains a list of ABAP packages that are
itemized either under the favorites list (as Favorite Packages) or the System Library node. The System Library displays a structured list of all packages that
are contained in a backend system corresponding to the ABAP project.

Tip
The structured listing of system packages enables access to all development objects by continually expanding the tree structure. This procedure is
generally less suitable for searching for objects. The best way to find a particular development object is to use CTRL + Shift + A in connection with
the activated Link with Editor. When the development object is then found, the corresponding position within the expanded project tree is displayed.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 12 of 138

Figure 1: Structure of an ABAP project in the Project Explorer

Related Information
ABAP Projects
System Library
Adding or Removing a Favorite Package

1.1.1.5 Closing ABAP Projects


Context
It can happen when you have multiple projects that you do not wish to process a certain ABAP project as an active version. In this case, you could
(temporarily) close this project. The consequence of this is that the corresponding project tree is not longer visible. In addition, a closed ABAP project is no
longer taken into consideration for the object search.

Procedure
1. In the Project Explorer, select the root node of the relevant ABAP project.
2. Open the context menu and choose Close Project.

Results
The project node is still visible in the Project Explorer so that you are able to re-open the project whenever you need it.

Related Information
ABAP Projects
Creating ABAP Projects
Deleting ABAP Projects
Re-Opening a Closed ABAP Project

1.1.1.6 Re-Opening a Closed ABAP Project

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 13 of 138

Context
After closing an ABAP project, you can open it again from the workspace.

Procedure
1. Select the node of the closed ABAP project.
2. Open the context menu and choose Open Project.

Related Information
ABAP Projects
Creating ABAP Projects
Deleting ABAP Projects
Closing ABAP Projects

1.1.1.7 Deleting ABAP Projects


Context
You can delete an ABAP project if you are entirely sure that you will no longer need it.

Procedure
1.
2.
3.
4.

In the Project Explorer, select the root node of the ABAP project in question.
Open the context menu and choose Delete.
In the dialog window that now appears, check the option Delete project content on disk....
Confirm with OK.

Related Information
ABAP Projects
Creating ABAP Projects
Closing ABAP Projects

1.1.2 Working with Development Objects


Context
In the new Eclipse-based IDE, packages form the basic organizational units for ABAP projects. Each of the package nodes can, in turn, contain subpackages
or ABAP development objects as subnodes. The development objects are the individual parts that are used to build an ABAP application.
In this part of the documentation you will find detailed descriptions of the elementary activities concerning the ABAP development objects as such.

Related Information
ABAP Development Objects
Status of a Development Object
Opening Development Objects
Opening Development Objects in Another System
Opening Development Objects in the SAP GUI
Registering for an ABAP System or SAP Objects
Checking ABAP Syntax
Adding Code Templates to an ABAP Exception Class
Modifying Development Objects in the SAP Namespace
Adding Local Objects of Other Users to Favorites
Copying and Duplicating Source Code Based Objects
Linking to Open Development Objects in Another ADT Installation
Displaying Properties of Development Objects
Creating and Editing Text Elements
Activating Development Objects
Running Executable Objects
Deleting Development Objects

1.1.2.1 Opening Development Objects


You can open an ABAP development object in the appropriate editor in several ways:

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 14 of 138

Starting from the Project Explorer


By double-clicking the corresponding node of the ABAP project in the Project Explorer.
By opening the context menu of the corresponding node in the Project Explorer and then selecting Open in the menu.

Based on the results of the global object search and where-used function
By calling the Open ABAP Development Object dialog (Ctrl + Shift + A shortcut) and then selecting an item from the results list.

Figure 1: Dialog for system-wide search using Ctrl + Shift + A

By calling the where-used function for a development object or sub-object (Ctrl + Shift + G shortcut) and then selecting an item from the Search view.

Based on the results of various check runs (ATC, ABAP Unit Tests, and so on)
By double-clicking an error or warning, or a task record that is associated with an object, from the Problems or Tasks view.

Starting from an open source code editor


By using the standard navigation capabilities within the editor (such as F3).
By choosing the icon
Open ABAP Development Object in the toolbar.
By choosing Ctrl + click on the left mouse button on the name of the corresponding development object.

Note
If no Eclipse-based tool is available for the selected development object, the suitable tool will be opened in the SAP GUI.

Note
For development objects from the Source Library, the function
Open With
SAP GUI
in the context menu of the Project Explorer is at your
disposal. This additional option is required in certain individual cases only. If you execute this function, the selected object will be opened in the SAP GUI
tool, which, in turn, means that the standard Eclipse-based navigation will be suppressed. Keep in mind, however, that this function does not change the
standard behavior; opening the same object text again by means of double-click, for example, opens the Eclipse-based source code editor.

Related Information
Opening Development Objects in Another System
Opening Development Objects in the SAP GUI
Linking to Open Development Objects in Another ADT Installation
Searching Development Objects
Tools for ABAP Development
Status of a Development Object

1.1.2.2 Opening Development Objects in Another System


This functionality enables you to navigate quickly between two versions of the same development object in two different projects.

Prerequisites
The same development object has to exist in the system in which you want to open it.
The shortcuts are only provided in SAP NetWeaver Release 7.40 SP09 and higher.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 15 of 138

Procedure
1. You can initiate the functionalities from the following positions:
Select the relevant node in the Project Explorer .
Open the development object in the ABAP source code editor .
2. Open the context menu and choose Open in Project.

Tip
Alternatively, you can use the Ctrl Alt P shortcut to open the submenu with the project list directly.
3. Select the project in which you want to open the development object.

Note
If the project does not exist, you can create a new one by selecting New Project...

Note
Alternatively, you can also use the Alt Shift P shortcut. ABAP Development Tools (ADT) then automatically opens the development object in
the project you opened previously. Thus, you can easily toggle between both projects.

Results
In the editor, the development object of the other system is opened.

Related Information
ABAP Development Objects
Tools for ABAP Development
Comparing Source Code
Opening Development Objects

1.1.2.3 Opening Development Objects in the SAP GUI


Native integrated development objects like ABAP classes, DDLs, Web Dynpro components, and so on, have their own editor and can be opened in ABAP
Development Tools (ADT).
Development objects, that are not yet integrated in ADT are displayed in the Project Explorer with the
icon. For these objects, the conventional GUIbased tools of the ABAP Workbench are opened in the editor area where ABAP programming is taking place. For each additional development object that is
opened in the SAP GUI, a separate editor tab is provided.
With this GUI-based tool, you have complete access to the functionality of the traditional ABAP Workbench. For example, you can start any application you
want by entering a transaction code or OK code. This is already the case whenever you have to release your Workbench requests in the Transport Organizer
or whenever you use the traditional Dictionary tools in order to create or process database tables or structures, for example. These tools are made available
in ABAP Development Tools through the SAP GUI, which is installed locally together with the Eclipse-based client. The tight integration of the SAP GUI
involves seamless navigation to all development objects and applications within the ABAP IDE.

Figure 1: Display of a structure opened in the SAP GUI

The following examples are use cases of when and how to open a development object in the SAP GUI:
1. Open a development object in the default editor that is supported.
2. Open a development object in the SAP GUI.
3. Launch the SAP GUI completely independently of the development object selection.

Use Case 1
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 16 of 138

You want to open a development object from the Project Explorer in the assigned editor.
To do this, double-click the corresponding development object in the Project Explorer.
If the selected development object is not supported with its own Eclipse-based editor, the appropriate SAP GUI transaction opens in the editor area.

Use Case 2
You want to open a development object that is supported by an Eclipse-based editor in the SAP GUI in order to use a function that is not provided in ADT.
To do this, open the context menu for the corresponding development object in the Project Explorer and select Open with SAP GUI.
The selected development object opens with the appropriate transaction of the SAP GUI in the editor area.

Use Case 3
You want to start the SAP GUI completely independently of the development object selection. For example, you want to change user settings or you want to
be able to access random functions within the SAP system. For this purpose, the IDE provides the GUI Launcher.
To open the SAP GUI using the SAP GUI Launcher from the SAP GUI Launcher proceed as follows:
1. Click the icon
(Open SAP GUI) in the toolbar.
2. [Optional:] Select the relevant ABAP project.
3. [Optional:] Select the Navigate to ADT editor in Eclipse for supported development objects option if you want to open native integrated development
objects in ADT whenever you select them from the embedded SAP GUI.
A predefined start application, such as the SAP Easy Access ABAP Workbench, will be launched in the editor area of the ABAP Perspective.

Related Information
Tools for ABAP Development
Opening Development Objects
Opening Development Objects in Another System
Running Executable Objects

1.1.2.4 Selecting a Main Program for Multiple-Use ABAP Includes


To enable certain functions (for example, ABAP syntax check, navigation, and so on) in the ABAP source code editor , you need to select a main program for
the include.

Prerequisites
This functionality is provided in SAP NetWeaver 7.4 SP08 and higher as well as in 7.31 SP14 and higher.

Context
Typically, an ABAP include is used by exactly one main program. This main program is then automatically selected by ABAP Development Tools (ADT).
If an include is used in several main programs, you need to select a specific main program in order for the functionality to be executed.

Procedure
1. Open an include that is used in several main programs by double-clicking, for example, from the Project Explorer or a search result list, or by pressing
Cltr + Shift + A.
A dialog is opened for selecting a main program. If possible, ADT already preselects the most relevant main program.

Figure 1: Dialog for selecting a main program

2. From the selection list, choose the main program you want to use.
3. Confirm the selection with OK.

Results
Depending on your selection, you may have the following results:

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 17 of 138

1. If you have selected a main program, all the functions that are now executed in the ABAP source code editor will take the selected main program into
consideration.
2. If you have not selected any main program and you are executing an operation such as syntax checking, activating, and so on, an error message will be
displayed in the status bar. You can then select a main program from the Properties view, as described below, and repeat your operation. Otherwise,
you can only continue working with functionalities that are independent of the main program.
The selection is valid until you close the include editor. Alternatively, without closing the include editor, you can select another main program by opening the
Properties view. In the Specific tab, your previous selection is displayed. Here, you can also select a main program from the dropdown list.

Figure 2: Specific tab in the Properties view for selecting a main program

Related Information
ABAP Development Objects
Transport Request
Tools for ABAP Development
Creating an ABAP Function Group Include
Adding Include Suffixes
Creating ABAP Includes from Usage

1.1.2.5 Registering for an ABAP System or SAP Objects


SAP Software Change Registration (SSCR) is a procedure for registering developers and manual changes to SAP source code and dictionary objects in an
ABAP-based system.
This results in the following registrations for the purpose of accessing a customer system in order to:
Perform any developments in the ABAP source code as a developer
Change SAP objects

Developer Registration
You have to register with a 20-digit access key if you want to create, edit, or delete a development object in an ABAP-based SAP system for the first time.
For this purpose, a dialog is opened where you have to enter the Access key. The developer registration has to be performed only once in a given system.
You obtain the access key on the SAP Service Marketplace

: SAP SUPPORT PORTAL > Keys & Requests > SCCR Keys > Registration

For the registration, you have to specify the following information:


Unique installation number of the customer system
User name

Registration for Modifying SAP Objects


You need a 20-digit access key to create, edit, and delete a development object in the SAP namespace. For this purpose, a dialog is opened where you have
to enter the Access key. The object registration is required only once per SAP object and relates to the subsequent modifications of a specific SAP object.
You obtain the access key on the SAP Service Marketplace

: SAP SUPPORT PORTAL > Keys & Requests > SCCR Keys > Registration

For the registration, you have to specify the following information:


Unique installation number of the customer
Transport ID
Transport type of the development object
Name of the development object
Release of the installation

Related Information
ABAP Development Objects
Tools for ABAP Development
http://help.sap.com/saphelp_nw73ehp1/helpdata/en/c8/19766d43b111d1896f0000e8322d00/content.htm
Modifying Development Objects in the SAP Namespace
Creating ABAP Classes

1.1.2.6 Creating Development Objects


Prerequisites

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 18 of 138

The subsequent steps require that an APAP project exists for the relevant back-end system.
You have identified the package in which the development object is going to be created.

Tip
If you have not yet already done so, add this package to the favorites of your ABAP project. See also: Adding or Removing a Favorite Package

Context
Using the ABAP project as a starting point, you can create any arbitrary development object for the ABAP Repository. However, the procedure is somewhat
different, depending on the object type to be created.
While the creation procedure for some source code-based object types (classes, interfaces, programs) is completed fully when you use Eclipse-based
wizards, other development objects - such as DDIC elements or ABAP packages are created using the SAP GUI.

Procedure
1. Select the relevant package node in the Project Explorer.
2. Open the context menu and choose
New
[Object Type or Category]
to launch the creation wizard or start the corresponding GUI tool,
respectively.
3. Specify the basic properties of the development object to be created.
4. Assign a transport request. NOTE: Not required for $ packages and for LOCAL packages, for which the changes are NOT going to be recorded in the
Transport Organizer.

Related Information
ABAP Development Objects
Tools for ABAP Development
Messages and Message Classes
Modularization with Function Modules
Creating ABAP Classes
Creating an ABAP Function Group
Creating an ABAP Function Module
Creating an ABAP Function Group Include
Creating a Message Class

1.1.2.6.1 Creating ABAP Classes


Context
You can create local or global ABAP classes to build a template for objects.

Note
The following procedure is for all development objects that you can create completely using the Eclipse-based wizards. ABAP interfaces and executable
programs are created in a similar manner.

Procedure
1.
2.
3.
4.

In the Project Explorer, select the relevant package node.


Open the context menu and choose
New
ABAP Class
to launch the creation wizard.
Specify the Project and Package properties of the ABAP class to be created.
Enter the Name and Description for the class to be created and choose Next.

Note
Use [Your Prefix]CL_[Your Class Name] as the name.
5. Enter the name of the Superclass in case the new class has to be inherited from a specific superclass.

Tip
When editing the superclass, you can avail of the content assistant functionality by pressing Ctrl + Space.
6. Assign a transport request.
Select the Choose from requests in which I am involved radio button to pick an already existing transport request.
Select the Create a new request radio button in order to generate a new transport request. In the Request description field, type further
information.
Select the Enter a request number in order to add your class to an existing request. Choose the Browse... button if you want to select a request
that has already been created by a certain user.
7. Start the creation with Finish.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 19 of 138

Results
The back-end system creates an inactive version of a class pool in the selected package that is stored in the class library of the repository. In the Project
Explorer, the new class is added to the Source Library of the corresponding package node. In the source code editor, the initially generated source code is
displayed and ready for editing.
After you have created an ABAP class, the following tabs are available in the class editor:
Tab

Description

Global Class

Class that is stored in the class library of the central ABAP Repository

Class-Relevant Local Types

Contains local definitions that are referenced in the private section of the global
class

Note
When these local definitions are changed, all subclasses and friends of the
global class must be recompiled because they might depend on these
definitions.
Local Types

Contains local definitions that are NOT referenced by the global class

Test Classes

Contains ABAP Unit test classes that enable automated tests during the
development phase

Macros

Allows you to add macro definitions for the given global class

Caution
Macros are regarded as obsolete technology and should no longer be used in
ABAP classes.

Related Information
ABAP Development Objects
Transport Request
Tools for ABAP Development
Creating ABAP Exception Classes
Creating ABAP Projects
Adding or Removing a Favorite Package

1.1.2.6.2 Creating ABAP Exception Classes


Context
You create an exception class to build a template for objects in order to handle a class-based error. In this case, a certain message is displayed that is
defined with an exception ID that displays a certain T100 message.

Note
An ABAP exception class is automatically created whenever one of the following superclasses is added to an ABAP class:
CX_STATIC_CHECK
CX_DYNAMIC_CHECK
CX_NO_CHECK

Procedure
1.
2.
3.
4.

In the Project Explorer, select the relevant package node.


Open the context menu and choose
New
ABAP Class
to launch the creation wizard.
Specify the Project and Package properties of the class to be created.
Enter the Name and Description for the class to be created and choose Next.

Note
Use [Your Prefix]CX_[Your Class Name] as the name.
5. In the Superclass field, enter one name of the following superclasses:
CX_STATIC_CHECK
CX_DYNAMIC_CHECK
CX_NO_CHECK
When editing the superclass, you can avail of the content assistant functionality by pressing Ctrl + Space.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 20 of 138

Figure 1: Creation of an exception class with CX_STATIC_CHECK as superclass

6. In the following window, select a transport request in order to handover your new class to another system.
Select the Choose from requests in which I am involved radio button to pick an already existing transport request.
Select the Create a new request radio button in order to generate a new transport request. In the Request description field, you can type further
information.
Select the Enter a request number in order to add your class to an existing request. Choose the Browse... button if you want to select a request
that has already been created by a certain user.
7. Start the creation with Finish.

Results
The exception class is created just like a regular ABAP class. Therefore, the back-end system creates an inactive version of a class pool in the selected
package that is stored in the class library of the repository. In the Project Explorer, the new class is added to the Source Library of the corresponding
package node.
In the source code editor, the initially generated source code is displayed and ready for editing. In addition, the constructor method of the superclass that is
declared in the public section is added. It contains generated code that reflects the current state of the class hierarchy. Any further changes to the superclass
constructor or the class itself will not trigger automatic adaption of the constructor code in the exception class.
The constructor code can be only regenerated by executing the cleanup utility in the back-end. As a result, your own code in the constructor method will be
lost in ADT after the cleanup.

Note
Additional tabs are available in the source code editor of the exception class. For more information, see Creating ABAP Classes

Note
In the exception class, you can add a code template to the definition part. This enables you to reuse source code in order to display a specific T100
message. For more information, see Adding Code Templates to an ABAP Exception Class

Related Information
ABAP Development Objects
Tools for ABAP Development
Creating ABAP Classes
Creating ABAP Projects
Adding Code Templates to an ABAP Exception Class
Adding or Removing a Favorite Package
Exception Handling

1.1.2.6.3 Creating an ABAP Function Group


Context
You create an ABAP Function Group in order to group function modules and includes with similar or complementary functions.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 21 of 138

Procedure
1.
2.
3.
4.
5.
6.
7.
8.

In your ABAP project, select the relevant Package node in the Project Explorer.
Open the context menu and select
New
Other Repository Objects .
Expand the Source Library folder and select ABAP Function Group.
Choose Next.
In the following dialog, enter a unique name for the new function group in the Name field. NOTE: You can enter maximum 26 digits.
Enter a Description providing additional details. NOTE: The Original Language is already predefined by the default language of the ABAP project.
Choose Next.
Assign a Transport Request. NOTE: Not required for $ packages and for LOCAL packages, for which the changes are NOT going to be recorded in the

Transport Organizer.
9. Choose Finish.
10. Activate the new ABAP Function Group.

Results
The ABAP repository creates a new function group in the selected package and adds it in the Project Explorer to the Source Library folder.
The function group automatically contains a TOP include and a UXX include.

Figure 1: Display of created includes as new folder level in the Project Browser and source code in the definition part

Related Information
Creating an ABAP Function Module
Creating an ABAP Function Group Include
Modularization with Function Modules

1.1.2.6.4 Creating an ABAP Function Module


Prerequisites
You have created a function group in which you want to add the function module.

Context
You can create an ABAP Function Module for which you provide reusable functions.

Procedure
1.
2.
3.
4.

In your ABAP project, select the relevant Package node in the Project Explorer.
Expand the Source Library folder and select the relevant Function Group.
Open the context menu and select
New
ABAP Function Module .
In the following dialog, enter a unique name for the new function group in the Name field.

Note
You can enter maximum 30 digits.
5. Enter a Description providing additional details.

Note
The Original Language will automatically be assigned with the same language as defined in the function group.
6. Enter a Description providing additional details.

Note
The Original Language is already predefined by the default language of the ABAP project.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 22 of 138

7. [Optional] Choose the Browser... button if you want to add the function module to another Function Group.
8. Choose Next.
9. Assign a Transport Request.

Note
Not required for $ packages and for LOCAL packages, for which the changes are NOT going to be recorded in the Transport Organizer.
10. Choose Finish.

Results
The function module is assigned to the function group selected in the function module folder of the Source Library.

Figure 1: Editor that is displayed after creating the function module

In the next step, you can enter the definition part and implementation part of the function module.

Related Information
Creating an ABAP Function Group
Creating an ABAP Function Group Include
Adding a Definition Part and Implementation Part to a Function Module
Modularization with Function Modules

1.1.2.6.4.1 Adding a Definition Part and Implementation Part to a


Function Module
Context
Procedure
1. Open the function module in the editor.
2. Edit the definition part in the editor.

Note
Finish the definition part with a period.

Caution
Do not add any comments to parameters in the definition part. Otherwise they will be deleted after saving and activating the function module.

Tip
You can use the following template in the definition part of your function module:
IMPORTING
IM_PARAM1 TYPE ANY
IM_PARAM2 TYPE REF TO <ref_type>
EXPORTING
EX_PARAM_1 TYPE ANY
EX_PARAM_2 TYPE REF TO <ref_type>
CHANGING
CH_PARAM TYPE ANY
TABLES

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 23 of 138

TAB_PARAM TYPE STANDARD TABLE


EXCEPTIONS
EXCEPTIONS_VALUE.
3. Edit the implementation part in the editor.

Caution
Do not start your own comments with *" or *"--- as these are reserved for the parameter block in the function editor of the back end. Start your
comments for each line with * or ". Note: Consider the implementation part as finished with ENDFUNCTION..
4. Save the editor contents.
5. Activate the ABAP Function Module.

Related Information
Creating an ABAP Function Group
Creating an ABAP Function Module
Modularization with Function Modules

1.1.2.6.5 Creating an ABAP Function Group Include


Prerequisites
You create an ABAP Function Group Include to separate and modularize functionality.

Context
You can create an ABAP Function Module to which you provide reusable functions.

Procedure
1.
2.
3.
4.

In your ABAP project, select the relevant Package node in the Project Explorer.
Expand the Source Library folder and select the relevant Function Group.
Open the context menu and select
New
ABAP Function Group Include .
In the following dialog the Name will automatically be entered.

Note
The name will be constructed using the following convention: [/name space/] [L<Name of the function group>ID of the include
suffix]. L stands for the standard prefix for ABAP function group includes.
5. Enter a Description that provides additional details.

Note
The Original Language will automatically be assigned with the same language as defined in the function group.
6. [Optional] Click the button Browser... if you want to add the function module to another Function Group.
7. Enter the Suffix for the include.

Note
See Adding Include Suffixes for more details.
8. Choose Next.
9. Assign a Transport Request.

Note
Not required for $ packages and for LOCAL packages, for which the changes are NOT going to be recorded in the Transport Organizer.
10. Choose Finish.
11. Activate the new ABAP Function Group Include.

Results
The include will be created on the relevant function group in the Project Browser. It will also be added with the statement INCLUDE <Include Name> into
the main program.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 24 of 138

Figure 1: Display of the created group include in the Project Browser and in the editor of the main program

Related Information
Modularization with Function Modules
Creating an ABAP Function Group
Adding Include Suffixes
Selecting a Main Program for Multiple-Use ABAP Includes

1.1.2.6.5.1 Adding Include Suffixes


Context
You can add following suffixes to the ABAP function group includes:
Include Type

Prefix

Suffix

Usage

Top include

TOP

Declaration of global data of the function


group

DNN

Declaration of local classes

Optional include

D..*

Declaration of local classes definitions


that are to be included in the top include
of the function groups

Include

UXX

Implementation section of the function


group that includes all existing U..
includes NOTE: These includes are not
editable.

U01-99

For each function module of the function


group

T99

For ABAP unit test classes that are to be


included in the implementation section of
the function group

P..*

Methods of local class implementations

PNN

Implementation of local classes that are


to be included in global data of the
function groups

O..* and ONN

PBO modules of dynpros that are to be


included in the implementation part of
the function group

I..* and INN

PAI modules of dynpros that are to be


included in the implementation plant of

Optional include

the function group


E..*

Event blocks in the implementation part


of the function group

F..*

Subroutines in the implementation part of


the function group

*The periods '..' represents a double-digit number.

Note
$nn, Unn, Vnn, Cnn, T01 - T98 are reserved suffixes. They cannot be used.

Related Information
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 25 of 138

Related Information
Creating an ABAP Function Group Include
Modularization with Function Modules

1.1.2.7 Working with Messages and Message Classes


You can create and group messages in message classes in order to inform the user about an error or a status, or to issue a warning.

Context
Note
You have to activate a message class after you have edited or created it.

Related Information
Messages and Message Classes
Message Types
Creating a Message Class
Adding a Message to a Message Class
Adding a Long Text to a Message
Filtering Messages in Message Classes
Opening a Message from the Source Code in the Message Class Editor
Opening Development Objects in Another System
Displaying Details of Source Code Elements
Previewing a Message Long Text
Sharing Links of Selected Messages
Searching the Usage (Where-used) of a Message

1.1.2.7.1 Creating a Message Class


Context
You create a message class to group and reuse messages in a development object.

Procedure
1.
2.
3.
4.
5.
6.

In the ABAP perspective, expand the corresponding package node.


In the context menu of the package, choose
New
Other ABAP Repository Object .
In the New ABAP Repository Object window, select the Message Class folder and expand it.
Choose Message Class.
Choose Next.
In the Name field, enter the Name of the new message class.

Note
You can enter up to 20 digits, maximum.
7. In the Description field, enter a description that provides additional details.
8. Choose Next.
9. Assign a Transport Request Option and start the creation of the message class with Finish.

Results
In the Project Explorer, the new view is added to the Dictionary folder of the corresponding package node.
As a result of this creation procedure, the editor will be opened. You can now add messages to the message class.

Related Information
Adding a Message to a Message Class
Adding a Long Text to a Message
Filtering Messages in Message Classes
Opening a Message from the Source Code in the Message Class Editor
Opening Development Objects in Another System
Previewing a Message Long Text
Sharing Links of Selected Messages
Messages and Message Classes
Message Types
Transport Request

1.1.2.7.2 Adding a Message to a Message Class


PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 26 of 138

1.1.2.7.2 Adding a Message to a Message Class


Prerequisites
An appropriate message class to which you want to add a message must exist.

Context
You create or edit a short text that is going to be used by an application.

Procedure
1. In the ABAP perspective, expand the corresponding package node.
2. Double-click the Message Class level.
3. In the menu bar of the editor, choose the New button or directly type the message number in the <Enter new value> field. NOTE: In order to continue a
certain message number range, select the message with the message number that you want to continue. So, the editor creates the new massage with
the following message number. If you don't select a message, the editor automatically continues with the next available message number.
4. Enter the message number.

Note
Enter a unique 3-digit message number that is not already used in the corresponding message class.
5. In the editor double-click in the Short Text field.

Note
If you edit an existing message, the whole message class is blocked for other users. The blockage is closed after saving your changes.
6. Enter the message short text.NOTE: You can enter up to 73 digits, maximum.
7. Specify for each message if it is Self Explanatory.

Note
Messages that are marked as self-explanatory need no further explanations. If this checkbox is not activated a long text has to be added.
8. Save your entries.

Results
The system creates the message in the development object Message Classes and can be called in an ABAP program using the message statement. The
message is stored in table T100 and can be displayed.

Related Information
Creating a Message Class
Adding a Long Text to a Message
Filtering Messages in Message Classes
Opening a Message from the Source Code in the Message Class Editor
Opening Development Objects in Another System
Previewing a Message Long Text
Sharing Links of Selected Messages
Messages and Message Classes
Message Types

1.1.2.7.3 Adding a Long Text to a Message


Prerequisites
A message of an appropriate valid message class must exist in a program.

Context
If you need to display a message with more than 73 digits, enter a long text for the message.

Note
Long text can be added to every message which is not marked as self-explanatory. If you add long text to a message, the editor will automatically
deactivate the checkbox.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 27 of 138

Procedure
1. In the ABAP perspective, expand the corresponding package node.
2. Double-click the Message Class level.
3. Select the message to which you want to add a long text.

Note
You can only add a long text to a message, if the message is not marked as Self Explanatory.
4. [Optional] Deactivate the checkbox Self Explanatory.
5. Choose button Long Text in the message class editor.
A SAP GUI will be opened where you can add a long text to the message.
6. Enter the long text in the SAP GUI editor by adding the text for the corresponding information level.
You can enter the following information levels, for example:
Cause: Reason why the problem occurred.
System Response: Details about the result of attempts made by the system to succeed.
What to do: Procedure for next steps, to be performed by the user.
Sys Admin: Procedure for next steps, to be performed by the system administrator.

Figure 1: Display of the Workbench editor where you add a long text to a message

7. Save the entries.


8. Activate the message class.

Results
The entered text will be saved in the master language of the ABAP project.

Note
All messages which have been created or changed will be locked until they are saved. So, no other user can edit them until they are saved.

Related Information
Creating a Message Class
Adding a Message to a Message Class
Filtering Messages in Message Classes
Opening a Message from the Source Code in the Message Class Editor
Opening Development Objects in Another System
Previewing a Message Long Text
Sharing Links of Selected Messages
Messages and Message Classes
Message Types

1.1.2.7.4 Previewing a Message Long Text


Prerequisites
You can only preview the long text:
if the ABAP project is opened in the original language. If no translation is available, a standard message is displayed.
if the message is not activated as self-explanatory.

Context
In the Long Text Preview window, you can display the long text of a message that was added through the back end in an ABAP project.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 28 of 138

This enables you to obtain the following information without opening the SAP GUI:.
Header: Message number and short text, so you can check that you have selected the desired message
Main frame: Long text that was added to the message
Example

Figure 1: Long Text Preview window with the long text of the selected message

Procedure
1.
2.
3.
4.

In the ABAP perspective, expand the corresponding package node.


Select the corresponding message class in the Message Class node.
In the Message Class editor, select the message class with the long text.
In the toolbar, select the Preview button.

Results
The Long Text Preview window is opened, displaying the long text that was added to this message in the back end.

Related Information
Creating a Message Class
Adding a Message to a Message Class
Adding a Long Text to a Message
Filtering Messages in Message Classes
Opening a Message from the Source Code in the Message Class Editor
Opening Development Objects in Another System
Sharing Links of Selected Messages
Messages and Message Classes
Message Types

1.1.2.7.5 Filtering Messages in Message Classes


Context
You filter for short texts and message numbers to search for particular messages of a message class. This functionality helps you to find and reuse
messages which already exist. So you can prevent creating the almost identical message several times.

Note
The message class editor displays per default all messages which are defined in the message class.
Example
You want to check if there are messages which contain the combination 'airline carrier' in the short text. After you have entered this combination in the filter
text field, the editor will automatically display the corresponding messages.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 29 of 138

Procedure
1. In the Project Explorer, expand the relevant package node.
2. Double-click the relevant Message Class node.
3. In the filter text field of the message class, enter the text or message number, which you want to search for.

Figure 1: Message class editor with the filer text field

Results
After entering the filter text the editor will automatically display the reduced set of messages.

Tip
Delete the filter text to display all messages of the message class.

Related Information
Creating a Message Class
Adding a Message to a Message Class
Adding a Long Text to a Message
Opening a Message from the Source Code in the Message Class Editor
Opening Development Objects in Another System
Previewing a Message Long Text
Sharing Links of Selected Messages
Searching the Usage (Where-used) of a Message
Messages and Message Classes
Message Types

1.1.2.7.6 Opening a Message from the Source Code in the


Message Class Editor
Context
You can open a message in the message class editor from the source code editor of any source-based objects such as classes, function modules, or ABAP
programs.

Procedure
In the source code editor, choose Ctrl + left mouse button or F3 on the corresponding message number.

Results
The message class editor is opened and the number of the selected message is highlighted.

Related Information
Creating a Message Class
Adding a Message to a Message Class
Adding a Long Text to a Message
Filtering Messages in Message Classes
Opening Development Objects in Another System
Previewing a Message Long Text
Sharing Links of Selected Messages
Searching the Usage (Where-used) of a Message

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 30 of 138

Messages and Message Classes


Message Types

1.1.2.7.7 Sharing Links of Selected Messages


Prerequisites
You can only copy the hyperlink if the message is saved.

Context
You can initiate the creation of a hyperlink that refers to a specific message of a message class. The receiver can then open the referenced message directly
in ABAP Development Tools (ADT) in the corresponding ABAP project.
For this purpose, you can generate an email where the hyperlink path is added or paste it from the clipboard manually into any document.

Procedure
1.
2.
3.
4.

In the Message Class editor, select the message.


In the toolbar, select the Share link for selection... button.
In the Share Link for Selection dialog, select ADT Link.
Choose Email link to generate an email from your default email client.
An email is opened that contains a generated header and the hyperlink.
5. [Optional:] Choose the Copy link to clipboard button and paste the link into any document.

Results
The hyperlink path is then saved in temporary storage. If you paste it in your document or editor, the path is added as text.
Example
The following example displays the URL of a specific message:
adt://[ABAP system name]/sap/bc/adt/messageclass/demo_message_class/messages/100

Note
In order to make a hyperlink click-sensitive, the receiver needs to define the application that is launched when opening a hyperlink.
You need to define ADT as the installation to be opened. Note that for an MS Windows operating system, you can set the handler path on the preferences
page:
Window
Preferences
ABAP Development
and activate the ADT Link Handling option. Alternatively, you can select
Navigate
Open
ADT Link
from the menu bar. This functionality enables you to enter the copied URL and open the referenced message directly.

Related Information
Linking to Open Development Objects in Another ADT Installation
Linking to Selected Parts of ABAP Source Codes
Creating a Message Class
Adding a Message to a Message Class
Adding a Long Text to a Message
Filtering Messages in Message Classes
Opening a Message from the Source Code in the Message Class Editor
Opening Development Objects in Another System
Previewing a Message Long Text
Messages and Message Classes
Message Types

1.1.2.7.8 Searching the Usage (Where-used) of a Message


Context
In the message class editor, you can provide the where-used list in order to display the usage of a message.

Note
See more in Searching Usages (Where-Used)

Related Information
Searching Usages (Where-Used)
Creating a Message Class
Adding a Message to a Message Class
Adding a Long Text to a Message

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 31 of 138

Opening a Message from the Source Code in the Message Class Editor
Messages and Message Classes
Where-Used Function

1.1.2.8 Adding Code Templates to an ABAP Exception Class


Context
In the source code editor of an ABAP exception class, you can add the code template textIdExceptionClass. This code template contains the constant
definitions for assigning the message number and attributes of a message class that are to be displayed.

Procedure
1. In the private section of the ABAP exception class, type textID and open the code completion window.

Sample Code

2.

This code template is added:


<example>The code template is added:<codeblock><codeph>CONSTANTS:
BEGIN OF [Name of the exception class],
msgid TYPE symsgid VALUE 'msgid',
msgno TYPE symsgno VALUE 'msgno',
attr1 TYPE scx_attrname VALUE 'attr1',
attr2 TYPE scx_attrname VALUE 'attr2',
attr3 TYPE scx_attrname VALUE 'attr3',
attr4 TYPE scx_attrname VALUE 'attr4',
END OF [Name of the exception class].
</codeph>
</codeblock></example>
Add the textIdExceptionClass code template from the popup.
3. In the framed entry fields of the code template, replace the following variables:
1. Add the name of the message class in the msgid field.
2. Add the message number in the msgno field.
3. [Optional:] If the message contains attributes, add the value for the corresponding <emphasis>attr</emphasis> attribute that should be filled in the
message.

Results
EXAMPLE
In the following example, you see the code snippet of an ABAP exception class referring to a message in the message class BC_DATAMODEL_SERVICE.
There is the exception class CX_MY_EXCEPTION_CLASS:
1. The relevant message class has the ID BC_DATAMODEL_SERVICE.
2. The message that should be displayed has the number 118 and contains the short text 'Number of booked places &1 exceeds flight
capacity &2'.
3. The containing variables &1 and &2 are replaced by the values of the attributes BOOKED_SEATS with the value '242 and SEATS with the value '200'.
As a result, the exception message is displayed as 'Number of booked places 242 exceeds flight capacity 200'.

Sample Code
CONSTANTS:
BEGIN OF CX_MY_EXCEPTION_CLASS,
msgid TYPE symsgid VALUE 'BC_DATAMODEL_SERVICE',
msgno TYPE symsgno VALUE '118',
attr1 TYPE scx_attrname VALUE 'BOOKED_SEATS',
attr2 TYPE scx_attrname VALUE 'SEATS',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF CX_MY_EXCEPTION_CLASS.
DATA seats TYPE i READ-ONLY.
DATA booked_seats TYPE i READ-ONLY.

Related Information
ABAP Development Objects
Tools for ABAP Development
Creating ABAP Classes
Creating ABAP Exception Classes

1.1.2.9 Modifying Development Objects in the SAP Namespace


PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 32 of 138

Context
If you are dealing with a support request, pre-correction, and so on you have to create, edit, or delete SAP objects.
In the current version of your Eclipse installation, you can modify the following SAP objects using ABAP Development Tools for SAP NetWeaver (ADT):
Database procedure proxies
SAP HANA transport container
External views
Core Date Services (CDS) entities
Repository objects as follows (Only in SAP NetWeaver 7.4 SP6 and higher):
ABAP classes (Only in SAP NetWeaver 7.4 SP5 and higher)
ABAP programs
ABAP Include
ABAP function group includes
ABAP function modules
ABAP interfaces

Note
The modifications are overwritten after a new release or support package has been implemented. But, they can be adopted by comparing and adjusting the
versions of the object in transaction SPAU.
Example
If you edit an ABAP class in the SAP namespace, the Limited modification support window is opened.

Figure 1: Example of a Limited modification support window that is opened if you want to edit an ABAP class in SAP's namespace

Here you can choose the environment you want to work with:
Edit in SAP GUI: It is recommended to edit your changes in the form-based editor of the SAP GUI. Because, then the Modification Assistant is enabled
and your changes are recorded in the transaction SPAU.
Edit in Eclipse (no ModAss): If you want to edit your changes in the source code editor of ABAP Development Tools. Note that the Modification
Assistant is disabled for all modified development artifacts.

Note
The behavior of the other source-code based objects is similar.

Related Information
ABAP Development Objects
Tools for ABAP Development
Registering for an ABAP System or SAP Objects
Creating ABAP Classes
The Modification Assistant
General Functions of Transaction SPAU

1.1.2.10 Adding Local Objects of Other Users to Favorites


Context
You can display and edit the local development objects from other users. This enables you to reuse a section of code for your own development activities.

Procedure
1. Select the relevant ABAP project in the Project Explorer.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 33 of 138

2. Click Add Local Objects of User... in the context menu of the Favorite Package.
3. In the Select a user field, enter the user name for selection. Then choose OK.

Tip
When editing the User Name, you can benefit from the content assistant functionality by pressing Ctrl + Space.

Results
The last activated local objects from the chosen user are added to the Favorite Packages.

Related Information
Status of a Development Object
Searching Development Objects

1.1.2.11 Copying and Duplicating Source Code Based Objects


Context
You can create copies of the source code from the following development objects:
ABAP class
ABAP interface
ABAP program (requires SAP NetWeaver 7.4 SP5 / 7.31 SP11 or higher)
For this, following functionalities are provided:
Copying Source Code Based Objects to copy and paste the exact same entity into another ABAP package of your choice.
Duplicating Source Code Based Objects to create exact same entity in a selected ABAP package.

Note
You can only copy and paste as well as duplicate within the same ABAP system.

Related Information
ABAP Development Objects
Tools for ABAP Development
Creating ABAP Classes
Adding Local Objects of Other Users to Favorites

1.1.2.11.1 Copying Source Code Based Objects


Context
Note
You cannot copy includes that are contained in ABAP programs.

Procedure
1. Select the relevant node for the development object in the Project Explorer .
2. Open the context menu and choose Copy .
3. Open the context menu in the package to which you want to add the new development object. Choose Paste to create the selected development object
into an package of your choice.
4. In the creation wizard, enter the required data corresponding to the development object.
5. Choose Next .
6. Assign a transport request and start the creation process with Finish .

Results
In the Source Library folder, a new and inactive development object is created and opened in the source code editor.

Note
If you copy ABAP classes or interfaces, existing references are automatically changed in the source code to the name of the new development object.

Related Information
Copying and Duplicating Source Code Based Objects
Duplicating Source Code Based Objects

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 34 of 138

Duplicating Source Code Based Objects

1.1.2.11.2 Duplicating Source Code Based Objects


Procedure
1.
2.
3.
4.
5.
6.

Select the relevant node for the development object in the Project Explorer .
Open the context menu and choose Duplicate .
In the creation wizard, enter the required data corresponding to the development object.
Select the package where you want to add the to be created development object by choosing the Browse... button.
Choose Next .
Assign a transport request and start the creation process with Finish .

Results
In the Source Library folder, a new and inactive development object is created and opened in the source code editor.

Note
If you duplicate ABAP classes or interfaces, existing references are automatically changed in the source code to the name of the new development object.

Related Information
Copying and Duplicating Source Code Based Objects
Copying Source Code Based Objects

1.1.2.12 Sharing a Link to a Development Object


Prerequisites
You need access permissions for the corresponding ABAP system and at least the read permissions for the linked development object.

Context
You can share a specific development object or a highlighted part of ABAP source code with other ABAP developers in order to communicate, for example, a
programming improvement. For this purpose, ABAP Development Tools (ADT) provides the option of creating hyperlinks to development objects. The receiver
can then open the corresponding source code in another Eclipse-based IDE as well as in a Web browser.
The following functions for sharing ABAP source code are available:
Linking to Open Development Objects in Another ADT Installation You create a hyperlink to open a development object directly in the referenced ABAP
project within another ADT installation.
Linking for Displaying ABAP Source Code in a Web Browser You create a hyperlink to render a development object in a Web browser.
Linking to Selected Parts of ABAP Source Codes You create a hyperlink to highlight a specific section of ABAP source code. The link can be opened in
a Web browser or in the same ABAP system of another ADT installation where the section is marked.

Related Information
Sharing Links of Selected Messages
Copying and Duplicating Source Code Based Objects
ABAP Development Objects
Messages and Message Classes

1.1.2.12.1 Linking to Open Development Objects in Another ADT


Installation
Context
You can initiate the creation of a hyperlink that refers to a specific development object. The receiver can then open the referenced development object directly
in ABAP Development Tools (ADT) in the corresponding ABAP project.
For this purpose, you can generate an email where the hyperlink path is added or paste it from the clipboard manually into any document.
Limitations
ADT links are available for all development objects except trace files, profiler settings, debugger variables, and so on.

Procedure
1. In the Project Explorer , select the development object.
2. In the context menu, select the Share Link... entry.
3. In the Share Link dialog, select ADT Link.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 35 of 138

4. Choose Email link to generate an email from your default email client.
An email is opened that contains a generated header and the hyperlink.
5. [Optional:] Choose the Copy link to clipboard button and paste the link into any document.
The hyperlink path is then saved in temporary storage. If you paste it in your document or editor, the path is added as text.

Results
Example
The following example displays an ADT hyperlink of a specific ABAP class:
adt://[ABAP system name]/sap/bc/adt/oo/classes/cl_demo_test_save

Note
In order to make a hyperlink click-sensitive, the receiver needs to define the application that is launched when opening a hyperlink.
To enable ADT links, you need to define ADT as the installation to be opened. Note that for an MS Windows operating system, you can set the handler path
on the preferences page:
Window
Preferences
ABAP Development
and activate the ADT Link Handling option. Alternatively, you can select
Navigate
Open ADT Link
from the menu bar. This functionality enables you to enter the copied URL and open the referenced development object
directly.
To enable http links, you may need to edit the hyperlink preferences of your operating system.

Related Information
Linking for Displaying ABAP Source Code in a Web Browser
Linking to Selected Parts of ABAP Source Codes
Sharing Links of Selected Messages
Copying and Duplicating Source Code Based Objects
ABAP Development Objects
Messages and Message Classes

1.1.2.12.2 Linking for Displaying ABAP Source Code in a Web


Browser
Prerequisites
To enable this functionality, http access to your ABAP system needs to be activated. For more information, see the chapter "Activating ICF Services in
Development Systems" in the corresponding Configuration Guide for Configuring the ABAP Back-end for ABAP.
Otherwise, the HTTP Link functionality is deactivated in the share link dialog.

Figure 1: Dialog where the HTTP Link functionality is not available due to missing http access activation

This functionality is provided in SAP NetWeaver 7.4 SP08 and higher as well as in 7.31 SP14 and higher.

Context
You can initiate the creation of a hyperlink that refers to a specific development object. The receiver can then open the ABAP source code of the development
object in a Web browser.
For this purpose, you can generate an email where the hyperlink path is added or paste it from the clipboard manually into any document.
Limitations
Http links are available for the following development objects:
ABAP
ABAP
ABAP
ABAP
ABAP
ABAP
ABAP

programs
includes
function groups
function group includes
function modules
classes
interfaces

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 36 of 138

Procedure
1.
2.
3.
4.

In the Project Explorer , select the development object.


In the context menu, select the Share Link... entry.
In the Share Link dialog, select HTTP Link.
Choose Email link to generate an email from your default email client.
An email is opened that contains a generated header and the hyperlink.
5. [Optional:] Choose the Copy link to clipboard button and paste the link into any document.
The hyperlink path is then saved in temporary storage. If you paste it, the path is added as text in your document or editor.

Results
Example
The following example displays a hyperlink of a specific ABAP class that is opened in a specific ABAP system:
https://app.server:44300/sap/bc/adt/oo/classes/cl_gui_alv_grid/source/main

Note
The following prerequisites apply in order to be able to open the hyperlink:
In order to display the ABAP source code of the linked development object in HTML, you need to install a Web browser or a text editor.
A hyperlink handler defines the application that is launched when a hyperlink is opened. This means you have to define a Web browser application
where you want to open the development object.
It might be necessary to make the pasted hyperlink click-sensitive. To do this, edit the hyperlink reference.

Related Information
Linking to Open Development Objects in Another ADT Installation
Linking for Displaying ABAP Source Code in a Web Browser
Sharing Links of Selected Messages
Copying and Duplicating Source Code Based Objects
ABAP Development Objects
Messages and Message Classes

1.1.2.12.3 Linking to Selected Parts of ABAP Source Codes


Context
In a source code-based development object, you can initiate the creation of a hyperlink that refers to a specific element or statement. The receiver can then
open the referenced message directly in ABAP Development Tools (ADT) in the corresponding ABAP project or in a Web browser.
For this purpose, you can generate an email where the hyperlink path is added or paste it from the clipboard manually into any document.

Procedure
1. In the ABAP source code editor, open the development object.
2. Select the element or statement that you want to refer to.
3. In the context menu, select the Share Link for Selection... entry.
The Share Link for Selection dialog is opened.
4. Select ADT Link or HTTP Link for the hyperlink type you want to share.
5. Choose Email link to generate an email from your default email client.
An email is opened that contains a generated header and the hyperlink.
6. [Optional:] Choose the Copy link to clipboard button and paste the link into any document.
The hyperlink path is then saved in temporary storage. If you paste it in your document or editor, the path is added as text.

Results
Example
The following example displays an ADT hyperlink that includes the position details from the selection within a specific ABAP class:
adt://[ABAP system name]/sap/bc/adt/oo/classes/cl_demo_test_save/source/main#start=3,4;end=7,53

Note
In order to make a hyperlink click-sensitive, the receiver needs to define the application that is launched when opening a hyperlink.
To enable ADT links, you need to define ADT as the installation to be opened. Note that for an MS Windows operating system, you can set the handler path
on the preferences page:
Window
Preferences
ABAP Development
and activate the ADT Link Handling option. Alternatively, you can select
Navigate
Open ADT Link
from the menu bar. This functionality enables you to enter the copied URL and open the referenced development object
directly.
To enable http links, you may need to edit the hyperlink preferences of your operating system.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 37 of 138

Related Information
Linking to Open Development Objects in Another ADT Installation
Linking to Selected Parts of ABAP Source Codes
Sharing Links of Selected Messages
Copying and Duplicating Source Code Based Objects
ABAP Development Objects
Messages and Message Classes

1.1.2.13 Displaying Properties of Development Objects


In the Properties view, you can display details, such as the owner, creation date, original language, and so on, of a source code-based development object.

Context
Note
You can change the object description of your own development objects in the Properties view. For this purpose, the Description field is provided. It is
an editable field if the logon language (project language) does not differ from the original language of the object. Otherwise, this field is not editable and is
labeled with a warning decorator.

Note
To display the properties of development objects that can only be opened in the SAP GUI-based editor, double-click the respective node in the Project
Explorer . The assigned editor is then opened and here you can find the properties at the appropriate position.

Procedure
1. Open the relevant development object in the ABAP source code editor.
2. Choose the toolbar menu
Window
Show View
Properties
.
Alternatively, you can open the context menu of the editor and choose

Show in

Properties

Results
The properties are displayed in the Properties view.
Here the following subtabs are provided:
General: Details that are the same for all development objects of this type
Specific: Details that are individual for this type of development object

Figure 1: Displaying properties of an ABAP class

Related Information
ABAP Development Objects
Creating ABAP Projects
Adding or Removing a Favorite Package
Browsing Development Objects in the Project Explorer
Closing ABAP Projects
Deleting ABAP Projects

1.1.2.14 Displaying Source Code Plug-ins

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 38 of 138

Context
In SAP NetWeaver 7.4 SP 5 as well as 7.31 SP11 or higher, you can display in the source code editor of an ABAP class, ABAP program, or an ABAP
function group the source code plug-ins of the available enhancement implementations in the enhancement popup. If there are several enhancement
implementation elements available, the hierarchy of the source code plug-ins is displayed in addition.
In the ruler of the source code editor, the enhancement popup is provided at all enhancement options that are indicated with the source code plug-in marker
.

Procedure
1. In the source code editor, open the relevant development object.
2. In the ruler, hover the cursor over the source code plug-in marker

Figure 1: Code line where an enhancement implementation is available

Note
Do not double-click the enhancement marker, at this would cause a breakpoint to be created.

Results
The enhancement popup is displayed in respect of the number of available enhancement implementations.
Examples
The following enhancement popup is displayed if one source code plug-in is added at an enhancement option:

Figure 2: Enhancement popup for a single source code plug-in

The following enhancement popup is displayed if several enhancement implementations enhance an enhancement option:

Figure 3: Enhancement popup for several source code plug-ins

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 39 of 138

Note
Choose F2 or click into the enhancement popup to set the focus. Now you can navigate within the enhancement popup.
Choose ESC or navigate outside the enhancement popup in order to close it.

Related Information
Enhancement with Source Code Plug-ins
Navigating from Source Code Plug-ins to External Objects

1.1.2.15 Navigating from Source Code Plug-ins to External


Objects
Prerequisites
This functionality is provided in SAP NetWeaver 7.4 SP08 and higher as well as in 7.31 SP14 and higher.

Context
In an enhancement popup of a source code plug-in, you can navigate to external development objects like:
ABAP classes/interfaces
Function modules
Methods
Includes
DDIC objects
Etc.
Limitation
You cannot navigate to elements of the same compilation unit, such as variables.

Procedure
1. In the enhancement popup, position the cursor on the name of the external object.

Figure 1: Position in the enhancement popup where an external object is called

2. Choose F3 or Ctrl + click.

Results
The selected development object is opened in a new editor. Here, you can add, for example, new functionality.

Related Information
Enhancement with Source Code Plug-ins
Displaying Source Code Plug-ins

1.1.2.16 Creating and Editing Text Elements


Context
In SAP NetWeaver 7.4 as well as 7.31 SP11 or higher, you can display or edit text elements of an:
ABAP
ABAP
ABAP
ABAP

class
program
function module, or
include

This enables you to add language-dependent messages that have to be translated. For this, a SAP GUI is opened in a separate tab beside the source code

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 40 of 138

editor.

Note
The master language of the text element is the same as the master language. You can only change the content of a text element that has been created in
the master language.

Procedure
1.
2.
3.
4.

Open an ABAP class, ABAP program, ABAP function module, or ABAP include in the source code editor.
In the context menu, choose
Open Others
Text Elements
to open the SAP GUI-based text editor in a separate tab.
Enter or edit the text element.
Save your changes.

Results
The text element is created. You can now add the code for the text element in the source code.

Related Information
Creating and Maintaining Text Symbols

1.1.2.17 Checking ABAP Syntax


Context
The ABAP syntax check enables you to verify code-based development objects before activating them. You can run the syntax check by:
Working with Manual ABAP Syntax Check
Working with Automatic ABAP Syntax Check While Programming
If syntax errors occur, these are issued to the Problems view and displayed as an ABAP Problem. In addition, the code line with the error is labeled with a
decorator in the ABAP source editor.
If errors occur during the syntax check, these will be issued to the Problems view and displayed there as ABAP Problem. In addition, the code line with the
error is labeled with a decorator in the ABAP source editor.

Figure 1: Syntax errors are displayed in the Problems view

Note
In SAP NetWeaver 7.4 as well as 7.31 SP11 or higher, you can enable the package check during the syntax check. This allows you to check whether you
access objects that are visible in your object. In order to activate this functionality for an ABAP system, select the following option from the menu bar:
Project
Properties
ABAP Development
Editors
Do package check during syntax check

Related Information
ABAP Development Objects
Creating ABAP Projects
Adding or Removing a Favorite Package
Browsing Development Objects in the Project Explorer
Closing ABAP Projects
Deleting ABAP Projects

1.1.2.17.1 Working with Manual ABAP Syntax Check

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 41 of 138

1.1.2.17.1 Working with Manual ABAP Syntax Check


Prerequisites
The syntax check always is executed solely for the ABAP source code in the editor currently opened.

Context
You can run the ABAP syntax check directly through a toolbar icon in the main window of the ABAP perspective.

Procedure
1. Open the relevant development object in the ABAP source editor.
2. Click the icon

(Check the ABAP Development Object) in the toolbar. Alternatively, you can use the keyboard shortcut Ctrl + F2.

Related Information
Working with Automatic ABAP Syntax Check While Programming
Working with Manual ABAP Syntax Check

1.1.2.17.2 Working with Automatic ABAP Syntax Check While


Programming
Prerequisites
The syntax check always is executed solely for the ABAP source code in the editor currently opened.

Context
By default, the ABAP source code editor automatically checks the syntax of a development object you are currently working on.

Note
The automatic syntax check is executed 500 ms after you have stopped typing.
The automatic syntax check is activated by default. Use the
Window
Preferences
ABAP Development
Editors
Source Code Editor
pages to deactivate the Automatic syntax check on all open ABAP source editors checkbox.
The syntax check is always only executed for the ABAP source code of the currently opened editor. When you save a development object, all other
opened source code editors are also checked.

Related Information
Checking ABAP Syntax
Working with Manual ABAP Syntax Check

1.1.2.18 Activating Development Objects


Context
You use this activation function to activate all your inactive development objects in your ABAP project, any selected objects, or just subobjects of a main
object (methods in classes).

Note
Make sure that the development object you wish to activate is syntactically correct. Before an object is activated, the system performs a syntax check of
the entire object (main program, function group, class, and so on). However, you can also activate development objects even if they contain syntax errors.

Note
You can run the activation of one or more development objects in the background. This enables you to continue working on other development objects
while the activation process is being continued. For this purpose, select the Run in Background button while the activation is running.

Procedure
1. To activate the development object that is currently opened in the ABAP source editor, click the icon

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

(Activate the ABAP Development Object) in

Page 42 of 138

the toolbar.
2. To activate a selection of development objects:
1. Multi-select (single selection is also possible) the relevant object's nodes in the Project Explorer.
2. Open the context menu and choose Activate.
3. To activate development objects using the inactive objects worklist for the ABAP project:
1. Open the ABAP source editor for a single development object of the project.
2. Open the list to the right of the activation icon
in the toolbar and choose Activate Inactive ABAP Development Objects... .
The worklist with entries for all inactive objects appears.
3. In the Worklist window, select the relevant objects and choose Activate.

Results
If no error exists, activation will be completed. Otherwise, an error message is displayed. In this case, SAP recommends that you select the No button to
solve the error in the Problems view. If you select the Yes button, the development objects will be activated with errors.

Related Information
Troubleshooting for Dictionary Activation Errors
Troubleshooting for ABAP Syntax Errors
ABAP Development Objects
Creating ABAP Projects
Adding or Removing a Favorite Package
Browsing Development Objects in the Project Explorer
Closing ABAP Projects
Deleting ABAP Projects

1.1.2.18.1 Troubleshooting for ABAP Syntax Errors


In case of activation errors, it can be of advantage for you, to get more information about the diagnosis and troubleshooting. Whenever a long-text help for a
ABAP syntax error is available in the corresponding ABAP back-end system, you can access it in the Problems view. To do so, open the context menu for
the respective error item in the Problems view and choose the option Show ABAP Problem Help. The long-text help is then displayed in the ABAP
Problems Help view.

Figure 1: A long-text help for a syntax error is available in the system, you can access it using the context menu in the Problems view.

Related Information
Activating Development Objects
Troubleshooting for Dictionary Activation Errors

1.1.2.18.2 Troubleshooting for Dictionary Activation Errors


Also the activation of Dictionary objects or of other ABAP development objects, which in turn reference Dictionary objects (such as data types), can cause
errors. This can, for example, occur if for a data element neither a domain nor a data type is defined in the Dictionary. In such a case, you can examine the
activation log for further troubleshooting. To view the activation log for an error item in the Problems view, select the corresponding function in the context
menu.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 43 of 138

Figure 1: Use the context menu of an error item in Problems view to open the activation log

Figure 2: Activation error message that is displayed in the ABAP Log view

Related Information
Activating Development Objects
Troubleshooting for ABAP Syntax Errors

1.1.2.19 Unlocking Development Objects


Context
As soon as you start to edit a development object in the Developer Studio, the corresponding editor is locked so that contents cannot simultaneously be
changed by other users.
In the Developer Studio, the status is displayed as "locked", with a decorator, both in the Project Explorer and on the editor tab:
Indication in the Project Explorer:

Indication in the ABAP source code editor:

This kind of editor lock is lifted implicitly for the respective object as soon as you have closed the editor.
In certain use cases, however, it can happen that you would like to explicitly remove the existing lock in the editor for the object concerned in order to allow
changes by another user for a short time, for example.

Procedure
1. Navigate to the relevant editor.
2. Open the context menu of the editor and choose Unlock.
Alternatively, you can use the toolbar
Edit
Unlock

from the menu or choose the Unlock function in the Project Explorer.

Results
The locked decorator is removed from the editor tab and the corresponding item in the Project Explorer.

Related Information
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 44 of 138

Status of a Development Object


Opening Development Objects

1.1.2.20 Running Executable Objects


Context
In ABAP Development Tools, you have following possibilities to run or open executable development objects in SAP GUI.
Running as ABAP Development Object
Running in the ABAP Source Code Editor
Opening Development Objects in the SAP GUI
Running from the Project Explorer
Running ABAP programs
Launching the test environment for function modules
Launching the test environment for classes
Launching transactions in SAP GUI.

Related Information
ABAP Development Objects
Creating ABAP Projects
Adding or Removing a Favorite Package
Browsing Development Objects in the Project Explorer
Closing ABAP Projects
Deleting ABAP Projects

Running as ABAP Development Object

Context
You can run a development object throuhg an icon in the toolbar or a shortcut.

Note
Every time you run an executable object, such as an ABAP program, the editor opens a new SAP GUI window by default.
If you want to have it be opened in the same view, use the SAP GUI Integration preference option.
1. Open the
Window
Preferences
ABAP Development
SAP GUI Integration
2. Select the relevant option where you want to run the application:
Reuse SAP GUI window when running applications for in the same view
Open SAP GUI as separate window for in a new view

page.

Procedure
1. Choose the icon

(Run ABAP Development Object...) in the toolbar.

Tip
Alternatively, you can use the shortcut Alt + F8.
2. Select the relevant ABAP project if is not already done so.
3. Enter the (part of) name of the executable object or transaction that you want to start in SAP GUI.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 45 of 138

Figure 1: Selection dialog for running transactions, programs, classes, or function modules

4. Choose OK.

Results
The ABAP Development Tools runs the selected object or opens the corresponding test environment within the integrated SAP GUI.

Running in the ABAP Source Code Editor

Context
You execute a development object in another editor.

Procedure
1. Open the relevant object in the source editor.
2. Choose F8.

Results
The ABAP Development Tools runs the selected object or opens the corresponding test environment within the integrated SAP GUI.

Running from the Project Explorer

Context
You can open a development object from the context menu in the Project Explorer .

Procedure
1. Select the relevant object node in the ABAP project in the Project Explorer .
2. Open the context menu and choose
Run As
ABAP Application .

Results
The ABAP Development Tools runs the selected object or opens the corresponding test environment within the integrated SAP GUI.

Running Executable Objects


Context
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 46 of 138

In ABAP Development Tools, you have following possibilities to run or open executable development objects in SAP GUI.
1.1.2.20.1 Running as ABAP Development Object
Running in the ABAP Source Code Editor
Opening Development Objects in the SAP GUI
Running from the Project Explorer
Running ABAP programs
Launching the test environment for function modules
Launching the test environment for classes
Launching transactions in SAP GUI.

Related Information
ABAP Development Objects
Creating ABAP Projects
Adding or Removing a Favorite Package
Browsing Development Objects in the Project Explorer
Closing ABAP Projects
Deleting ABAP Projects

Running as ABAP Development Object

Context
You can run a development object throuhg an icon in the toolbar or a shortcut.

Note
Every time you run an executable object, such as an ABAP program, the editor opens a new SAP GUI window by default.
If you want to have it be opened in the same view, use the SAP GUI Integration preference option.
1. Open the
Window
Preferences
ABAP Development
SAP GUI Integration
2. Select the relevant option where you want to run the application:
Reuse SAP GUI window when running applications for in the same view
Open SAP GUI as separate window for in a new view

page.

Procedure
1. Choose the icon

(Run ABAP Development Object...) in the toolbar.

Tip
Alternatively, you can use the shortcut Alt + F8.
2. Select the relevant ABAP project if is not already done so.
3. Enter the (part of) name of the executable object or transaction that you want to start in SAP GUI.

Figure 1: Selection dialog for running transactions, programs, classes, or function modules

4. Choose OK.

Results
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 47 of 138

The ABAP Development Tools runs the selected object or opens the corresponding test environment within the integrated SAP GUI.

Running in the ABAP Source Code Editor

Context
You execute a development object in another editor.

Procedure
1. Open the relevant object in the source editor.
2. Choose F8.

Results
The ABAP Development Tools runs the selected object or opens the corresponding test environment within the integrated SAP GUI.

Running from the Project Explorer

Context
You can open a development object from the context menu in the Project Explorer .

Procedure
1. Select the relevant object node in the ABAP project in the Project Explorer .
2. Open the context menu and choose
Run As
ABAP Application .

Results
The ABAP Development Tools runs the selected object or opens the corresponding test environment within the integrated SAP GUI.

Running Executable Objects


Context
In ABAP Development Tools, you have following possibilities to run or open executable development objects in SAP GUI.
Running as ABAP Development Object
1.1.2.20.2 Running in the ABAP Source Code Editor
Opening Development Objects in the SAP GUI
Running from the Project Explorer
Running ABAP programs
Launching the test environment for function modules
Launching the test environment for classes
Launching transactions in SAP GUI.

Related Information
ABAP Development Objects
Creating ABAP Projects
Adding or Removing a Favorite Package
Browsing Development Objects in the Project Explorer
Closing ABAP Projects
Deleting ABAP Projects

Running as ABAP Development Object

Context
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 48 of 138

You can run a development object throuhg an icon in the toolbar or a shortcut.

Note
Every time you run an executable object, such as an ABAP program, the editor opens a new SAP GUI window by default.
If you want to have it be opened in the same view, use the SAP GUI Integration preference option.
1. Open the
Window
Preferences
ABAP Development
SAP GUI Integration
2. Select the relevant option where you want to run the application:
Reuse SAP GUI window when running applications for in the same view
Open SAP GUI as separate window for in a new view

page.

Procedure
1. Choose the icon

(Run ABAP Development Object...) in the toolbar.

Tip
Alternatively, you can use the shortcut Alt + F8.
2. Select the relevant ABAP project if is not already done so.
3. Enter the (part of) name of the executable object or transaction that you want to start in SAP GUI.

Figure 1: Selection dialog for running transactions, programs, classes, or function modules

4. Choose OK.

Results
The ABAP Development Tools runs the selected object or opens the corresponding test environment within the integrated SAP GUI.

Running in the ABAP Source Code Editor

Context
You execute a development object in another editor.

Procedure
1. Open the relevant object in the source editor.
2. Choose F8.

Results
The ABAP Development Tools runs the selected object or opens the corresponding test environment within the integrated SAP GUI.

Running from the Project Explorer

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 49 of 138

Context
You can open a development object from the context menu in the Project Explorer .

Procedure
1. Select the relevant object node in the ABAP project in the Project Explorer .
2. Open the context menu and choose
Run As
ABAP Application .

Results
The ABAP Development Tools runs the selected object or opens the corresponding test environment within the integrated SAP GUI.

Running Executable Objects


Context
In ABAP Development Tools, you have following possibilities to run or open executable development objects in SAP GUI.
Running as ABAP Development Object
Running in the ABAP Source Code Editor
Opening Development Objects in the SAP GUI
1.1.2.20.3 Running from the Project Explorer
Running ABAP programs
Launching the test environment for function modules
Launching the test environment for classes
Launching transactions in SAP GUI.

Related Information
ABAP Development Objects
Creating ABAP Projects
Adding or Removing a Favorite Package
Browsing Development Objects in the Project Explorer
Closing ABAP Projects
Deleting ABAP Projects

Running as ABAP Development Object

Context
You can run a development object throuhg an icon in the toolbar or a shortcut.

Note
Every time you run an executable object, such as an ABAP program, the editor opens a new SAP GUI window by default.
If you want to have it be opened in the same view, use the SAP GUI Integration preference option.
1. Open the
Window
Preferences
ABAP Development
SAP GUI Integration
2. Select the relevant option where you want to run the application:
Reuse SAP GUI window when running applications for in the same view
Open SAP GUI as separate window for in a new view

page.

Procedure
1. Choose the icon

(Run ABAP Development Object...) in the toolbar.

Tip
Alternatively, you can use the shortcut Alt + F8.
2. Select the relevant ABAP project if is not already done so.
3. Enter the (part of) name of the executable object or transaction that you want to start in SAP GUI.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 50 of 138

Figure 1: Selection dialog for running transactions, programs, classes, or function modules

4. Choose OK.

Results
The ABAP Development Tools runs the selected object or opens the corresponding test environment within the integrated SAP GUI.

Running in the ABAP Source Code Editor

Context
You execute a development object in another editor.

Procedure
1. Open the relevant object in the source editor.
2. Choose F8.

Results
The ABAP Development Tools runs the selected object or opens the corresponding test environment within the integrated SAP GUI.

Running from the Project Explorer

Context
You can open a development object from the context menu in the Project Explorer .

Procedure
1. Select the relevant object node in the ABAP project in the Project Explorer .
2. Open the context menu and choose
Run As
ABAP Application .

Results
The ABAP Development Tools runs the selected object or opens the corresponding test environment within the integrated SAP GUI.

1.1.2.21 Deleting Development Objects


Context
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 51 of 138

You can delete development objects directly from the Project Explorer view. However, before deleting an object, check whether it is still being used by other
development objects. To find out if an object is still in use, call the Where-Used function.

Note
The deletion of multiple development objects in one single step is not yet supported in the new IDE.

Procedure
1. Select the relevant object node in the Project Explorer.
2. Open the context menu and choose Delete.

Related Information
ABAP Development Objects

1.1.3 Searching in ABAP Projects


Context
In addition to the Eclipse search functionalities, the ABAP search provides powerful tools for finding versions of an ABAP development object in all of the
back-end systems you work with.
The following functions enable you to search for ABAP project-specific content:
Searching Development Objects to find a certain ABAP development objects on base of the object name
Searching ABAP Source Code to find a keyword that is used within an ABAP project
Searching Usages (Where-Used) to find the usages of development objects and sub-objects

Note
Use the ABAP Search function to find ABAP content. The Eclipse file search results may be incomplete.

Related Information
ABAP Search
Searching Development Objects
Searching ABAP Source Code
Searching Usages (Where-Used)
Opening Development Objects

1.1.3.1 Searching ABAP Source Code


In SAP NetWeaver 7.4 SP 5 and higher, the SAP HANA-based ABAP Source Search functionality enables you to find text that is contained in source-based
repository objects (like classes, programs, function pools, and so on) as well as message classes of an ABAP project.

Prerequisites
Your ABAP system must be using a SAP HANA database.
Ensure to have at least 10 GB of free database memory before you switch on this business function. If the database memory is not enough, the ABAP
system may become very slow or unusable. To provide the required space for the ABAP Source Search and its indexing, your SAP administrator needs to
activate the SRIS_SOURCE_SEARCH business function in the Switch Framework (transaction code SFW5) of the corresponding ABAP system.

Context
You have two options for performing a search in ABAP source code:
1. If you want to search within the entire ABAP system, select
(Ctrl H).

Search

Search

ABAP Source Search

from the menu or open the shortcut

2. If you want to search within a certain development object, select a certain development object in the Project Explorer or open it in the source code
editor and choose Search Content... from the context menu.
The same dialog is provided for both options. Proceed as follows:

Procedure
1. In the following dialog box, choose the ABAP Source Search tab.

Note
If the recommended tab is not displayed, choose the Customize... button to select the corresponding one.
2. In the ABAP Source Search tab, enter the text you wish to find in the Search Term field.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 52 of 138

Note
In the Search Term field, the following operators are available to adjust your search criteria:
Operator

Description

* (asterisk)

You can add an asterisk '*' to search for all characters.

OR

Matches containing at least one of the terms joined by the OR operator are
returned.

- (minus)

Matches that do not contain the term immediately following the minus sign are
returned.

"SEARCH_TERM" (quotation marks)

Only exact matches for SEARCH_TERM are returned. Terms within quotation
marks are not tokenized and are handled as a string.

If you enter multiple search terms, the AND operator is automatically interpreted by default. As a consequence, only the repository objects are
displayed that contain all search terms.
3. [Optional:] In the Search Filter field, you can restrict the search by one or more:
ABAP packages
ABAP source-based development objects
Object types like clas, intf
Responsible User that is provided in the table TADIR, field AUTHOR

Tip
When editing the search filter, you can benefit from the content assistant functionality by pressing Ctrl + Space.
If you want to select several ABAP packages and / or development objects, leave a space between the entries.

Note
Search filters currently do not support patterns like CL_*. You can only use complete identifiers.
4. [Optional:] Move the Maximum number of results slider to limit the quantity of the results that are displayed in the Search view.

Note
You can define the number from 25 up to all search results.
5. [Optional:] Choose the Browse... button for selecting the Project if you want to search in another ABAP project.

Note
By default, the current ABAP project is used.
6. Choose Search to launch the search.

Results
If the text is found, the matching code snippets are displayed in the result list of the Search view. These code snippets are grouped according to their
repository objects and packages. In addition the search term is highlighted.
From the results list, you can navigate to the repository object or source code position by using double-click. In addition, you can do the following:
Scroll to the next or previous match
Copy the content of the result to the clipboard

Tip
In the Search view, you can choose the

Open Search Dialog button from the tool bar to redefine the search.

Related Information
ABAP Search
Opening Development Objects
Searching in ABAP Projects

1.1.3.2 Searching Development Objects


Context
You can search for ABAP development objects either in one particular ABAP project or system-wide across all of your ABAP projects.

Procedure
1. In the menu bar, choose

Search

Search...

. Alternatively, you can use the shortcut Ctrl H.

2. In the following dialog box, choose the ABAP Object Search tab.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 53 of 138

Tip
If the recommended tab is not displayed, choose the Customize... button, to select the corresponding one.
3. In the ABAP Object Search tab, enter the Object Name you wish to find.

Note
You can only search for main repository objects, such as ABAP classes, ABAP programs, or data dictionary objects. You cannot search for subobjects such as methods or form routines.
4. Select Workspace to search in all your ABAP projects that are currently active and usable. Or select one of your ABAP projects.

Note
You can restrict the search to finding your favorite packages by activating the Restrict Search to Favorite Packages checkbox.
5. Select Search to launch the search.

Results
The repository objects that match the search scope are displayed in the Search view. The result is grouped by ABAP packages

Note
From the results list, you can use the context menu to open each object in the editor.

Related Information
ABAP Development Objects
ABAP Search
Opening Development Objects
Searching in ABAP Projects

1.1.3.3 Searching Usages (Where-Used)


Prerequisites
The improvements in the Where-used view like the general and filter functionalities from the toolbar and context menu are provided for SAP NetWeaver
Release 7.31 SP14 and higher as well as Release 7.40 SP08 and higher.

Context
You can investigate where a development object or element is used within an ABAP package.
You can execute the where-used search from the following positions:
Project Explorer
Outline
Source code editor
Another where-used result
Example
The following procedure describes how to search for the usage of a development object from the Project Explorer :

Procedure
1. In the Project Explorer , select the relevant development object.
2. From the context menu or the toolbar, choose

Get Where-Used List....

Results
The Search view is opened, and the relationships and usages of the development object and their elements are displayed.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 54 of 138

Figure 1: Example of a search view that displays the hits and relationships of an ABAP class

To display the number of matches instead of a placeholder, expand the corresponding tree level.
From here you can run an ABAP unit test or another where-used search for a development object or an element.

Related Information
ABAP Search
Where-Used Function
Searching in ABAP Projects

1.1.4 Editing ABAP Source Code


Context
The ABAP IDE provides a number of functions and utilities for efficiently creating, editing, and navigating ABAP source code. These primarily comprise ABAP
keyword completion, the source code templates, and the various formatting capabilities.

Related Information
ABAP Development Objects
Working with Code Completion
Working with Source Code Templates
Closing Brackets and Literals Automatically
Formatting ABAP Source Code
Refactoring ABAP Source Code
Applying ABAP Quick Fixes
Changing Colors for ABAP Source Code
Marking Occurrences in the Source Code Editor
Viewing the Outline
Viewing the ABAP Type Hierarchy
Using Quick Views
Comparing Source Code
Managing Version Conflicts

1.1.4.1 Working with Code Completion


In the ABAP source code editor , the content assist function proposes valid ABAP keywords and identifiers that are relevant at the current position. One of
these proposals can be inserted in the source code.

Context
You can reduce the time spent on code editing and ensure that you are using the valid source code elements by using code completion.
The following code completion functions are provided:
Table 1: List of Available ABAP Code Completion Functions
Content Assist

Description

Keyword Completion

The best matching ABAP keyword is automatically proposed as soon as you start typing.

Non-Keyword Completion

The best matching non-keyword that is available for the corresponding source code section is automatically
proposed as soon as you start typing.

Code Completion

A list of all matching keywords, identifiers, components, and templates is displayed for the position where you
have chosen the Ctrl + Space shortcut.

Related Information
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 55 of 138

ABAP Development Objects


Working with Source Code Templates

Keyword Completion
In the ABAP source code editor , the best matching ABAP keyword is displayed as soon as you start typing the keyword. If you choose the tabulator tab, the
keyword is inserted at the current position.

Prerequisites
To use this functionality, navigate to the
preference page and select the
Typing

Window
Preferences
ABAP Development
Suggest keywords
option.

Editors

Source Code Editors

Code Completion

Context
Note
Keyword completion is enabled by default.

Procedure
1. In the source code, start typing a keyword.
The proposal for the most relevant keyword is displayed.

Figure 1: Display of a proposal for a certain keyword while typing

2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding keyword is added to the source code.

Non-Keyword Completion
In the ABAP source code editor , the best matching non-keyword, such as an element name or type definition, is displayed when you start typing.

Prerequisites
To use this functionality, open the
ABAP Development
the Also suggest non-keywords option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select

Context
Note
Non-keyword completion is disabled by default.

Procedure
1. In the source code, start typing a non-keyword.
The proposal for the most relevant non-keyword is displayed.

Figure 2: Display of a proposal for a certain non-keyword while typing

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 56 of 138

Note
Non-keywords are only proposed if they are already used in the same development object.
2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding non-keyword is added to the source code.

Code Completion
In the ABAP source code editor , you can open the code completion list manually at any position or automatically after you have typed a component selector
such as -, ~, ->, =>.

Context
This functionality enables you to:
add possible keywords or identifiers such as variables, classes, interfaces, methods
select and add the component of the related identifier, such as a field of a structure or a method of a class
to your source code.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The most relevant proposals are displayed in the code completion list.
3. Choose Enter to add keywords or identifiers or Shift + Enter to add the full signature of a method or function module.

Note
If the code completion list is not displayed, check whether the related components are correctly defined in the respective development object.
Since SAP NetWeaver 7.40 SP02 and 7.31 SP11, you can use wildcards like the asterisk (*) to limit the list of relevant entries if you do not know the
qualified name of the keyword or identifier.
If you use the asterisk, a list is opened that displays the relevant keywords and identifiers after the cursor position.

Figure 3: Example for finding a keyword or identifier on the basis of an asterisk

4. Selecting a proposal from the code completion list.

Results
The corresponding keyword or identifier is added to the source code at this position.

Related Information
Using Code Completion Automatically
Inserting a Full Signature Automatically
Inserting or Overwriting Source Code

Using Code Completion Automatically


In the ABAP source code editor of a development object, you want to open the code completion list automatically when you enter a component selector such
as -, ~, ->, =>.

Prerequisites
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 57 of 138

To use this function, open the


Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.

Source Code Editors

Code Completion

preference page

Context
Note
Automatic code completion is selected by default.

Procedure
1. In the source code, you start typing a component.
The following component selectors are supported:
Component Selector

Displayed Proposals

Fields of structures

Components of interfaces

->

Instance components of object references

=>

Static components of ABAP classes / interfaces

The code completion list is automatically displayed.

Figure 4: Code completion list and popup according to the component

2. Select a component from the code completion list.

Results
The component is added to the source code at the current position.

Figure 5: A call to the static call_static_demo2 method is inserted at your current position

Inserting a Full Signature Automatically


In the ABAP source code editor of a development object, you want to insert the full signature of a method, function module, or form routine automatically.

Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select the

Context
Note
Automatic insert of a full signature is disabled by default.

Procedure
1. In the source code editor, type the name of a method, function module, or form routine.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 58 of 138

The code completion list with the available entries and full signature is displayed.
2. Select the relevant entry.

Results
The full signature is inserted in the source code at the current position.

Inserting or Overwriting Source Code


In the ABAP source code editor , you can insert a keyword, identifier, or template from the code completion list at the current position. Optionally, you can
configure the code completion to overwrite the keyword or identifier at the current position.

Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.

ABAP Development

Editors

Source Code Editors

Code Completion

Context
Note
Code insertion is defined by default.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The code completion list is opened.

Figure 6: Example for inserting the identifier current_speed and replacing it with the existing identifier result

3. Adopt the displayed entry into your source code by choosing the tabulator key.

Note
To toggle beween inserting and overwriting while the content assist is active, choose Ctrl.

Results
The selected keyword, identifier, or template is inserted and replaces the keyword or identifier at the current cursor position.

Figure 7: Example after replacing the identifier result with current_speed

Working with Code Completion


In the ABAP source code editor , the content assist function proposes valid ABAP keywords and identifiers that are relevant at the current position. One of
these proposals can be inserted in the source code.

Context
You can reduce the time spent on code editing and ensure that you are using the valid source code elements by using code completion.
The following code completion functions are provided:
Table 1: List of Available ABAP Code Completion Functions
Content Assist

Description

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 59 of 138

1.1.4.1.1 Keyword Completion

The best matching ABAP keyword is automatically proposed as soon as you start typing.

Non-Keyword Completion

The best matching non-keyword that is available for the corresponding source code section is automatically
proposed as soon as you start typing.

Code Completion

A list of all matching keywords, identifiers, components, and templates is displayed for the position where you
have chosen the Ctrl + Space shortcut.

Related Information
ABAP Development Objects
Working with Source Code Templates

Keyword Completion
In the ABAP source code editor , the best matching ABAP keyword is displayed as soon as you start typing the keyword. If you choose the tabulator tab, the
keyword is inserted at the current position.

Prerequisites
To use this functionality, navigate to the
preference page and select the
Typing

Window
Preferences
ABAP Development
Suggest keywords
option.

Editors

Source Code Editors

Code Completion

Context
Note
Keyword completion is enabled by default.

Procedure
1. In the source code, start typing a keyword.
The proposal for the most relevant keyword is displayed.

Figure 1: Display of a proposal for a certain keyword while typing

2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding keyword is added to the source code.

Non-Keyword Completion
In the ABAP source code editor , the best matching non-keyword, such as an element name or type definition, is displayed when you start typing.

Prerequisites
To use this functionality, open the
ABAP Development
the Also suggest non-keywords option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select

Context
Note
Non-keyword completion is disabled by default.

Procedure
1. In the source code, start typing a non-keyword.
The proposal for the most relevant non-keyword is displayed.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 60 of 138

Figure 2: Display of a proposal for a certain non-keyword while typing

Note
Non-keywords are only proposed if they are already used in the same development object.
2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding non-keyword is added to the source code.

Code Completion
In the ABAP source code editor , you can open the code completion list manually at any position or automatically after you have typed a component selector
such as -, ~, ->, =>.

Context
This functionality enables you to:
add possible keywords or identifiers such as variables, classes, interfaces, methods
select and add the component of the related identifier, such as a field of a structure or a method of a class
to your source code.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The most relevant proposals are displayed in the code completion list.
3. Choose Enter to add keywords or identifiers or Shift + Enter to add the full signature of a method or function module.

Note
If the code completion list is not displayed, check whether the related components are correctly defined in the respective development object.
Since SAP NetWeaver 7.40 SP02 and 7.31 SP11, you can use wildcards like the asterisk (*) to limit the list of relevant entries if you do not know the
qualified name of the keyword or identifier.
If you use the asterisk, a list is opened that displays the relevant keywords and identifiers after the cursor position.

Figure 3: Example for finding a keyword or identifier on the basis of an asterisk

4. Selecting a proposal from the code completion list.

Results
The corresponding keyword or identifier is added to the source code at this position.

Related Information
Using Code Completion Automatically
Inserting a Full Signature Automatically
Inserting or Overwriting Source Code

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 61 of 138

Using Code Completion Automatically


In the ABAP source code editor of a development object, you want to open the code completion list automatically when you enter a component selector such
as -, ~, ->, =>.

Prerequisites
To use this function, open the
Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.

Source Code Editors

Code Completion

preference page

Context
Note
Automatic code completion is selected by default.

Procedure
1. In the source code, you start typing a component.
The following component selectors are supported:
Component Selector

Displayed Proposals

Fields of structures

Components of interfaces

->

Instance components of object references

=>

Static components of ABAP classes / interfaces

The code completion list is automatically displayed.

Figure 4: Code completion list and popup according to the component

2. Select a component from the code completion list.

Results
The component is added to the source code at the current position.

Figure 5: A call to the static call_static_demo2 method is inserted at your current position

Inserting a Full Signature Automatically


In the ABAP source code editor of a development object, you want to insert the full signature of a method, function module, or form routine automatically.

Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.

Editors

Source Code Editors

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Code Completion

Typing

preference page and select the

Page 62 of 138

Context
Note
Automatic insert of a full signature is disabled by default.

Procedure
1. In the source code editor, type the name of a method, function module, or form routine.
The code completion list with the available entries and full signature is displayed.
2. Select the relevant entry.

Results
The full signature is inserted in the source code at the current position.

Inserting or Overwriting Source Code


In the ABAP source code editor , you can insert a keyword, identifier, or template from the code completion list at the current position. Optionally, you can
configure the code completion to overwrite the keyword or identifier at the current position.

Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.

ABAP Development

Editors

Source Code Editors

Code Completion

Context
Note
Code insertion is defined by default.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The code completion list is opened.

Figure 6: Example for inserting the identifier current_speed and replacing it with the existing identifier result

3. Adopt the displayed entry into your source code by choosing the tabulator key.

Note
To toggle beween inserting and overwriting while the content assist is active, choose Ctrl.

Results
The selected keyword, identifier, or template is inserted and replaces the keyword or identifier at the current cursor position.

Figure 7: Example after replacing the identifier result with current_speed

Working with Code Completion


In the ABAP source code editor , the content assist function proposes valid ABAP keywords and identifiers that are relevant at the current position. One of
these proposals can be inserted in the source code.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 63 of 138

Context
You can reduce the time spent on code editing and ensure that you are using the valid source code elements by using code completion.
The following code completion functions are provided:
Table 1: List of Available ABAP Code Completion Functions
Content Assist

Description

Keyword Completion

The best matching ABAP keyword is automatically proposed as soon as you start typing.

1.1.4.1.2 Non-Keyword Completion

The best matching non-keyword that is available for the corresponding source code section is automatically
proposed as soon as you start typing.

Code Completion

A list of all matching keywords, identifiers, components, and templates is displayed for the position where you
have chosen the Ctrl + Space shortcut.

Related Information
ABAP Development Objects
Working with Source Code Templates

Keyword Completion
In the ABAP source code editor , the best matching ABAP keyword is displayed as soon as you start typing the keyword. If you choose the tabulator tab, the
keyword is inserted at the current position.

Prerequisites
To use this functionality, navigate to the
preference page and select the
Typing

Window
Preferences
ABAP Development
Suggest keywords
option.

Editors

Source Code Editors

Code Completion

Context
Note
Keyword completion is enabled by default.

Procedure
1. In the source code, start typing a keyword.
The proposal for the most relevant keyword is displayed.

Figure 1: Display of a proposal for a certain keyword while typing

2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding keyword is added to the source code.

Non-Keyword Completion
In the ABAP source code editor , the best matching non-keyword, such as an element name or type definition, is displayed when you start typing.

Prerequisites
To use this functionality, open the
ABAP Development
the Also suggest non-keywords option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select

Context

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 64 of 138

Note
Non-keyword completion is disabled by default.

Procedure
1. In the source code, start typing a non-keyword.
The proposal for the most relevant non-keyword is displayed.

Figure 2: Display of a proposal for a certain non-keyword while typing

Note
Non-keywords are only proposed if they are already used in the same development object.
2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding non-keyword is added to the source code.

Code Completion
In the ABAP source code editor , you can open the code completion list manually at any position or automatically after you have typed a component selector
such as -, ~, ->, =>.

Context
This functionality enables you to:
add possible keywords or identifiers such as variables, classes, interfaces, methods
select and add the component of the related identifier, such as a field of a structure or a method of a class
to your source code.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The most relevant proposals are displayed in the code completion list.
3. Choose Enter to add keywords or identifiers or Shift + Enter to add the full signature of a method or function module.

Note
If the code completion list is not displayed, check whether the related components are correctly defined in the respective development object.
Since SAP NetWeaver 7.40 SP02 and 7.31 SP11, you can use wildcards like the asterisk (*) to limit the list of relevant entries if you do not know the
qualified name of the keyword or identifier.
If you use the asterisk, a list is opened that displays the relevant keywords and identifiers after the cursor position.

Figure 3: Example for finding a keyword or identifier on the basis of an asterisk

4. Selecting a proposal from the code completion list.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 65 of 138

Results
The corresponding keyword or identifier is added to the source code at this position.

Related Information
Using Code Completion Automatically
Inserting a Full Signature Automatically
Inserting or Overwriting Source Code

Using Code Completion Automatically


In the ABAP source code editor of a development object, you want to open the code completion list automatically when you enter a component selector such
as -, ~, ->, =>.

Prerequisites
To use this function, open the
Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.

Source Code Editors

Code Completion

preference page

Context
Note
Automatic code completion is selected by default.

Procedure
1. In the source code, you start typing a component.
The following component selectors are supported:
Component Selector

Displayed Proposals

Fields of structures

Components of interfaces

->

Instance components of object references

=>

Static components of ABAP classes / interfaces

The code completion list is automatically displayed.

Figure 4: Code completion list and popup according to the component

2. Select a component from the code completion list.

Results
The component is added to the source code at the current position.

Figure 5: A call to the static call_static_demo2 method is inserted at your current position

Inserting a Full Signature Automatically


PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 66 of 138

In the ABAP source code editor of a development object, you want to insert the full signature of a method, function module, or form routine automatically.

Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select the

Context
Note
Automatic insert of a full signature is disabled by default.

Procedure
1. In the source code editor, type the name of a method, function module, or form routine.
The code completion list with the available entries and full signature is displayed.
2. Select the relevant entry.

Results
The full signature is inserted in the source code at the current position.

Inserting or Overwriting Source Code


In the ABAP source code editor , you can insert a keyword, identifier, or template from the code completion list at the current position. Optionally, you can
configure the code completion to overwrite the keyword or identifier at the current position.

Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.

ABAP Development

Editors

Source Code Editors

Code Completion

Context
Note
Code insertion is defined by default.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The code completion list is opened.

Figure 6: Example for inserting the identifier current_speed and replacing it with the existing identifier result

3. Adopt the displayed entry into your source code by choosing the tabulator key.

Note
To toggle beween inserting and overwriting while the content assist is active, choose Ctrl.

Results
The selected keyword, identifier, or template is inserted and replaces the keyword or identifier at the current cursor position.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 67 of 138

Figure 7: Example after replacing the identifier result with current_speed

Working with 1.1.4.1.3 Code Completion


In the ABAP source code editor , the content assist function proposes valid ABAP keywords and identifiers that are relevant at the current position. One of
these proposals can be inserted in the source code.

Context
You can reduce the time spent on code editing and ensure that you are using the valid source code elements by using code completion.
The following code completion functions are provided:
Table 1: List of Available ABAP Code Completion Functions
Content Assist

Description

Keyword Completion

The best matching ABAP keyword is automatically proposed as soon as you start typing.

Non-Keyword Completion

The best matching non-keyword that is available for the corresponding source code section is automatically
proposed as soon as you start typing.

Code Completion

A list of all matching keywords, identifiers, components, and templates is displayed for the position where you
have chosen the Ctrl + Space shortcut.

Related Information
ABAP Development Objects
Working with Source Code Templates

Keyword Completion
In the ABAP source code editor , the best matching ABAP keyword is displayed as soon as you start typing the keyword. If you choose the tabulator tab, the
keyword is inserted at the current position.

Prerequisites
To use this functionality, navigate to the
preference page and select the
Typing

Window
Preferences
ABAP Development
Suggest keywords
option.

Editors

Source Code Editors

Code Completion

Context
Note
Keyword completion is enabled by default.

Procedure
1. In the source code, start typing a keyword.
The proposal for the most relevant keyword is displayed.

Figure 1: Display of a proposal for a certain keyword while typing

2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding keyword is added to the source code.

Non-Keyword Completion
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 68 of 138

In the ABAP source code editor , the best matching non-keyword, such as an element name or type definition, is displayed when you start typing.

Prerequisites
To use this functionality, open the
ABAP Development
the Also suggest non-keywords option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select

Context
Note
Non-keyword completion is disabled by default.

Procedure
1. In the source code, start typing a non-keyword.
The proposal for the most relevant non-keyword is displayed.

Figure 2: Display of a proposal for a certain non-keyword while typing

Note
Non-keywords are only proposed if they are already used in the same development object.
2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding non-keyword is added to the source code.

Code Completion
In the ABAP source code editor , you can open the code completion list manually at any position or automatically after you have typed a component selector
such as -, ~, ->, =>.

Context
This functionality enables you to:
add possible keywords or identifiers such as variables, classes, interfaces, methods
select and add the component of the related identifier, such as a field of a structure or a method of a class
to your source code.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The most relevant proposals are displayed in the code completion list.
3. Choose Enter to add keywords or identifiers or Shift + Enter to add the full signature of a method or function module.

Note
If the code completion list is not displayed, check whether the related components are correctly defined in the respective development object.
Since SAP NetWeaver 7.40 SP02 and 7.31 SP11, you can use wildcards like the asterisk (*) to limit the list of relevant entries if you do not know the
qualified name of the keyword or identifier.
If you use the asterisk, a list is opened that displays the relevant keywords and identifiers after the cursor position.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 69 of 138

Figure 3: Example for finding a keyword or identifier on the basis of an asterisk

4. Selecting a proposal from the code completion list.

Results
The corresponding keyword or identifier is added to the source code at this position.

Related Information
Using Code Completion Automatically
Inserting a Full Signature Automatically
Inserting or Overwriting Source Code

Using Code Completion Automatically


In the ABAP source code editor of a development object, you want to open the code completion list automatically when you enter a component selector such
as -, ~, ->, =>.

Prerequisites
To use this function, open the
Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.

Source Code Editors

Code Completion

preference page

Context
Note
Automatic code completion is selected by default.

Procedure
1. In the source code, you start typing a component.
The following component selectors are supported:
Component Selector

Displayed Proposals

Fields of structures

Components of interfaces

->

Instance components of object references

=>

Static components of ABAP classes / interfaces

The code completion list is automatically displayed.

Figure 4: Code completion list and popup according to the component

2. Select a component from the code completion list.

Results
The component is added to the source code at the current position.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 70 of 138

Figure 5: A call to the static call_static_demo2 method is inserted at your current position

Inserting a Full Signature Automatically


In the ABAP source code editor of a development object, you want to insert the full signature of a method, function module, or form routine automatically.

Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select the

Context
Note
Automatic insert of a full signature is disabled by default.

Procedure
1. In the source code editor, type the name of a method, function module, or form routine.
The code completion list with the available entries and full signature is displayed.
2. Select the relevant entry.

Results
The full signature is inserted in the source code at the current position.

Inserting or Overwriting Source Code


In the ABAP source code editor , you can insert a keyword, identifier, or template from the code completion list at the current position. Optionally, you can
configure the code completion to overwrite the keyword or identifier at the current position.

Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.

ABAP Development

Editors

Source Code Editors

Code Completion

Context
Note
Code insertion is defined by default.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The code completion list is opened.

Figure 6: Example for inserting the identifier current_speed and replacing it with the existing identifier result

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 71 of 138

3. Adopt the displayed entry into your source code by choosing the tabulator key.

Note
To toggle beween inserting and overwriting while the content assist is active, choose Ctrl.

Results
The selected keyword, identifier, or template is inserted and replaces the keyword or identifier at the current cursor position.

Figure 7: Example after replacing the identifier result with current_speed

Working with Code Completion


In the ABAP source code editor , the content assist function proposes valid ABAP keywords and identifiers that are relevant at the current position. One of
these proposals can be inserted in the source code.

Context
You can reduce the time spent on code editing and ensure that you are using the valid source code elements by using code completion.
The following code completion functions are provided:
Table 1: List of Available ABAP Code Completion Functions
Content Assist

Description

Keyword Completion

The best matching ABAP keyword is automatically proposed as soon as you start typing.

Non-Keyword Completion

The best matching non-keyword that is available for the corresponding source code section is automatically
proposed as soon as you start typing.

Code Completion

A list of all matching keywords, identifiers, components, and templates is displayed for the position where you
have chosen the Ctrl + Space shortcut.

Related Information
ABAP Development Objects
Working with Source Code Templates

Keyword Completion
In the ABAP source code editor , the best matching ABAP keyword is displayed as soon as you start typing the keyword. If you choose the tabulator tab, the
keyword is inserted at the current position.

Prerequisites
To use this functionality, navigate to the
preference page and select the
Typing

Window
Preferences
ABAP Development
Suggest keywords
option.

Editors

Source Code Editors

Code Completion

Context
Note
Keyword completion is enabled by default.

Procedure
1. In the source code, start typing a keyword.
The proposal for the most relevant keyword is displayed.

Figure 1: Display of a proposal for a certain keyword while typing

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 72 of 138

2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding keyword is added to the source code.

Non-Keyword Completion
In the ABAP source code editor , the best matching non-keyword, such as an element name or type definition, is displayed when you start typing.

Prerequisites
To use this functionality, open the
ABAP Development
the Also suggest non-keywords option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select

Context
Note
Non-keyword completion is disabled by default.

Procedure
1. In the source code, start typing a non-keyword.
The proposal for the most relevant non-keyword is displayed.

Figure 2: Display of a proposal for a certain non-keyword while typing

Note
Non-keywords are only proposed if they are already used in the same development object.
2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding non-keyword is added to the source code.

Code Completion
In the ABAP source code editor , you can open the code completion list manually at any position or automatically after you have typed a component selector
such as -, ~, ->, =>.

Context
This functionality enables you to:
add possible keywords or identifiers such as variables, classes, interfaces, methods
select and add the component of the related identifier, such as a field of a structure or a method of a class
to your source code.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The most relevant proposals are displayed in the code completion list.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 73 of 138

3. Choose Enter to add keywords or identifiers or Shift + Enter to add the full signature of a method or function module.

Note
If the code completion list is not displayed, check whether the related components are correctly defined in the respective development object.
Since SAP NetWeaver 7.40 SP02 and 7.31 SP11, you can use wildcards like the asterisk (*) to limit the list of relevant entries if you do not know the
qualified name of the keyword or identifier.
If you use the asterisk, a list is opened that displays the relevant keywords and identifiers after the cursor position.

Figure 3: Example for finding a keyword or identifier on the basis of an asterisk

4. Selecting a proposal from the code completion list.

Results
The corresponding keyword or identifier is added to the source code at this position.

Related Information
1.1.4.1.3.1 Using Code Completion Automatically
Inserting a Full Signature Automatically
Inserting or Overwriting Source Code

Using Code Completion Automatically


In the ABAP source code editor of a development object, you want to open the code completion list automatically when you enter a component selector such
as -, ~, ->, =>.

Prerequisites
To use this function, open the
Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.

Source Code Editors

Code Completion

preference page

Context
Note
Automatic code completion is selected by default.

Procedure
1. In the source code, you start typing a component.
The following component selectors are supported:
Component Selector

Displayed Proposals

Fields of structures

Components of interfaces

->

Instance components of object references

=>

Static components of ABAP classes / interfaces

The code completion list is automatically displayed.

Figure 4: Code completion list and popup according to the component

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 74 of 138

2. Select a component from the code completion list.

Results
The component is added to the source code at the current position.

Figure 5: A call to the static call_static_demo2 method is inserted at your current position

Inserting a Full Signature Automatically


In the ABAP source code editor of a development object, you want to insert the full signature of a method, function module, or form routine automatically.

Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select the

Context
Note
Automatic insert of a full signature is disabled by default.

Procedure
1. In the source code editor, type the name of a method, function module, or form routine.
The code completion list with the available entries and full signature is displayed.
2. Select the relevant entry.

Results
The full signature is inserted in the source code at the current position.

Inserting or Overwriting Source Code


In the ABAP source code editor , you can insert a keyword, identifier, or template from the code completion list at the current position. Optionally, you can
configure the code completion to overwrite the keyword or identifier at the current position.

Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.

ABAP Development

Editors

Source Code Editors

Code Completion

Context
Note
Code insertion is defined by default.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The code completion list is opened.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 75 of 138

Figure 6: Example for inserting the identifier current_speed and replacing it with the existing identifier result

3. Adopt the displayed entry into your source code by choosing the tabulator key.

Note
To toggle beween inserting and overwriting while the content assist is active, choose Ctrl.

Results
The selected keyword, identifier, or template is inserted and replaces the keyword or identifier at the current cursor position.

Figure 7: Example after replacing the identifier result with current_speed

Working with Code Completion


In the ABAP source code editor , the content assist function proposes valid ABAP keywords and identifiers that are relevant at the current position. One of
these proposals can be inserted in the source code.

Context
You can reduce the time spent on code editing and ensure that you are using the valid source code elements by using code completion.
The following code completion functions are provided:
Table 1: List of Available ABAP Code Completion Functions
Content Assist

Description

Keyword Completion

The best matching ABAP keyword is automatically proposed as soon as you start typing.

Non-Keyword Completion

The best matching non-keyword that is available for the corresponding source code section is automatically
proposed as soon as you start typing.

Code Completion

A list of all matching keywords, identifiers, components, and templates is displayed for the position where you
have chosen the Ctrl + Space shortcut.

Related Information
ABAP Development Objects
Working with Source Code Templates

Keyword Completion
In the ABAP source code editor , the best matching ABAP keyword is displayed as soon as you start typing the keyword. If you choose the tabulator tab, the
keyword is inserted at the current position.

Prerequisites
To use this functionality, navigate to the
preference page and select the
Typing

Window
Preferences
ABAP Development
Suggest keywords
option.

Editors

Source Code Editors

Code Completion

Context
Note
Keyword completion is enabled by default.

Procedure
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 76 of 138

1. In the source code, start typing a keyword.


The proposal for the most relevant keyword is displayed.

Figure 1: Display of a proposal for a certain keyword while typing

2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding keyword is added to the source code.

Non-Keyword Completion
In the ABAP source code editor , the best matching non-keyword, such as an element name or type definition, is displayed when you start typing.

Prerequisites
To use this functionality, open the
ABAP Development
the Also suggest non-keywords option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select

Context
Note
Non-keyword completion is disabled by default.

Procedure
1. In the source code, start typing a non-keyword.
The proposal for the most relevant non-keyword is displayed.

Figure 2: Display of a proposal for a certain non-keyword while typing

Note
Non-keywords are only proposed if they are already used in the same development object.
2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding non-keyword is added to the source code.

Code Completion
In the ABAP source code editor , you can open the code completion list manually at any position or automatically after you have typed a component selector
such as -, ~, ->, =>.

Context
This functionality enables you to:
add possible keywords or identifiers such as variables, classes, interfaces, methods
select and add the component of the related identifier, such as a field of a structure or a method of a class

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 77 of 138

to your source code.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The most relevant proposals are displayed in the code completion list.
3. Choose Enter to add keywords or identifiers or Shift + Enter to add the full signature of a method or function module.

Note
If the code completion list is not displayed, check whether the related components are correctly defined in the respective development object.
Since SAP NetWeaver 7.40 SP02 and 7.31 SP11, you can use wildcards like the asterisk (*) to limit the list of relevant entries if you do not know the
qualified name of the keyword or identifier.
If you use the asterisk, a list is opened that displays the relevant keywords and identifiers after the cursor position.

Figure 3: Example for finding a keyword or identifier on the basis of an asterisk

4. Selecting a proposal from the code completion list.

Results
The corresponding keyword or identifier is added to the source code at this position.

Related Information
Using Code Completion Automatically
1.1.4.1.3.2 Inserting a Full Signature Automatically
Inserting or Overwriting Source Code

Using Code Completion Automatically


In the ABAP source code editor of a development object, you want to open the code completion list automatically when you enter a component selector such
as -, ~, ->, =>.

Prerequisites
To use this function, open the
Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.

Source Code Editors

Code Completion

preference page

Context
Note
Automatic code completion is selected by default.

Procedure
1. In the source code, you start typing a component.
The following component selectors are supported:
Component Selector

Displayed Proposals

Fields of structures

Components of interfaces

->

Instance components of object references

=>

Static components of ABAP classes / interfaces

The code completion list is automatically displayed.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 78 of 138

Figure 4: Code completion list and popup according to the component

2. Select a component from the code completion list.

Results
The component is added to the source code at the current position.

Figure 5: A call to the static call_static_demo2 method is inserted at your current position

Inserting a Full Signature Automatically


In the ABAP source code editor of a development object, you want to insert the full signature of a method, function module, or form routine automatically.

Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select the

Context
Note
Automatic insert of a full signature is disabled by default.

Procedure
1. In the source code editor, type the name of a method, function module, or form routine.
The code completion list with the available entries and full signature is displayed.
2. Select the relevant entry.

Results
The full signature is inserted in the source code at the current position.

Inserting or Overwriting Source Code


In the ABAP source code editor , you can insert a keyword, identifier, or template from the code completion list at the current position. Optionally, you can
configure the code completion to overwrite the keyword or identifier at the current position.

Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.

ABAP Development

Editors

Source Code Editors

Code Completion

Context

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 79 of 138

Note
Code insertion is defined by default.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The code completion list is opened.

Figure 6: Example for inserting the identifier current_speed and replacing it with the existing identifier result

3. Adopt the displayed entry into your source code by choosing the tabulator key.

Note
To toggle beween inserting and overwriting while the content assist is active, choose Ctrl.

Results
The selected keyword, identifier, or template is inserted and replaces the keyword or identifier at the current cursor position.

Figure 7: Example after replacing the identifier result with current_speed

Working with Code Completion


In the ABAP source code editor , the content assist function proposes valid ABAP keywords and identifiers that are relevant at the current position. One of
these proposals can be inserted in the source code.

Context
You can reduce the time spent on code editing and ensure that you are using the valid source code elements by using code completion.
The following code completion functions are provided:
Table 1: List of Available ABAP Code Completion Functions
Content Assist

Description

Keyword Completion

The best matching ABAP keyword is automatically proposed as soon as you start typing.

Non-Keyword Completion

The best matching non-keyword that is available for the corresponding source code section is automatically
proposed as soon as you start typing.

Code Completion

A list of all matching keywords, identifiers, components, and templates is displayed for the position where you
have chosen the Ctrl + Space shortcut.

Related Information
ABAP Development Objects
Working with Source Code Templates

Keyword Completion
In the ABAP source code editor , the best matching ABAP keyword is displayed as soon as you start typing the keyword. If you choose the tabulator tab, the
keyword is inserted at the current position.

Prerequisites
To use this functionality, navigate to the
preference page and select the
Typing

Window
Preferences
ABAP Development
Suggest keywords
option.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Editors

Source Code Editors

Code Completion

Page 80 of 138

Context
Note
Keyword completion is enabled by default.

Procedure
1. In the source code, start typing a keyword.
The proposal for the most relevant keyword is displayed.

Figure 1: Display of a proposal for a certain keyword while typing

2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding keyword is added to the source code.

Non-Keyword Completion
In the ABAP source code editor , the best matching non-keyword, such as an element name or type definition, is displayed when you start typing.

Prerequisites
To use this functionality, open the
ABAP Development
the Also suggest non-keywords option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select

Context
Note
Non-keyword completion is disabled by default.

Procedure
1. In the source code, start typing a non-keyword.
The proposal for the most relevant non-keyword is displayed.

Figure 2: Display of a proposal for a certain non-keyword while typing

Note
Non-keywords are only proposed if they are already used in the same development object.
2. Adopt the displayed entry into your source code by choosing the tabulator key.

Results
At the position where you have selected the proposal, the corresponding non-keyword is added to the source code.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 81 of 138

Code Completion
In the ABAP source code editor , you can open the code completion list manually at any position or automatically after you have typed a component selector
such as -, ~, ->, =>.

Context
This functionality enables you to:
add possible keywords or identifiers such as variables, classes, interfaces, methods
select and add the component of the related identifier, such as a field of a structure or a method of a class
to your source code.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The most relevant proposals are displayed in the code completion list.
3. Choose Enter to add keywords or identifiers or Shift + Enter to add the full signature of a method or function module.

Note
If the code completion list is not displayed, check whether the related components are correctly defined in the respective development object.
Since SAP NetWeaver 7.40 SP02 and 7.31 SP11, you can use wildcards like the asterisk (*) to limit the list of relevant entries if you do not know the
qualified name of the keyword or identifier.
If you use the asterisk, a list is opened that displays the relevant keywords and identifiers after the cursor position.

Figure 3: Example for finding a keyword or identifier on the basis of an asterisk

4. Selecting a proposal from the code completion list.

Results
The corresponding keyword or identifier is added to the source code at this position.

Related Information
Using Code Completion Automatically
Inserting a Full Signature Automatically
1.1.4.1.3.3 Inserting or Overwriting Source Code

Using Code Completion Automatically


In the ABAP source code editor of a development object, you want to open the code completion list automatically when you enter a component selector such
as -, ~, ->, =>.

Prerequisites
To use this function, open the
Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.

Source Code Editors

Code Completion

preference page

Context
Note
Automatic code completion is selected by default.

Procedure
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 82 of 138

1. In the source code, you start typing a component.


The following component selectors are supported:
Component Selector

Displayed Proposals

Fields of structures

Components of interfaces

->

Instance components of object references

=>

Static components of ABAP classes / interfaces

The code completion list is automatically displayed.

Figure 4: Code completion list and popup according to the component

2. Select a component from the code completion list.

Results
The component is added to the source code at the current position.

Figure 5: A call to the static call_static_demo2 method is inserted at your current position

Inserting a Full Signature Automatically


In the ABAP source code editor of a development object, you want to insert the full signature of a method, function module, or form routine automatically.

Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.

Editors

Source Code Editors

Code Completion

Typing

preference page and select the

Context
Note
Automatic insert of a full signature is disabled by default.

Procedure
1. In the source code editor, type the name of a method, function module, or form routine.
The code completion list with the available entries and full signature is displayed.
2. Select the relevant entry.

Results
The full signature is inserted in the source code at the current position.

Inserting or Overwriting Source Code


In the ABAP source code editor , you can insert a keyword, identifier, or template from the code completion list at the current position. Optionally, you can
configure the code completion to overwrite the keyword or identifier at the current position.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 83 of 138

Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.

ABAP Development

Editors

Source Code Editors

Code Completion

Context
Note
Code insertion is defined by default.

Procedure
1. In the source code editor, type the beginning character(s).
2. To display the list of suggested entries at this position, choose Ctrl + Space.
The code completion list is opened.

Figure 6: Example for inserting the identifier current_speed and replacing it with the existing identifier result

3. Adopt the displayed entry into your source code by choosing the tabulator key.

Note
To toggle beween inserting and overwriting while the content assist is active, choose Ctrl.

Results
The selected keyword, identifier, or template is inserted and replaces the keyword or identifier at the current cursor position.

Figure 7: Example after replacing the identifier result with current_speed

1.1.4.2 Working with Source Code Templates


Context
Code templates reduce the time spent on routine coding. The new ABAP IDE provides a number of predefined code templates for ABAP. In addition, you can
create further templates for your own use.

Procedure
1. To search for all ABAP templates available...
1. Open the preferences page
ABAP Development
Source Code Editor
2. To use a template...
1. In the source code editor, write the beginning characters of the template.
2. Select Ctrl + Space (code completion).

Templates

from the menu bar.

Tip
Alternatively, you can use the Templates view to insert the template code through Drag & Drop.
3. To add a new template...
1. Open the ABAP source editor for any arbitrary development object.
2. Switch to Templates view.
3. In the toolbar of the Templates view, click the Create a New Template icon.
4. Specify the Name, the Description and the Pattern for the template.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 84 of 138

Figure 1: Adding an new ABAP template

5. Improve the format for the source code template manually.


6. Save the new template with OK.

Related Information
ABAP Development Objects
Adding Code Templates to an ABAP Exception Class

1.1.4.3 Closing Brackets and Literals Automatically


Context
Whenever you enter an opening bracket such as:
( or { or [
or a literal such as '', ``, ||,
the relevant closing character will be automatically inserted in the editor automatically directly behind the cursor, so you do not need to take care of it.

Note
The feature for closing brackets and literals is enabled by default. If you wish to disable it, you have to switch off the corresponding setting in the
preferences page:
Window

Preferences

ABAP Development

Editors

Source Code Editors

Code Completion

Automatically close brackets and literals

Related Information
ABAP Development Objects

1.1.4.4 Formatting ABAP Source Code


Context
The source code editor supports you when formatting
Complete ABAP source code within the editor
Use the context menu
Source
Format
or the Shift + F1 shortcut.
Source code blocks
Use the context menu

Source

Format Block

or the Ctrl + Shift + F1 shortcut.

Note
For each ABAP project the formatting options of the ABAP workbench are applied. You can change these formatting options project properties. To open
the properties of an ABAP project, focus the respective project in the project explorer and select properties from the context menu. Here, the formatter
settings can be found in
ABAP Development
Editors
Source Code Editors
Formatter .

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 85 of 138

Here the following preferences are available:


Indent source code to specify the alignment of the source code
Code style to specify the source code formatting of keywords and identifiers

1.1.4.5 Changing Colors for ABAP Source Code


Context
You can define the color how text or annotation types are displayed in ABAP source code.
For this, you have to set the corresponding preferences in order to:
Changing Font Color of Texts
Changing Colors of Annotation Types

Note
The source code editor displays the ABAP source code and annotation types with predefined colors. However, you can change these default settings to
adapt them to your personal needs.
The new color settings become effective as soon as you (re-)open the source code editor.

Related Information
Formatting ABAP Source Code
Marking Occurrences in the Source Code Editor

1.1.4.5.1 Changing Font Color of Texts


Context
You can define the coloring of following texts that is displayed in ABAP source code:
Communication log
Profiler
Syntax
WebDynpro error texts
WebDynpro Mapping framework theme
This makes it easier for you, skim through source code in order to distinguish for example between an ABAP keyword and elements.

Procedure
1.
2.
3.
4.

Open the
General
Appearance
Colors and Fonts
preference page.
Expand the folders
ABAP
Syntax Coloring
Select the text type you want to change and click the Edit... button.
Select the color and confirm with OK.

Note
To restore the default color settings, click the Restore Defaults button.

Results
The new color settings become effective as soon as you (re-)open the source code editor.

Related Information
Formatting ABAP Source Code
Changing Colors of Annotation Types

1.1.4.5.2 Changing Colors of Annotation Types


Context
You can define the coloring of annotation types in the source code. These are, for example:
ABAP block highlighting
ABAP coverage
ABAP debug exceptions
Breakpoints

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 86 of 138

And so on
This enables you, highlight annotation types in your personal color.

Procedure
1. Open the
General
Editors
Text Editors
preference page.
2. Select the annotation type you want to change and choose the Color button.
3. Select the color and confirm with OK.

Note
To restore the default color settings, click the Restore Defaults button.

Results
The new color settings become effective as soon as you (re-)open the source code editor.

Related Information
Changing Font Color of Texts
Marking Occurrences in the Source Code Editor
Changing Colors for ABAP Source Code

1.1.4.6 Editing Comments in ABAP Source Code


Context
You have the following options for commenting source code:
ABAP comments to explain a particular part or section of source code
ABAP Doc comments to describe code elements (for example attributes, methods, local variables) in the code element information popup, ABAP
Element Info view, and in the code completion list

Related Information
ABAP Element Info View
ABAP Doc
Editing ABAP Doc Comments
Editing ABAP Comments

1.1.4.6.1 Editing ABAP Doc Comments


The content of ABAP Doc comments can be imported, added, or entered by a user. You can add ABAP Doc comments within ABAP classes, ABAP
interfaces, ABAP programs, and ABAP function groups for elements like classes, methods, locale variables, and so on.

Context
In the editor, the ABAP Doc comments are added one row above the related element in the definition part.
Example of an ABAP Doc comment in the source code:
"! ABAP Doc test
METHODS method_with_variable.

Related Information
ABAP Doc
Adding ABAP Doc Comments
Adding Documentation of Parameters and Exceptions in ABAP Doc Comments
Formatting ABAP Doc Comments
Importing Descriptions of Class and Interface Components from the Class Builder

1.1.4.6.1.1 Adding ABAP Doc Comments


A single ABAP Doc comment or a block of several ABAP Doc comments is introduced by the character combination "!.

Positioning ABAP Doc Comments in the Definition


In the editor, the ABAP Doc comments are added one row above the related element in the definition part.
So, the ABAP Doc comment has to start before the element, directly in front of a declarative statement (for example, data declaration, method definition, class
definition). Otherwise a warning will be displayed. Because, the source code editor verifies the position and the content structure of ABAP Doc comments

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 87 of 138

definition). Otherwise a warning will be displayed. Because, the source code editor verifies the position and the content structure of ABAP Doc comments
when you execute the ABAP syntax check. So, if comments are added at the wrong position or contain incorrect syntax, a warning is displayed in the
Problems view.

Example
Example for a single ABAP Doc comment:
"! ABAP Doc test
METHODS method_with_variable.
Example for an ABAP Doc of a constant :
"! This is documentation for the following constant
constants co_initial_value type i value 0.

Adding Statements over Multiple Lines


You can use multiple lines to document source code elements. In this case, you have to add the character combination "! in front of each line.

Example
Example for a multi line constant definition:
"! This documentation for the following constant is documented
"! in multiple lines.
constants co_initial_value type i value 0.

Documenting a Block of Statements


If you want to document a block of statements using the ABAP colon comma semantics, the ABAP Doc comment block must be located in front of the
identifier and after the colon.

Example
"! Initial value
co_initial_value type i value 0,
"! Invalid value
co_invalid_value type i value -1.

Related Information
Adding Documentation of Parameters and Exceptions in ABAP Doc Comments

1.1.4.6.1.2 Adding Documentation of Parameters and Exceptions


in ABAP Doc Comments
You can document parameters and exceptions for methods, events, functions modules, and subroutines.

Context
This function supports you in listing all undocumented parameters and exceptions that relate to the selected element.

Note
If you have already added parameters in an ABAP Doc comment and made changes in the meantime, you can also add the new parameters with this
function. Thus, only the new parameters will be added. Parameters and exceptions that are already documented will not be changed.
In the ABAP Language Help (through F1 in the source editor), you will find further information about using the syntax of ABAP Doc comments.

Procedure
1. In the source code editor, navigate to the definition part of the element of the relevant code line.
2. [Optional]: If no ABAP Doc comment exists, enter "! to start the comment line.

Example
Example of an empty ABAP Doc comment:
"!
METHODS method_with_variable.

Note
Choose Enter to add a new row for further comments. The editor will automatically start the new row with "!
3. Place the cursor on the position where you want to add the missing parameters or exception.
4. In the context menu, choose Quick Fix (Ctrl 1) , and select Add missing parameters to documentation to add the syntax of the missing parameters
and exceptions.
The name of the missing parameters are added and introduced by a @. You can describe each parameter or exception with the corresponding

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 88 of 138

documentation after the |.

Note
Every parameter or exception should occupy a separate line in order to keep the source code readable.

Example
Example of a type definition added as an ABAP Doc comment:
"! @parameter p1 |
METHODS method_with_variable.
5. Save the changes.

Results
The documentation is saved and displayed in the source code editor of the ADT and the SAP GUI.

Related Information
Adding ABAP Doc Comments
Importing Descriptions of Class and Interface Components from the Class Builder
Creating ABAP Exception Classes

1.1.4.6.1.3 Formatting ABAP Doc Comments


You can format ABAP Doc comments with XHTML tags.

Context
This enables you to structure and highlight parts of your comments that are rendered, for example, into HTML files or the ABAP Element Info view.
You can use the following XHTML tags to format text:
Formatting option

Tag

Alternative Tag

Line break

<br/>

<br></br>

Paragraph

<p>...</p>

Emphasized text

<em>...</em>

Strong emphasized text

<strong>...</strong>

Unsorted lists

<ul><li>...</li></ul>

Sorted lists

<ol><li>...</li></ol>

Headers

<h1>...</h1> <h2>...</h2> <h3>...</h3>

Note
In addition, ABAP Development Tools (ADT) analyzes the content of ABAP Doc comments, converting it to HTML, and displays it appropriately.
Consequently, special characters such as ", ', <, > and @ must be escaped using &quot; , &apos; , &lt; , &gt; , and &#64; .

Example
"Test class" will be formatted as cursive:
"! <em>Test class</em> for demo
class CL_FOR_TEST_DEMO definition
public
final
create public.

Related Information
Adding ABAP Doc Comments
Adding Documentation of Parameters and Exceptions in ABAP Doc Comments

1.1.4.6.1.4 Importing Descriptions of Class and Interface


Components from the Class Builder
Prerequisites
The descriptions of components for ABAP classes or ABAP interfaces are entered in the form-based Class Builder of the ABAP Workbench.
You are logged on in English as your ABAP project language. Note that, in accordance with SAP programming guidelines, you should write program
comments in English.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 89 of 138

Context
In ABAP Development Tools, you can import descriptions of ABAP classes or ABAP interfaces (including their attributes, methods, parameters, and so on)
that are entered in the form-based Class Builder
Example
In the source code editor, the definition of the CLASS cl_demo_importing_description ABAP class is displayed as follows:
CLASS cl_demo_importing_description DEFINITION.
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
PROTECTED SECTION.
PUBLIC SECTION.
PRIVATE SECTION.
DATA: myself TYPE REF TO cl_demo_importing_description.
DATA any_string1 TYPE c.
METHODS method_with_variable.
ENDCLASS.
In the form-based Class Builder of the ABAP Workbench, the following description is saved for the METHOD_WITH_VARIABLE method of the same class:

Figure 1: Example of a method description that can be reused as ABAP Doc in ADT

Procedure
1. In the source code editor of a class or interface, open the context menu.
2. Choose
Source
Import ABAP Doc from Descriptions .

Results
The source code editor imports all descriptions of the class or interface components from the Class Builder and inserts them as ABAP Doc comments at the
appropriate position in the source code editor of ADT.

Note
The source code editor does not overwrite existing ABAP Doc comments for class or interface components that are already documented with ABAP Doc.
Example
In the source code of the CLASS cl_demo_importing_description ABAP class, the imported descriptions of the components are added as ABAP Doc
comments:
"! Imported class description from the Class Builder
CLASS cl_demo_importing_description DEFINITION.
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
PROTECTED SECTION.
PUBLIC SECTION.
PRIVATE SECTION.
"! Imported attribute description
DATA: myself TYPE REF TO cl_demo_importing_description.
"! Imported attribute description
DATA any_string1 TYPE c.
"! Imported method description from the Class Builder
METHODS method_with_variable.
ENDCLASS.

Related Information
ABAP Projects
ABAP Doc

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 90 of 138

Adding Documentation of Parameters and Exceptions in ABAP Doc Comments

1.1.4.6.2 Editing ABAP Comments


Context
ABAP comments start with * or ".

Note
You can also use the following shortcuts:
Shortcut

Function

Description

Ctrl + <

Add Comment

The editor pastes an asterisk (*) at the beginning of


the line.

Ctrl + >

Remove Comment

The editor removes the existing asterisk (*) at the


beginning of the line.

Ctrl + 7

Toggle Comment

The editor pastes or removes an asterisk (*) at the


beginning of the line.

Note
In addition, you have the following options for working with ABAP comments:
In the context menu of the editor, choose Source and select the corresponding entry.
In an ABAP class and procedure, enter an asterisk (*) to split source code into logical sections.
Enter an asterisk (*) to disable ABAP statements.
Enter double quotation marks (") to describe source code within a line.

Related Information
Editing ABAP Doc Comments

1.1.4.7 Displaying Information of ABAP Source Code Elements


Context
In the source code editor, you can display further information of an element using the following functions:
Displaying Details of Source Code Elements to display the definition and documentation of an element in the code element info popup.
Displaying the Method Definition within ABAP Source Code to display the method name of an element in the code element information popup. This
enables you to check, the signature of the method you are currently working on.
Displaying Details in the ABAP Element Info View to display the definition and documentation of ABAP source code elements in the ABAP Element
Info view.
Displaying Details in the Code Completion List while Programming to display details of a selected element to get further information in the code
completion list.

Related Information
ABAP Element Info View
ABAP Projects

1.1.4.7.1 Displaying Details of Source Code Elements


Context
In source code-based development objects (like ABAP classes, ABAP interfaces, ABAP programs, and ABAP function groups), you can display the definition
and documentation of many ABAP code elements in a code element info popup.
These are for example:
Used classes and interfaces
Called methods, function modules, programs
Variables
Dictionary objects like structures, tables, views, and so on
Text elements and messages
This enables you to obtain further details directly at the position where you are in the source code without navigating to the referenced object.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 91 of 138

Figure 1: Displaying the most relevant source code details in the code element information popup

Note
You can only display the details on the use, not on the definition of elements.

Procedure
1. In the source code editor, select the corresponding element.
2. Press F2 or choose
Source
Show Element Information

in the menu bar or context menu.

Results
A code element information popup will be opened that displays the following information:
Element name and its definition
Documentation, if such is available for this element

Related Information
ABAP Projects
Displaying the Method Definition within ABAP Source Code
Displaying Details in the ABAP Element Info View
Displaying Details in the Code Completion List while Programming

1.1.4.7.2 Displaying the Method Definition within ABAP Source


Code
Context
In a method implementation, you can display the name, parameters and exceptions of the method and its documentation in a code element information popup.
This enables you to obtain information about the method from the position where you are in the source code.

Figure 1: Example of a code element information popup to display method details

Procedure
1. In the source code editor, select the corresponding method implementation.
2. Press Alt + F2 or choose
Source
Show Method Implementation
in the menu bar or context menu.

Results
A code element information popup will be opened that displays the method name, its parameters, and exceptions and, if available, the documentation of the
method.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 92 of 138

Related Information
ABAP Projects
Displaying Details of Source Code Elements
Displaying Details in the ABAP Element Info View
Displaying Details in the Code Completion List while Programming

1.1.4.7.3 Displaying Details in the ABAP Element Info View


Context
You can display the content of the code element information popup also in the ABAP Element Info view. In this way, you can for example compare the
details of several elements or methods.

Figure 1: Example of the ABAP Element Info view to display information of ABAP source code

Note
You can only display the details on the use, not on the definitions of elements.

Procedure
1. Open the info popup to display the corresponding details.
2. In the code element information popup, press the Show in ABAP Element Info view button.

Results
ADT provides the details of the code element information popup in the ABAP Element Info view.

Note
You can perform the following functions on elements and methods in the ABAP Element Info view:
If you click the

button, you can lock the current ABAP Element Info view to compare details of several methods.

If you click the


source code.

button, the display of the ABAP Element Info view will automatically be refreshed to the position where you are in the ABAP

Related Information
ABAP Projects
Displaying Details of Source Code Elements
Displaying the Method Definition within ABAP Source Code
Displaying Details in the Code Completion List while Programming

1.1.4.7.4 Displaying Details in the Code Completion List while


PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 93 of 138

1.1.4.7.4 Displaying Details in the Code Completion List while


Programming
Prerequisites
In the source code editor, you are using the code completion function to insert an element. The results list is displayed.

Context
You can display futher information of an element in a tooltip of the code completion results list. In this way, you can check the element details directly while
programming in the source code editor.

Figure 1: Example of a tooltip in the code completion results list

Procedure
In the code completion results list, select the element.

Results
ADT will provide the details of the selected element into the corresponding tooltip.

Related Information
ABAP Projects
Displaying Details of Source Code Elements
Displaying the Method Definition within ABAP Source Code
Displaying Details in the ABAP Element Info View

1.1.4.8 Marking Occurrences in the Source Code Editor


Context
The ABAP source code editor provides a highlighting feature for occurrences of local variables and parameters. It allows you to perform the following activities:
To mark the occurrences, click on the local variable or parameter in theeditor.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 94 of 138

Figure 1: Highlighting occurrences of local variables in the source editor

To navigate between the occurrences choose the toolbar icons


(Next Annotation) and
(Previous Annotation).
To search for occurrences, starting from the current position, open the context menu and choose the menu
Source
press Ctrl + Shift + U.
To disable or enable this feature, use the marker icon
in the toolbar.
To specify the preferences for marking, choose
Window
Preferences

ABAP Development

Occurrences in File

Source Code Editor

or

Mark Occurrences

Related Information
ABAP Development Objects

1.1.4.9 Viewing the Outline


Context
The Outline view displays the internal structure of an ABAP class, interface, or program that is currently opened in the ABAP source code editor.
Activities from the Outline View Toolbar
The following activities are provided in the toolbar:
Icon

Description
If you activate this filter, only public members of classes will be displayed as an
outline. All non-public members of ABAP classes will remain hidden.
If you activate this filter, only methods of ABAP classes or interfaces will be
displayed as an outline. All members that are not methods, such as attributes, data
types, and events will remain.

Activities from the Context Menu of a Structuring Element


The following activities are provided from the context menu of an element in the outline tree:
Function

Description

Navigate to Declaration

Navigates to the declaration part in the source code editor.

Navigate to Implementation

Navigates to the implementation part of a class or test class in the source code
editor.

Run As

Enables you to directly execute programs (F8) or launch test environments for
classes, or to start ABAP unit tests. See also: Running Executable Objects Running
ABAP Unit Tests

Debug As

Enables you to start debugging ABAP code after having set a breakpoint. See also:
Debugging ABAP Code

Profile As

Enables you to start profiling (ABAP Traces) for the ABAP program. See also: Using
ABAP Profiling the ABAP Trace

Coverage As

Enables you to start a code coverage measurement. See also: Checking ABAP Unit
Code Coverage

Get Where-used List

Enables you to determine the development objects that use a specific object. See
also: Where-Used Function Searching Usages (Where-Used)

Rename

Enables you to find and rename variables, methods, and form routine names, as

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 95 of 138

well as other elements and form routine names, as well as other elements of an
ABAP program. ABAP classes and ABAP interfaces can be renamed as well. See
also: Renaming Identifiers

Related Information
Outline View
Advantages of Using the Outline View
Icons in the Outline View
Tools for ABAP Development
Using Quick Views
Viewing the ABAP Type Hierarchy
Getting Orientation in the Source Code Using Breadcrumbs

1.1.4.10 Viewing the ABAP Type Hierarchy


Context
You can open the ABAP Type Hierarchy view to display the inheritance tree of a selected ABAP class or interface.

Note
In contrast to the corresponding quick view (Ctrl + T), you can look at the ABAP type hierarchy for a selected class or interface independently from the
current editor content. The hierarchy of a class or interface is still displayed in the ABAP Type Hierarchy view even if the source editor has been closed,
in the meantime.

Procedure
1. Select either the name of the class in the currently opened ABAP source editor or the corresponding node in the Project Explorer.
2. Open the context menu and then choose Open ABAP Type Hierarchy or press T.
The ABAP Type Hierarchy view appears that displays the class hierarchy including the superclasses and subclasses.

Figure 1: ABAP Type Hierarchy view that displays a class hierarchy

Related Information
ABAP Type Hierarchy View
Using Quick Views
Viewing the Outline
Getting Orientation in the Source Code Using Breadcrumbs

1.1.4.11 Getting Orientation in the Source Code Using


Breadcrumbs
Prerequisites
Select the

breadcrumb icon from the tool bar to display the breadcrumb bar in the source code editor.

Context
The breadcrumb functionality helps you to orientate and to navigate within the source code of a development object. It provides you the same structural
information like the Outline view.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 96 of 138

Figure 1: Displaying siblings of an element in the breadcrumb bar

You can display the breadcrumb bar in the source code editor of the following source code-based development objects:
ABAP
ABAP
ABAP
ABAP
ABAP
ABAP
ABAP

classes
interfaces
programs
includes
function group main inlcudes
function group inlcudes
function modules

Example
You are working on a long method where you cannot see the start statement. But you want to know the name of the method. For this, the breadcrumb displays
the names of the corresponding class and the method.

Procedure
1. In the source code editor, position the cursor where you need further information.
In the breadcrumb bar, the name of the method or development object is displayed.
2. Select the
icon.
A drop-down list is opened where the name of the relevant development objects and subcomponents are displayed.

Note
In the search field, you can search for a particular development object or subcomponent.
3. Select the corresponding entry through double-click.

Results
The corresponding development object or subcomponent is opened and the cursor is positioned at the elements name (for example, method name, class
name, and so on).

Related Information
Icons in the Outline View
Using Quick Views
Viewing the Outline
Viewing the ABAP Type Hierarchy

1.1.4.12 Using Quick Views


Context
So-called quick views are in-place views that are shown on top of the source code editor area and can be easily opened using keyboard shortcuts.
In the context of ABAP source code navigation, the following views are available:
Quick Outline (Ctrl + O shortcut) - displays the internal structure of a class, interface, or program.
Quick Type Hierarchy (Ctrl + T shortcut) - displays the type hierarchy of a class or interface.

Related Information
Viewing the Outline
Viewing the ABAP Type Hierarchy
Getting Orientation in the Source Code Using Breadcrumbs

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 97 of 138

1.1.4.12.1 Quick Outline


Context
To use the quick outline in the currently opened ABAP source editor:

Procedure
1. Press Ctrl + O or open the context menu of the editor and choose Quick Outline.
The in-place outline view appears for the currently opened development object.

Figure 1: Quick outline for an ABAP class

2. Press Ctrl + O once again.


The Outline view shows also all subcomponents of all superclasses and all implemented interfaces (in blue font).
3. Start typing while the Outline view is shown to filter the list of elements.

Figure 2: Filtering elements in the quick outline

Related Information
Quick Type Hierarchy
Using Quick Views

1.1.4.12.2 Quick Type Hierarchy


PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 98 of 138

Context
To use the quick view for type hierarchy:

Procedure
1. Select the name of the class or interface in the currently opened ABAP source editor.
2. Press Ctrl + T or open the context menu of the editor and choose Quick Type Hierarchy.
The in-place type hierarchy view appears for the selected class or interface.

Figure 1: Quick view displaying the class hierarchy

Related Information
Quick Outline
Using Quick Views

1.1.4.13 Managing Version Conflicts


Context
In systems with an automatic logoff mechanism, in particular, it can happen that your lock gets lost. This can lead to the situation whereby other users may
modify the same development object in the backend even if your changes have not yet been stored.
The merging function allows you to decide which version should be stored if another user has changed the same source in the backend in parallel. The merge
dialog offers you options to:
Compare and merge the versions available: This option opens the Compare editor where you can track the changes first.
Keep your local version: This will overwrite the backend version of your source code with those from your ABAP project.
Keep the backend version: This will overwrite your local source code with those from the ABAP Repository (backend).

Figure 1: Dialog that appears when version conflict has been detected

1.1.4.14 Switching between Inactive and Active Versions of a


Source-based Object
You can toggle between the inactive and active version of any source-based objects such as classes, function modules, or ABAP programs. This functionality
enables you to read the inactive version that is saved by another user and not available in your working area.

Prerequisites
You have made changes in the source code and saved them.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 99 of 138

This functionality is provided in SAP NetWeaver 7.4 SP08 and higher as well as in 7.31 SP14 and higher.

Procedure
1. In the source code editor, open the corresponding development object.
2. In the context menu, choose Switch to active/inactive version or select
3. [Optional:] Repeat step 2 to switch back to the opposite version.

Edit

Switch to active/inactive version

from the menu.

Results
In the source code editor, the inactive or active version of a development object is displayed.
Note
In the tab of the current source code editor, the status of a development object is indicated by a decorator. Inactive development objects are highlighted with a
.

Related Information
Comparing Source Code
Status of a Development Object

1.1.5 Applying Quick Assists


Context
ABAP Development Tools (ADT) provides a set of quick assists that help you to change ABAP source code in a semi-automated way.

Related Information
Refactoring ABAP Source Code
Applying ABAP Quick Fixes
Applying Other Quick Assists
Quick Assists
Quick Assist View

1.1.5.1 Refactoring ABAP Source Code


Context
ABAP Development Tools provides a number of functions to refactor ABAP source code.

Related Information
Renaming Identifiers
Extracting Methods
Extracting Constants
Extracting and Converting Variables
Moving Members
Quick Assists
ABAP Refactorings
Extracting Constants from Literals
Exception Handling
Extracting Variables from Literals
Quick Assist View

1.1.5.1.1 Renaming Identifiers


Context
ABAP Development Tools (ADT) provides an intelligent search and renaming function that can find and rename variables, methods, and form routine names,
as well as other elements of an ABAP program. ABAP classes and ABAP interfaces can be renamed as well.
In respective of your current SAP NetWeaver version, following renaming functions are provided:
Renaming Elements in a Single Source Unit
Renaming Elements in All Includes of an ABAP Program
Limitations SAP NetWeaver 7.3 EHP1 (SP4-10)
You can only change the names of elements that are used solely in the local ABAP program, as shown in the editor (class pool, program, function module
include). If you try to rename an element that is used in another activated program, the Rename reports an error and does not make any changes. This check

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 100 of 138

ensures that changes to a local ABAP program will not cause unintended errors in another program.
Newer Releases
In addition, you can rename global ABAP classes, interfaces, or their members (such as fields or methods of classes or interfaces) that are used globally in
other programs. All external references in other classes, interfaces, or other program types are then automatically updated accordingly.
Not Supported Object Types

Caution
This kind of automatic update of external references is currently not supported in simple transformations, package interfaces, transactions, data elements,
structures, table types, eCatt objects, and so on.

Related Information
Extracting Methods
Extracting Constants
Extracting and Converting Variables
Moving Members
Exception Handling
Quick Assists
Quick Assist View

1.1.5.1.1.1 Renaming Elements in a Single Source Unit


Context
You can change all occurrences of an element (except ABAP keywords) in an ABAP program at the same time.

Procedure
1. In the source code editor, position the cursor on the element to be renamed.
2. Start the
Edit
Quick Fix (Ctrl 1)
Rename function function using the context menu and then Rename x in source unit (Ctrl 2, R)).
A frame appears around each occurrence of the element.

Figure 1: Highlighted position of the element that is edited and all further occurrences of the element

3. Type in your change. The ADT makes the change simultaneously in all occurrences of the element in the source code unit you are currently working in.
This technique is only allowed for named elements that occur only in your current source code unit. For example, you cannot use this technique to
rename elements in a method implementation if the named element is also used in your ABAP Unit tests.

Results
You have renamed an element in your source code throughout the source code unit you are currently working in.

Related Information
Renaming Identifiers
Renaming Elements in All Includes of an ABAP Program

1.1.5.1.1.2 Renaming Elements in All Includes of an ABAP


Program

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 101 of 138

Context
You can use this function to rename elements in all parts of the ABAP source code.

Procedure
1. In the source code editor, position the cursor on the element to be renamed. ADT marks the element.

Figure 1: Highlighted positions where an element is renamed

It also marks all other occurrences of the element in the source unit that you are editing. You can scroll or use Ctrl K to find other occurrences quickly.
2. Start the
Source
Rename (Alt Shift R)
from the context menu of the element to be renamed). Or use the Quick Fix menu: Ctrl 1 and then
Rename...
3. In the dialog box that follows, enter the new name for the element and choose Next.

Note
You can also choose Finish to complete the renaming right away.

Figure 2: Input field to enter the new element name

4. The Rename function shows you the changes that will be made. Use the navigation buttons to step through the changes.

Figure 3: Changes highlighted in a compare window

5. Choose Finish to complete the renaming.

Results
The wizard renames the selected element and updates the references.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 102 of 138

Figure 4: Display of the renamed elements and updated references

Note
You can undo the renaming by choosing

Undo Rename (Ctrl Z)

from the context menu.

Related Information
Renaming Identifiers
Renaming Elements in a Single Source Unit

1.1.5.1.2 Extracting Methods


Context
In the source code editor, you have the following options for extracting methods:
Function

Description

Available since SAP


NetWeaver 7.3 EHP1

Extracting Methods from Statements

Creating a new method in the current class. The selected code is


SP06
moved into the body of the new method and replaced with a call to the
new method. Further occurrences of similar code are not replaced.

SP02

Extracting Methods from Expressions

Creating a new method in the implementation of an ABAP class that

SP05

SP11

Available since SAP


NetWeaver 7.4

returns the result of a selected expression. The selected expression is


replaced with the call to the new method. Further occurrences of
similar expressions are not replaced.

Related Information
Extracting Constants
Extracting and Converting Variables
Moving Members
Creating Method Implementations from the Method Definition
Creating Method Definitions from Implementation Parts
Creating Implementation Parts for Unimplemented Methods
Creating Methods from Method Calls
Exception Handling
Quick Assists
Quick Assist View

1.1.5.1.2.1 Extracting Methods from Statements


Prerequisites
You must be editing a global or local ABAP class in a class pool, a program, or another type of ABAP program. Method extraction is not supported in code
outside of classes. Also, you can only extract a method within the start and end area of another method.
Your code should be free of syntax errors.

Context
In the implementation of an ABAP class, you can create a new method. The selected code is moved into the body of the new method and replaced with a call
to the new method. Further occurrences of similar code are not replaced.

Note
The name of the new method is derived from the first code line that is selected. To this end, you can add a comment at the beginning of the source code
that contains the keywords you want to reuse in the name of the new method.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 103 of 138

Figure 1: Example of selected source code that is extracted into a new method

Procedure
1. In the source code editor, select the code that you want to move to a new method.
2. In the context menu, choose
Source
Extract Method ...
or the shortcut (Alt Shift M) to start the dialog box.

Figure 2: Input field to edit the name of the method to be extracted

You can change a suggested method name as well as the suggested name and attributes of a method parameter.

Note
You cannot add a parameter to the proposed method signature, nor can you delete one.
3. Chose Next to open the transport dialog:
4. [Optional:] If the changed object is not assigned to a transport request, choose Change Transport to select an existing or create a new transport
request.
Select Error handling if you want to ignore syntax errors. Consequently, no error messages will be displayed.
Select Activation if you want to activate the affected objects after refactoring. As a result, the changes will also be available in the related
objects.

Note
The method extractor presents the ABAP Compare editor to display the changes that will be made.
5. Chose Next to check the changes that will be made. The method extractor presents the ABAP Compare editor to display the changes that will be made.
6. Use the ABAP Compare navigation buttons to review the changes. These are all shown in the Refactored Source editor to the right.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 104 of 138

Figure 3: Navigation between original and refactored changes

Note
Comment as default name: Alternatively, you can start your selection with a comment. The comment is then automatically suggested as the name
of the new method. But you can also change the name or write in your own name from scratch.
Method signature: The code extractor is very intelligent and usually does a good job of parsing the code to extract and suggest useful method
parameters. However, it can under rare circumstances be misled. In this case, you can adjust the extracted code after you are finished with the
method extraction. You can also, within reason, change the suggested direction (exporting/changing...) of a parameter.
Method visibility: By default, the new method is a private method in the local or global class you are currently working in. You cannot have the
method created in another class.
7. Choose Finish to complete the method extraction.

Results
The method extractor inserts a call to the new method. Using Undo Extract Method (Ctrl Z) in the editor context menu, you can cancel the method extraction
and revert to the old code.
In addition to moving the extracted code and replacing it with a method call, the method extractor has done the following:
Implemented the signature with your changes that it suggested for the new method
Declared any local variables that are needed in the new method
Exposed class-based or classic exceptions in the method signature
Suggested a simple, recommended naming convention for parameters and variables in the new method
You may wish to delete unused variables in the class from which you extracted the method. The method extractor does not change the data declarations in
your code, so the method extraction may leave an orphaned data declaration behind.

Related Information
Extracting Methods from Expressions
Extracting Methods
Quick Assists
Quick Assist View

1.1.5.1.2.2 Extracting Methods from Expressions


Context
In the implementation part of an ABAP class, you can create a new method that returns the result of a selected expression. The tool declares this returning
parameter with type Integer and the selected expression is replaced with a call to the new method.

Note
The editor only replaces the selected expression. If the same expression is used several times in the same repository object, only the selected occurrence
is replaced. This means you have to extract all remaining occurrences individually.
Example
Here, the expression length * width is extracted into a method:
CLASS CL_METHOD_CHECK_AREA DEFINITION PUBLIC.
" This class describes the 'length * width' extraction of an expression to a new method
PUBLIC SECTION.
DATA:

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 105 of 138

length TYPE i,
width TYPE i.
METHODS:
check_area
RETURNING
VALUE(r_result) TYPE abap_bool.
ENDCLASS.
CLASS CL_METHOD_CHECK_AREA IMPLEMENTATION.
METHOD check_area.
IF length * width > 100.
r_result = abap_false.
ELSE.
r_result = abap_true.
ENDIF.
ENDMETHOD.
ENDCLASS.

Procedure
1. In the implementation part, select the entire expression that you want to add to a new method.
2. In the context menu, choose Quick Fix or use the shortcut (Ctrl 1).
3. In the Quick Fix dialog box, double-click Extract method from expression.

Results
The extracted method is created with the name new_method.
In the private section of the definition part, the name of the extracted method (new_method) is added and the appropriate parameters are declared.
In the implementation part, the selected expression is added in a new method. In the former call, the expression is replaced with the name of the extracted
method (new_method).
Example
ABAP class after extraction:
CLASS CL_METHOD_CHECK_AREA DEFINITION PUBLIC.
"This class describes the 'length * width' extraction of an expression for a new method.
PUBLIC SECTION.
DATA:
length TYPE i,
width TYPE i.
METHODS:
check_area
RETURNING
VALUE(r_result) TYPE abap_bool.
PRIVATE SECTION.
METHODS: new_method
RETURNING
VALUE(r_result) TYPE i.
ENDCLASS.
CLASS CL_METHOD_CHECK_AREA IMPLEMENTATION.
METHOD check_area.
IF new_method( ) > 100.
r_result = abap_false.
ELSE.
r_result = abap_true.
ENDIF.
ENDMETHOD.
METHOD new_method.
r_result = length * width.
ENDMETHOD.
ENDCLASS.

Related Information
Extracting Methods from Statements
Extracting Methods
Quick Assists
Literal (literal)
Quick Assist View

1.1.5.1.3 Extracting Constants

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 106 of 138

Context
In the source code editor, you have the following options for extracting constants:
Function

Description

Available since SAP


NetWeaver 7.3 EHP1

Available since SAP


NetWeaver 7.4

Extracting Constants from Literals

Creating a constant with the value of the literal and replacing all
occurrences.

SP11

SP05

Note
In SAP NetWeaver 7.4, you can only extract literals into constants
as a string type. So, if you extract constants, a warning message
that can be ignored is displayed. The reason for this is that, if you
assign a character constant, it is not clear which exact type should
be used.
Reusing Existing Constants

Replacing a literal with an existing constant. All other occurrences of


the same literals remain unchanged.

SP11

SP05

Converting Locals to Class Members

Converting a local constant, local variable, or local type to a class


member such as a member constant, attribute, or member type.

SP11

SP05

Example
Characters are indicated with the ' quotation mark: '240'
Strings are indicated with the ` quotation mark: `240`

Related Information
Extracting Methods
Extracting and Converting Variables
Moving Members
Literal (literal)
Extracting Constants from Literals
Extracting Variables from Literals
Exception Handling
Quick Assists
Quick Assist View

1.1.5.1.3.1 Extracting Constants from Literals


You can extract local and member constants, local variables, attributes, as well as importing parameters from the source code in order to substitute a literal in
all or selected methods of an ABAP class. Afterwards, the tool adds the corresponding identifier in the private or public section of the current class. So, the
new identifier is available in the entire ABAP class or in the corresponding method.

Context
Example
Before Execution
CLASS cl_car_extract_constant DEFINITION PUBLIC CREATE PUBLIC .
PUBLIC SECTION .
DATA current_speed TYPE i.
METHODS: drive IMPORTING i_speed TYPE i.
PRIVATE SECTION .
ENDCLASS.

After Execution
CLASS cl_car_extract_constant DEFINITION PUBLIC CREATE PUBLIC .
PUBLIC SECTION .
DATA current_speed TYPE i.
METHODS: drive IMPORTING i_speed TYPE i.
PRIVATE SECTION .
CONSTANTS _240 TYPE i VALUE 240.
ENDCLASS.

CLASS cl_car_extract_constant
METHOD drive.
IF i_speed > 240.
current_speed = 240.
ENDIF.
ENDMETHOD.
ENDCLASS.

CLASS cl_car_extract_constant
METHOD drive.
IF i_speed > _240.
current_speed = _240.
ENDIF.
ENDMETHOD.
ENDCLASS.

To copy the source code example, click hereCode Example Before Execution
The literal '240' is to be extracted into a member constant.

In the private section of the ABAP class, the new constant (_240) is defined as a
string type with the value of the literal ('240'). Also, all occurrences of the literal are
replaced with the new constant.

Procedure
1. In the implementation part, select the literal that is to be extracted as a member constant.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. In the Quick Fix dialog box, double-click Extract local constant or Extract member constant.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 107 of 138

Related Information
Reusing Existing Constants
Converting Locals to Class Members
Literal (literal)
Extracting Constants from Literals
Quick Assists
Quick Assist View

1.1.5.1.5.3.1 Code Example Before Execution


CLASS cl_car_extract_constant DEFINITION PUBLIC CREATE PUBLIC .
PUBLIC SECTION .
DATA current_speed TYPE i.
METHODS: drive IMPORTING i_speed TYPE i.
PRIVATE SECTION .
ENDCLASS.
CLASS cl_car_extract_constant
METHOD drive.
IF i_speed > 240.
current_speed = 240.
ENDIF.
ENDMETHOD.
ENDCLASS.

1.1.5.1.3.2 Reusing Existing Constants


You can reuse a member or local constant that has already been generated. Note that all occurrences of the same literal remain unchanged.

Prerequisites
An existing constant is already defined for the same literal in a certain ABAP class.

Context
Example
Before Execution

After Execution

CLASS cl_car DEFINITION.


PUBLIC SECTION .
METHODS: drive
IMPORTING
i_speed TYPE i.
PRIVATE SECTION .
CONSTANTS max_speed TYPE i VALUE 220.
DATA: current_speed TYPE i.
ENDCLASS.

CLASS cl_car DEFINITION.


PUBLIC SECTION .
METHODS: drive
IMPORTING
i_speed TYPE i.
PRIVATE SECTION .
CONSTANTS max_speed TYPE i VALUE 220.
DATA: current_speed TYPE i.
ENDCLASS.

CLASS cl_car IMPLEMENTATION.

CLASS cl_car IMPLEMENTATION.

METHOD drive.
IF i_speed > 220.
current_speed = 220.
ELSE.
current_speed = i_speed.
ENDIF.
ENDMETHOD.
ENDCLASS.

METHOD drive.
IF i_speed > max_speed.
current_speed = max_speed.
ELSE.
current_speed = i_speed.
ENDIF.
ENDMETHOD.
ENDCLASS.

To copy the source code example, click hereCode Example Before Execution
The literal '200' is to be replaced with an existing constant

In the source code of the ABAP class, all occurrences of the literal are replaced with
the name of the existing constant.

Procedure
1. In the source code editor, select the literal that is to be replaced by an existing constant.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. In the Quick Fix dialog box, double-click Use local constant or Use member constant.

Related Information
Extracting Constants from Literals
Converting Locals to Class Members
Literal (literal)

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 108 of 138

Extracting Constants from Literals


Quick Assists
Quick Assist View

1.1.5.1.5.3.1 Code Example Before Execution


CLASS cl_car DEFINITION.
PUBLIC SECTION .
METHODS: drive
IMPORTING
i_speed TYPE i.
PRIVATE SECTION .
CONSTANTS max_speed TYPE i VALUE 220.
DATA: current_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
IF i_speed > 220.
current_speed = 220.
ELSE.
current_speed = i_speed.
ENDIF.
ENDMETHOD.
ENDCLASS.

1.1.5.1.4 Extracting and Converting Variables


Context
In the source code editor, you have the following options for extracting variables:
Function

Description

Available since SAP


NetWeaver 7.3 EHP1

Available since SAP


NetWeaver 7.4

Extracting Local Variables from


Expressions

Assigning the selected expression to a new local variable. The


selected expression is replaced with the new local variable.

SP14

SP05

Assigning a Statement to a New Variable

Assigning the value of the selected statement to a new local variable


or attribute.

SP11

SP05

Converting Locals to Class Members

Converting a local constant, local variable, or local type to a class


member such as a member constant, attribute, or member type of the
current class.

SP11

SP05

Converting Local Variables to Parameters

In a certain method, converting an existing local variable to a new


parameter.

SP11

SP05

Declaring Variables from Usage

Creating a declaration for an attribute within a method.

SP11

SP05

Declaring Inline Variables Explicitly

In the method signature, converting an existing inline declaration of a


local variable to an explicit declaration.

SP05

Using Similar Variables

You have following options for using similar variables:

SP08

SP06

SP02

Correcting Misspelled Variables


Correcting an Interface Attribute Access
Deleting Unused Variables

Supported deletion of unused data declarations and variables.

Related Information
Extracting Methods
Extracting Constants
Moving Members
Quick Assists
Literal (literal)
Exception Handling
Extracting Variables from Literals
Quick Assist View

1.1.5.1.4.1 Extracting Local Variables from Expressions


In a method of an ABAP class, you can create a new variable on the basis of an expression. This means, the tool adds a new local variable and assigns the
expressions. Note that other occurrences of the same expression are not replaced with the new variable.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.31 SP14 and higher as well as Release 7.40 SP05 and higher.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 109 of 138

Context
Example
Before Execution

After Execution

To copy the source code example, click here Code Example Before Execution
The expression i_speed * '1.6' is to be extracted into a new local variable.

In the implementation part of the method, the new local variable (kmh) is defined.
The expression is assigned to the new local variable. In the speed statement, the
expression is replaced with the new variable.

Procedure
1. In the implementation part, select the entire expression that you want to replace with a new variable.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Extract local variable.

Related Information
Extracting and Converting Variables
Converting Locals to Class Members
Converting Local Variables to Parameters
Assigning a Statement to a New Variable
Declaring Inline Variables Explicitly
Declaring Variables from Usage
Using Similar Variables
Deleting Unused Variables
Extracting Variables from Literals
Quick Assists
Quick Assist View

1.1.5.1.5.3.1 Code Example Before Execution


CLASS cl_car DEFINITION.
PUBLIC SECTION.
METHODS: drive
IMPORTING i_speed TYPE i.
PRIVATE SECTION.
DATA: speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
speed = speed + i_speed * '1.6'.
ENDMETHOD.
ENDCLASS.

1.1.5.1.4.2 Converting Locals to Class Members


You can convert definitions of a local variable, local constant, or local type and paste them into the private section of the current class. Therefore, you can
make certain local elements of individual methods available for all methods within an ABAP class.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 110 of 138

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.31 SP11 and higher as well as Release 7.40 SP05 and higher.

Context
Note
In the following table, you can see the local elements that can be converted to the corresponding member:
Local Elements

Members

Local variables

Attributes

Local constants

Member constants

Local types

Member types

Field symbols

Cannot be converted to members

Example
Before Execution

After Execution

To copy the source code example, click here Code Example Before Execution
The speed variable is declared local variable inside the implementation of the
drive method.

The local declaration has been removed and replaced by an attribute declaration.
The attribute has been added to the private section.

Procedure
1. In the implementation part, position the cursor on the corresponding local declaration (variable, constant, or type).
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Convert 'local variable' to attribute, Convert 'local constant' to constant, or Convert 'local type' to class type.

Related Information
Extracting and Converting Variables
Extracting Local Variables from Expressions
Converting Local Variables to Parameters
Assigning a Statement to a New Variable
Declaring Inline Variables Explicitly
Declaring Variables from Usage
Using Similar Variables
Deleting Unused Variables
Extracting Variables from Literals
Quick Assists
Quick Assist View

1.1.5.1.5.3.1 Code Example Before Execution


CLASS cl_car DEFINITION.
PUBLIC SECTION.
METHODS: drive.
PRIVATE SECTION.
ENDCLASS.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 111 of 138

CLASS cl_car IMPLEMENTATION.


METHOD drive.
DATA: speed TYPE i.
...
ENDMETHOD.
ENDCLASS.

1.1.5.1.4.3 Converting Local Variables to Parameters


You can convert a local variable into a parameter create one of the following parameter types: IMPORTING, RETURNING, CHANGING, or EXPORTING.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.31 SP11 and higher as well as Release 7.40 SP05 and higher.

Context
Example
Before Execution

After Execution

To copy the source code example, click hereCode Example Before Execution
The local variable speed is declared inside the drive method.

The local declaration has been removed and the speed parameter has been added
to the signature of the drive method.

Procedure
1. In the source code editor, navigate to the method and position the cursor on the definition of the local variable.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Convert 'local variable' to [importing / changing / exporting / returning] parameter.

Related Information
Extracting and Converting Variables
Extracting Local Variables from Expressions
Converting Locals to Class Members
Assigning a Statement to a New Variable
Declaring Inline Variables Explicitly
Declaring Variables from Usage
Using Similar Variables
Deleting Unused Variables
Extracting Variables from Literals
Quick Assists
Quick Assist View

1.1.5.1.5.3.1 Code Example Before Execution


CLASS cl_car DEFINITION.
PUBLIC SECTION.
METHODS: drive.
PRIVATE SECTION.
ENDCLASS.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 112 of 138

CLASS cl_car IMPLEMENTATION.


METHOD drive.
DATA: speed TYPE i.
...
ENDMETHOD.
ENDCLASS.

1.1.5.1.4.4 Assigning a Statement to a New Variable


You can create an attribute or local variable in order to assign the result of a functional method call. A functional method provides a returning parameter.

Prerequisites
This quick assist is provided if the statement has a result.
This functionality is provided in SAP NetWeaver Release 7.31 SP11 and higher as well as Release 7.40 SP05 and higher.

Context
Example
Before Execution

After Execution

To copy the source code example, click hereCode Example Before Execution
The new variable car is to be added to replace the call of the create method

In the implementation part of the test method, the new car variable is declared.
At the cursor position, the new variable is added and assigned to the existing
statement. Now, you can, for example, change its name

Procedure
1. In the implementation part, position the cursor in front of the functional method call for which you want to create a new variable or attribute.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Assign statement to new local variable or Assign statement to new attribute.

Related Information
Extracting and Converting Variables
Extracting Local Variables from Expressions
Converting Locals to Class Members
Converting Local Variables to Parameters
Declaring Inline Variables Explicitly
Declaring Variables from Usage
Using Similar Variables
Deleting Unused Variables

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 113 of 138

Extracting Variables from Literals


Quick Assists
Quick Assist View

1.1.5.1.5.3.1 Code Example Before Execution


CLASS cl_car DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: create
RETURNING*
r_result TYPE REF TO cl_car.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD create.
CREATE OBJECT r_result.
ENDMETHOD.
ENDCLASS.
CLASS ltc_car DEFINITION.
PRIVATE SECTION.
METHODS: test FOR TESTING.
ENDCLASS.
CLASS ltc_car IMPLEMENTATION.
METHOD test.
cl_car=>create( ).
ENDMETHOD.
ENDCLASS.

1.1.5.1.4.5 Declaring Inline Variables Explicitly


In a method implementation, you can convert inline declarations of one or several local variables into explicit declarations.

Prerequisites
The local variable is declared inline using the statement addition DATA(temp).
This functionality is provided in SAP NetWeaver Release 7.40 SP05 and higher.

Context
Example
Before Execution

After Execution

To copy the source code example, click here Code Example Before Execution
The inline declaration DATA(temp) is removed and an explicit declaration is

In the corresponding method, the new local variables (temp and engine) are

inserted in the method implementation.

generated and replace the undeclared inline variable. The type (i and string) are
derived from the usage of the variable.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 114 of 138

Procedure
1. In the implementation part, position the cursor on the inline declared variable.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Declare local variable 'variable' explicitly.

Related Information
Extracting and Converting Variables
Extracting Local Variables from Expressions
Converting Locals to Class Members
Converting Local Variables to Parameters
Assigning a Statement to a New Variable
Declaring Variables from Usage
Using Similar Variables
Deleting Unused Variables
Extracting Variables from Literals
Quick Assists
Quick Assist View

1.1.5.1.5.3.1 Code Example Before Execution


CLASS cl_car DEFINITION.
PUBLIC SECTION.
METHODS: drive
IMPORTING
i_speed TYPE i.
PRIVATE SECTION.
DATA: speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
DATA(temp) = i_speed * '1.6'.
DATA(engine) = 'on'.
speed = speed + temp
ENDMETHOD.
ENDCLASS.

1.1.5.1.4.6 Declaring Variables from Usage


You can create an attribute, local variable, or a parameter (importing, returning, changing, or exporting) on the basis of a usage in a method implementation.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.31 SP11 and higher as well as 7.40 SP05 and higher.

Context
Example
Before Execution

After Execution

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 115 of 138

To copy the source code example, click here Code Example Before Execution
The variable speed is used but not yet declared.

In the signature of the drive method, the attributes (speed and engine_on) are
added and declared.

Procedure
1. In the implementation part, select the usage that you want to replace, for example, with a local variable.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Declare [importing / changing / exporting / returning] parameter from usage or Declare local variable from usage.

Related Information
Extracting and Converting Variables
Extracting Local Variables from Expressions
Converting Locals to Class Members
Converting Local Variables to Parameters
Assigning a Statement to a New Variable
Declaring Inline Variables Explicitly
Using Similar Variables
Deleting Unused Variables
Extracting Variables from Literals
Quick Assists
Quick Assist View

1.1.5.1.5.3.1 Code Example Before Execution


CLASS cl_car DEFINITION.
PUBLIC SECTION.
METHODS drive.
PRIVATE SECTION.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
speed = 50.
engine_on = abap_true.
...
ENDMETHOD.
ENDCLASS.

1.1.5.1.4.7 Using Similar Variables


You can reuse the name of a variable or interface attribute that is already defined by applying the following quick fixes:
Correcting Misspelled Variables to replace an undeclared variable with the name of a variable already defined.
Correcting an Interface Attribute Access to replace an undeclared variable with a similar constant or attribute of an implemented ABAP interface.

Related Information
Extracting and Converting Variables
Extracting Local Variables from Expressions
Converting Locals to Class Members
Converting Local Variables to Parameters
Assigning a Statement to a New Variable
Declaring Inline Variables Explicitly
Declaring Variables from Usage
Deleting Unused Variables
Extracting Variables from Literals
Quick Assists
Quick Assist View

1.1.5.1.4.7.1 Correcting Misspelled Variables


You can correct misspelled variables using a quick fix if another variable with a similar name exists.

Prerequisites
The source code contains an undeclared variable, but a variable with a similar name already exists.
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 116 of 138

Example
Before Execution

After Execution

To copy the source code example, click here Code Example Before Execution
The sped variable has been used but it is misspelled with a typo. Only the speed

The misspelled sped variable has been replaced by the existing speed attribute.

variable is defined.

Procedure
1. Position the cursor on the underlined name of the variable.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Use similar attribute 'variable'.

Related Information
Correcting an Interface Attribute Access
Using Similar Variables

1.1.5.1.5.3.1 Code Example Before Execution


CLASS cl_car DEFINITION.
PUBLIC SECTION.
METHODS drive.
PRIVATE SECTION.
DATA speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
sped = 50.
...
ENDMETHOD.
ENDCLASS.

1.1.5.1.4.7.2 Correcting an Interface Attribute Access


You want to use an attribute of an interface. But you have forgotten to use the name of the interface as a prefix, followed by ~.

Context
You have the following options for correcting an access to the interface attributes by:
Adding the Interface Name
Generating an Alias

Related Information
Correcting Misspelled Variables
Using Similar Variables

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 117 of 138

Adding the Interface Name


You can reuse existing interface members by adding the corresponding interface name and the '~' component selector.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context
Example
Before Execution

After Execution

To copy the source code example, click here


The used speed variable is not declared in the cl_car class but in the if_car

The speed variable has been replaced by if_car~speed.

interface.

Procedure
1. In the implementation part, position the cursor on the attribute that is defined in the interface.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Use similar attribute ....

Note
In this example, you can also choose Use similar parameter ... to use the importing parameter.

Code Example Before Execution


INTERFACE if_car.
DATA: speed TYPE i.
ENDINTERFACE.
CLASS cl_car DEFINITION.
PUBLIC SECTION.
INTERFACES: if_car.
METHODS: drive
IMPORTING
i_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 118 of 138

METHOD drive.
IF speed = 0.
...
ENDIF.
ENDMETHOD.
ENDCLASS.

Generating an Alias
You generate and reuse an alias from a variable that points to the ~ component selector of an interface.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context
Example
Before Execution

After Execution

To copy the source code example, click here

The used speed variable is not declared in the cl_car class but in the if_car

The name speed has been declared as alias for the if_car~speed attribute in the

interface.

public section of the cl_car class where the interface is implemented.


This alias can now be used in the implementation. This enables you to access the
defined attribute directly without the if_car~ prefix.

Note
ADT automatically uses the name of the attribute for the alias. You can rename
the alias after execution.

Procedure
1. In the implementation part, position the cursor on the attribute for which you want use an alias.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Declare alias ....

Code Example Before Execution


INTERFACE if_car.
DATA: speed TYPE i.
ENDINTERFACE
CLASS cl_car DEFINITION.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 119 of 138

CLASS cl_car DEFINITION.


PUBLIC SECTION
INTERFACES: if_car.
METHODS: drive
IMPORTING
i_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
IF speed = 0.
...
ENDIF
ENDMETHOD.
ENDCLASS.

Correcting an Interface Attribute Access


You want to use an attribute of an interface. But you have forgotten to use the name of the interface as a prefix, followed by ~.

Context
You have the following options for correcting an access to the interface attributes by:
1.1.5.1.4.7.2.1 Adding the Interface Name
Generating an Alias

Related Information
Correcting Misspelled Variables
Using Similar Variables

Adding the Interface Name


You can reuse existing interface members by adding the corresponding interface name and the '~' component selector.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context
Example
Before Execution

After Execution

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 120 of 138

To copy the source code example, click here


The used speed variable is not declared in the cl_car class but in the if_car

The speed variable has been replaced by if_car~speed.

interface.

Procedure
1. In the implementation part, position the cursor on the attribute that is defined in the interface.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Use similar attribute ....

Note
In this example, you can also choose Use similar parameter ... to use the importing parameter.

Code Example Before Execution


INTERFACE if_car.
DATA: speed TYPE i.
ENDINTERFACE.
CLASS cl_car DEFINITION.
PUBLIC SECTION.
INTERFACES: if_car.
METHODS: drive
IMPORTING
i_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
IF speed = 0.
...
ENDIF.
ENDMETHOD.
ENDCLASS.

Generating an Alias
You generate and reuse an alias from a variable that points to the ~ component selector of an interface.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context
Example
Before Execution

After Execution

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 121 of 138

To copy the source code example, click here

The used speed variable is not declared in the cl_car class but in the if_car

The name speed has been declared as alias for the if_car~speed attribute in the

interface.

public section of the cl_car class where the interface is implemented.


This alias can now be used in the implementation. This enables you to access the
defined attribute directly without the if_car~ prefix.

Note
ADT automatically uses the name of the attribute for the alias. You can rename
the alias after execution.

Procedure
1. In the implementation part, position the cursor on the attribute for which you want use an alias.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Declare alias ....

Code Example Before Execution


INTERFACE if_car.
DATA: speed TYPE i.
ENDINTERFACE
CLASS cl_car DEFINITION.
PUBLIC SECTION
INTERFACES: if_car.
METHODS: drive
IMPORTING
i_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
IF speed = 0.
...
ENDIF
ENDMETHOD.
ENDCLASS.

Correcting an Interface Attribute Access


You want to use an attribute of an interface. But you have forgotten to use the name of the interface as a prefix, followed by ~.

Context
You have the following options for correcting an access to the interface attributes by:
Adding the Interface Name

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 122 of 138

Generating an Alias

Related Information
Correcting Misspelled Variables
Using Similar Variables

Adding the Interface Name


You can reuse existing interface members by adding the corresponding interface name and the '~' component selector.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context
Example
Before Execution

After Execution

To copy the source code example, click here


The used speed variable is not declared in the cl_car class but in the if_car

The speed variable has been replaced by if_car~speed.

interface.

Procedure
1. In the implementation part, position the cursor on the attribute that is defined in the interface.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Use similar attribute ....

Note
In this example, you can also choose Use similar parameter ... to use the importing parameter.

1.1.5.1.5.3.1 Code Example Before Execution


INTERFACE if_car.
DATA: speed TYPE i.
ENDINTERFACE.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 123 of 138

CLASS cl_car DEFINITION.


PUBLIC SECTION.
INTERFACES: if_car.
METHODS: drive
IMPORTING
i_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
IF speed = 0.
...
ENDIF.
ENDMETHOD.
ENDCLASS.

Generating an Alias
You generate and reuse an alias from a variable that points to the ~ component selector of an interface.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context
Example
Before Execution

After Execution

To copy the source code example, click here

The used speed variable is not declared in the cl_car class but in the if_car

The name speed has been declared as alias for the if_car~speed attribute in the

interface.

public section of the cl_car class where the interface is implemented.


This alias can now be used in the implementation. This enables you to access the
defined attribute directly without the if_car~ prefix.

Note
ADT automatically uses the name of the attribute for the alias. You can rename
the alias after execution.

Procedure
1. In the implementation part, position the cursor on the attribute for which you want use an alias.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Declare alias ....

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 124 of 138

Code Example Before Execution


INTERFACE if_car.
DATA: speed TYPE i.
ENDINTERFACE
CLASS cl_car DEFINITION.
PUBLIC SECTION
INTERFACES: if_car.
METHODS: drive
IMPORTING
i_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
IF speed = 0.
...
ENDIF
ENDMETHOD.
ENDCLASS.

Correcting an Interface Attribute Access


You want to use an attribute of an interface. But you have forgotten to use the name of the interface as a prefix, followed by ~.

Context
You have the following options for correcting an access to the interface attributes by:
Adding the Interface Name
1.1.5.1.4.7.2.2 Generating an Alias

Related Information
Correcting Misspelled Variables
Using Similar Variables

Adding the Interface Name


You can reuse existing interface members by adding the corresponding interface name and the '~' component selector.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context
Example
Before Execution

After Execution

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 125 of 138

To copy the source code example, click here


The used speed variable is not declared in the cl_car class but in the if_car

The speed variable has been replaced by if_car~speed.

interface.

Procedure
1. In the implementation part, position the cursor on the attribute that is defined in the interface.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Use similar attribute ....

Note
In this example, you can also choose Use similar parameter ... to use the importing parameter.

Code Example Before Execution


INTERFACE if_car.
DATA: speed TYPE i.
ENDINTERFACE.
CLASS cl_car DEFINITION.
PUBLIC SECTION.
INTERFACES: if_car.
METHODS: drive
IMPORTING
i_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
IF speed = 0.
...
ENDIF.
ENDMETHOD.
ENDCLASS.

Generating an Alias
You generate and reuse an alias from a variable that points to the ~ component selector of an interface.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 126 of 138

Context
Example
Before Execution

After Execution

To copy the source code example, click here

The used speed variable is not declared in the cl_car class but in the if_car

The name speed has been declared as alias for the if_car~speed attribute in the

interface.

public section of the cl_car class where the interface is implemented.


This alias can now be used in the implementation. This enables you to access the
defined attribute directly without the if_car~ prefix.

Note
ADT automatically uses the name of the attribute for the alias. You can rename
the alias after execution.

Procedure
1. In the implementation part, position the cursor on the attribute for which you want use an alias.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Declare alias ....

Code Example Before Execution


INTERFACE if_car.
DATA: speed TYPE i.
ENDINTERFACE
CLASS cl_car DEFINITION.
PUBLIC SECTION
INTERFACES: if_car.
METHODS: drive
IMPORTING
i_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
IF speed = 0.
...
ENDIF
ENDMETHOD.
ENDCLASS.

Correcting an Interface Attribute Access


PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 127 of 138

You want to use an attribute of an interface. But you have forgotten to use the name of the interface as a prefix, followed by ~.

Context
You have the following options for correcting an access to the interface attributes by:
Adding the Interface Name
Generating an Alias

Related Information
Correcting Misspelled Variables
Using Similar Variables

Adding the Interface Name


You can reuse existing interface members by adding the corresponding interface name and the '~' component selector.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context
Example
Before Execution

After Execution

To copy the source code example, click here


The used speed variable is not declared in the cl_car class but in the if_car

The speed variable has been replaced by if_car~speed.

interface.

Procedure
1. In the implementation part, position the cursor on the attribute that is defined in the interface.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Use similar attribute ....

Note
In this example, you can also choose Use similar parameter ... to use the importing parameter.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 128 of 138

1.1.5.1.5.3.1 Code Example Before Execution


INTERFACE if_car.
DATA: speed TYPE i.
ENDINTERFACE.
CLASS cl_car DEFINITION.
PUBLIC SECTION.
INTERFACES: if_car.
METHODS: drive
IMPORTING
i_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
IF speed = 0.
...
ENDIF.
ENDMETHOD.
ENDCLASS.

Generating an Alias
You generate and reuse an alias from a variable that points to the ~ component selector of an interface.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context
Example
Before Execution

After Execution

To copy the source code example, click here

The used speed variable is not declared in the cl_car class but in the if_car

The name speed has been declared as alias for the if_car~speed attribute in the

interface.

public section of the cl_car class where the interface is implemented.


This alias can now be used in the implementation. This enables you to access the
defined attribute directly without the if_car~ prefix.

Note
ADT automatically uses the name of the attribute for the alias. You can rename
the alias after execution.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 129 of 138

Procedure
1. In the implementation part, position the cursor on the attribute for which you want use an alias.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Declare alias ....

Code Example Before Execution


INTERFACE if_car.
DATA: speed TYPE i.
ENDINTERFACE
CLASS cl_car DEFINITION.
PUBLIC SECTION
INTERFACES: if_car.
METHODS: drive
IMPORTING
i_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
IF speed = 0.
...
ENDIF
ENDMETHOD.
ENDCLASS.

1.1.5.1.4.8 Deleting Unused Variables


In a source code-based development object, you can delete unused variables in the entire object or only in marked source code. This enables you to
automatically find and delete unused variable declarations in order to clean up source code.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.31 SP06 and higher as well as Release 7.40 SP02 and higher.

Context
This function deletes the following types of unused variables:
Local variables within the scope of a method, function module, or form routine
Global variables within a class, function group, or report.

Note
In a class, no variables that are declared in the PUBLIC or PROTECTED sections are deleted. The deletion does not delete seemingly unused
variables that could be referenced from outside.

Note
Deleting an unused variable can cause another variable to become unused if it was referenced. The deletion of unused variables does not perform
recursive checks for such variables. It can therefore be useful to run the function more than once in order to find and delete unused variables in such
cases. You can undo the deletions using the shortcut Ctrl Z.
Example
Before Execution

After Execution

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 130 of 138

To copy the source code example, click here Code Example Before Execution
The cl_car class contains the name and i_speed as well as the private variables

Only the unused current_speed, delta, and max private variables have been

current_speed, delta, temp, and max public variables.

removed.

Except the temp variable, all other variables are not used.

Note
To see which unused variables have been deleted, hover the marker in the
mark bar and check the displayed tooltip.

Procedure
1. You can delete all unused variables of a source code-based development object:
1. In the source code editor, position the cursor anywhere within the source code.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply

Source

Delete Unused Variables (All)

or shortcut (Alt U).

2. You can delete all unused variables in a selected section of source code:
1. In the source code editor, select the source code in the method where you want to perform the deletion.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply

Source

Delete Unused Variables (Selection)

or shortcut (Alt Shift U).

Related Information
Extracting and Converting Variables
Extracting Local Variables from Expressions
Converting Locals to Class Members
Converting Local Variables to Parameters
Assigning a Statement to a New Variable
Declaring Inline Variables Explicitly
Declaring Variables from Usage
Using Similar Variables
Extracting Variables from Literals
Quick Assists
Quick Assist View

1.1.5.1.5.3.1 Code Example Before Execution


CLASS cl_car DEFINITION.
PUBLIC SECTION.
METHODS drive
IMPORTING i_speed TYPE i.
PRIVATE SECTION.
DATA current_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
DATA temp TYPE i.
DATA delta TYPE i.
CONSTANTS max TYPE i VALUE 220.
temp = 0.
ENDMETHOD.
ENDCLASS.

1.1.5.1.5 Moving Members


PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 131 of 138

1.1.5.1.5 Moving Members


Context
In the source code editor, you can substitute members of an ABAP class in order to perform any of the following functions:
Function

Description

Available since SAP


NetWeaver 7.3 EHP1

Available since SAP


NetWeaver 7.4

Changing Visibility of Members

Changing the visibility of a member by moving it into the public,


protected, or private section.

SP06

SP02

Converting Locals to Class Members

Converting a local constant, local variable, or local type to a class


member such as a member constant, attribute, or member type of the
current class.

SP11

SP05

Pull-up Members to Superclass

Removing member definitions from a subclass and adding them to the superclass.

SP08

Pull-up Members to Interface

Removing member definitions and adding them to the implemented


interface. Additionally, aliases are declared to avoid invalidation of
existing usages.

SP08

Note
In SAP NetWeaver 7.4, you can only extract literals into constants as a string type. So, if you extract constants, a warning message that can be ignored is
displayed. The reason for this is that, if you assign a character constant, it is not clear which exact type should be used.
Example
Characters are indicated with the 'quotation mark:'Maximum speed'
Strings are indicated with the `quotation mark:`Maximum speed`

Related Information
Extracting Methods
Extracting Constants
Extracting and Converting Variables
Exception Handling
Quick Assists
Quick Assist View

1.1.5.1.5.1 Changing Visibility of Members


In an ABAP class or ABAP interface, you can move a member definition between the public, protected, and private sections in order to switch its availability.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.31 SP06 and higher as well as Release 7.40 SP02 and higher.

Context
This refactoring option can be triggered for the following member types:
Types
Constants
Attributes
Methods
Events
Aliases

Note
Depending on the current section of the selected member, two refactoring aids are available as shown in the following table:
Current Section

Option 1

Option 2

Private

Make protected

Make public

Protected

Make private

Make public

Public

Make private

Make protected

Example
Before Execution

After Execution

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 132 of 138

To copy the source code example, click here Code Example Before Execution
The speed attribute is declared in the private section.

The declaration of the speed attribute has has been removed from the private
section and added in the public section.

Decreasing Visibility
Some refactoring aids decrease (public > protected > private > local) the visibility of members of a class.
So, if the visibility of the target section is more restrictive than in the current section, the refactoring will check whether any usages exist that will no longer be
available after the change. In this case, the developer is informed and can decide to reject or apply the change.
Increasing Visibility
Some refactoring aids increase (local > private > protected > public) the visibility of members or locals inside a class.
So, if the visibility of a member (or local) is increased, subsequent processing might depend on other declarations that are no longer visible for the member. In
this case, the developer is informed and can decide to reject or apply the change.

Procedure
1. In the definition part, position the cursor on the member you want to move to another section.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Make 'member' protected, Make 'member' public, or Make 'member' private. Note that the corresponding refactoring options for the possible
target sections will be displayed depending on the current cursor position.

Related Information
Pull-up Members to Superclass
Pull-up Members to Interface
Converting Locals to Class Members
Quick Assists
Quick Assist View

1.1.5.1.5.3.1 Code Example Before Execution


CLASS cl_car DEFINITION.
PUBLIC SECTION.
PRIVATE SECTION.
DATA: speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
...
ENDCLASS.

1.1.5.1.5.2 Pull-up Members to Superclass


You can move member definitions (for example, constants, attributes, methods, types, and events) from a subclass and to its superclass.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context
Example
Before Execution

After Execution

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 133 of 138

To copy the source code example, click here Code Example Before Execution
The cl_car class contains the speed attribute and implements the cl_vehicle

The declarion of the speed attribute has been removed from the cl_car class and

superclass.

added to the cl_vehicle superclass.


The visibility of the attribute has been changed from private to protected in order to
make it available for the cl_car subclass.

Procedure
1. In the implementation, select the member that you want to move to the protected section of the superclass.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Pull-up Attribute to Super Class.

Related Information
Changing Visibility of Members
Pull-up Members to Interface
Converting Locals to Class Members
Quick Assists
Quick Assist View

1.1.5.1.5.3.1 Code Example Before Execution


CLASS cl_vehicle DEFINITION.
ENDCLASS.
CLASS cl_vehicle IMPLEMENTATION.
ENDCLASS.
CLASS cl_car DEFINITION
INHERITING FROM cl_vehicle.
PRIVATE SECTION.
DATA: speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
ENDCLASS.

1.1.5.1.5.3 Pull-up Members to Interface


You can move member definitions from a class and add them to the implemented interface. To avoid invalidation of existing usages, aliases are declared.

Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context
Example
Before Execution

After Execution

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 134 of 138

To copy the source code example, click here Code Example Before Execution
The cl_car class contains the move method and implements the if_vehicle

The declarion of the move method has been removed from the cl_car class and

interface.

added to the if_vehicle interface.


Additionally, an alias definition has been added to the cl_car class to avoid
invalidations of existing usages.

Procedure
1. In the definition part, select the member that you want to move to the interface.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Pull-up Member with Alias.

Related Information
Changing Visibility of Members
Pull-up Members to Superclass
Pull-up Members to Interface
Converting Locals to Class Members
Quick Assists
Quick Assist View

1.1.5.1.5.3.1 Code Example Before Execution


INTERFACE if_vehicle.
ENDINTERFACE.
CLASS cl_car DEFINITION.
PUBLIC SECTION.
INTERFACES: if_vehicle.
METHODS: move.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD move.
ENDMETHOD.
ENDCLASS.

1.1.5.1.6 Exception Handling


In the source code editor, you can handle exceptions with the following functions:

RAISE EXCEPTION Statement


Function

Description

Available since SAP


NetWeaver 7.3 EHP1

Available since SAP


NetWeaver 7.4

Propagating an Exception

Adding an exception class to the signature of a method signature that


is based on an existing RAISE EXCEPTION statement.

SP11

SP05

Extracting an Exception Variable from a


RAISE Statement

Adding a variable declaration for the exception and source code to


instantiate the exception before raising it.

SP11

SP05

Related Information
Extracting Methods

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 135 of 138

Extracting Constants
Extracting and Converting Variables
Moving Members
Exception Handling
Quick Assists
Quick Assist View

1.1.5.1.6.1 Propagating an Exception


You can add an exception to the method signature based on an existing RAISE EXCEPTION statement of the method implementation.

Prerequisites
This functionality is provided for SAP NetWeaver release 7.40 SP05 / 7.31 SP11 and higher.

Context
Example
Before Execution

After Execution

To copy the source code example, click here


In the implementation of the drive method, the check_fuel method that can raise

In the signature of the drive method, the cx_no_fuel exception class is added to

an exception is called. In order to propagate the exception, you need to define it in


the public section.

the RAISING clause.

Procedure
1. In the implementation part, select the exception class that you want to define in the method signature.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Add raising declaration.

Related Information
Exception Handling
Extracting an Exception Variable from a RAISE Statement

1.1.5.1.6.2 Extracting an Exception Variable from a RAISE


Statement
You can add a variable declaration for an exception to the method signature as well as to source code in order to instantiate the exception before raising it.
This enables you to handle the result of the exception, for example, to display it in a message.

Prerequisites
This functionality is provided for SAP NetWeaver releases 7.40 SP05 / 7.31 SP11 and higher.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 136 of 138

Context
Example
Before Execution

After Execution

To copy the source code example, click here


In the implementation of the drive method, an exception with the cx_error type is In the signature of the drive method, the exc exception variable is added with
raised when the i_speed variable is less than zero.

TYPE REF TO of the selected exception class. In addition, this exception variable is
added in a CREATE statement and called in a RAISE statement. The former RAISE
EXCEPTION TYPE statement is deleted.
You can now reuse or process the value of the exception variable in order to
handle this case of an exception.

Procedure
1. In the implementation part, select the exception class where it is called in the RAISE EXCEPTION statement.
2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
3. Apply Extract Raise Variable.

Related Information
Exception Handling
Propagating an Exception

1.1.5.2 Applying ABAP Quick Fixes


Context
In the source code editor, the following ABAP Quick Fixes are provided:
Function

Description

Available since SAP


NetWeaver 7.3 EHP1

Available since SAP


NetWeaver 7.4

Creating Method Implementations from the Creating an empty method implementation from an existing
Method Definition
declaration in an ABAP class.

SP06

SP02

Creating Method Definitions from


Implementation Parts

Creating the empty method implementations of the methods that are


defined in an implemented ABAP interface and of other
unimplemented methods within an ABAP class.

SP06

SP02

Creating Implementation Parts for


Unimplemented Methods

Promoting the implementation part of methods that are defined in an


ABAP interface and method stubs of other unimplemented methods.

SP06

SP02

Creating Methods from Method Calls

Creating a method from the method call. The signature is derived from SP06
the existing method call.

SP02

Creating ABAP Classes or ABAP Interfaces Starting the creation wizard of a global ABAP class or interface directly SP06
from Usage
from the name of the missing repository object.

SP02

Creating ABAP Includes from Usage

SP05

Starting the creation wizard of an ABAP include from the name of the

SP11

missing repository object.

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 137 of 138

Creating ABAP Function Modules from


Usage

Starting the creation wizard of an ABAP function module from the


name of the missing repository object.

SP11

SP05

You have the following options for executing quick fixes:


Entry
Edit
Quick Fix
in the menu bar
Entry Quick Fix in the context menu
Entry in Quick Assist view
Shortcut Ctrl 1

Related Information
Creating Definitions and Implementations of Methods
Creating ABAP Classes or ABAP Interfaces from Usage
Creating ABAP Function Modules from Usage
Creating ABAP Includes from Usage
Refactoring ABAP Source Code
Applying Other Quick Assists
Quick Assists
Quick Assist View

PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.

Page 138 of 138

You might also like