ABAP - Fundamental Tasks and Tools
ABAP - Fundamental Tasks and Tools
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
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Page 3 of 138
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Page 4 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
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
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
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
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.
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
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
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
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...
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Page 8 of 138
2.
3.
4.
5.
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
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
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
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
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
Page 11 of 138
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
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
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
Related Information
ABAP Projects
System Library
Adding or Removing a Favorite Package
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
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
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
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
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Page 14 of 138
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.
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.
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
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
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
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.
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
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
: SAP SUPPORT PORTAL > Keys & Requests > SCCR Keys > Registration
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
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
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.
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
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
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.
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
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
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
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.
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
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
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
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
Prefix
Suffix
Usage
Top include
TOP
DNN
Optional include
D..*
Include
UXX
U01-99
T99
P..*
PNN
Optional include
F..*
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
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
Procedure
1.
2.
3.
4.
5.
6.
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
Page 26 of 138
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
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
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
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.
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
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.
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
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
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.
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
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
Procedure
1. In the private section of the ABAP exception class, type textID and open the code completion window.
Sample Code
2.
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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:
The following enhancement popup is displayed if several enhancement implementations enhance an enhancement option:
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
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.
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
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
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
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Page 41 of 138
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
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
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.
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
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
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
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
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
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
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.
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.
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.
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
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
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.
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.
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.
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
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
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.
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.
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.
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
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
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.
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.
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.
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
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
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
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)
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.
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
Procedure
1. In the menu bar, choose
Search
Search...
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
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
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
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
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
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
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.
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
Code Completion
Typing
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 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.
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
Prerequisites
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Page 57 of 138
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
->
=>
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
Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.
Editors
Code Completion
Typing
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.
Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.
ABAP Development
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.
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
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
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.
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
Code Completion
Typing
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
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.
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
Prerequisites
To use this function, open the
Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.
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
->
=>
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
Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.
Editors
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Code Completion
Typing
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.
Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.
ABAP Development
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 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.
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
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.
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
Code Completion
Typing
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.
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 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
Prerequisites
To use this function, open the
Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.
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
->
=>
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
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
Code Completion
Typing
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.
Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.
ABAP Development
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
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
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.
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
Code Completion
Typing
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.
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
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
Prerequisites
To use this function, open the
Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.
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
->
=>
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
Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.
Editors
Code Completion
Typing
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.
Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.
ABAP Development
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.
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
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.
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
Code Completion
Typing
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.
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.
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
Prerequisites
To use this function, open the
Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.
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
->
=>
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Page 74 of 138
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
Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.
Editors
Code Completion
Typing
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.
Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.
ABAP Development
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.
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
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
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
Code Completion
Typing
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.
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
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.
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
Prerequisites
To use this function, open the
Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.
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
->
=>
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Page 78 of 138
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
Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.
Editors
Code Completion
Typing
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.
Prerequisites
To overwrite the keyword or identifier at the current position, choose the
Content Assist
Completion overwrites
preference in advance.
ABAP Development
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.
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
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.
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
Code Completion
Typing
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.
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.
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
Prerequisites
To use this function, open the
Window
Preferences
ABAP Development
Editors
and select the
Typing
Automatic code completion after typing -,~,->,=>
option.
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
Displayed Proposals
Fields of structures
Components of interfaces
->
=>
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
Prerequisites
To use this function, open the
ABAP Development
Always insert full signature on completion option.
Editors
Code Completion
Typing
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.
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
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.
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
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
Related Information
ABAP Development Objects
Adding Code Templates to an ABAP Exception Class
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
Code Completion
Related Information
ABAP Development Objects
Source
Format Block
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
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
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
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
Related Information
ABAP Element Info View
ABAP Doc
Editing ABAP Doc Comments
Editing ABAP Comments
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
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.
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.
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
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
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
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>...</strong>
Unsorted lists
<ul><li>...</li></ul>
Sorted lists
<ol><li>...</li></ol>
Headers
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 " , ' , < , > , and @ .
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
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
Note
You can also use the following shortcuts:
Shortcut
Function
Description
Ctrl + <
Add Comment
Ctrl + >
Remove Comment
Ctrl + 7
Toggle Comment
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
Related Information
ABAP Element Info View
ABAP Projects
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
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
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
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.
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
Page 93 of 138
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.
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
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Page 94 of 138
ABAP Development
Occurrences in File
or
Mark Occurrences
Related Information
ABAP Development Objects
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.
Description
Navigate to Declaration
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
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
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.
Related Information
ABAP Type Hierarchy View
Using Quick Views
Viewing the Outline
Getting Orientation in the Source Code Using Breadcrumbs
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
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
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
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.
Related Information
Quick Type Hierarchy
Using Quick Views
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.
Related Information
Quick Outline
Using Quick Views
Figure 1: Dialog that appears when version conflict has been detected
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
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
Related Information
Refactoring ABAP Source Code
Applying ABAP Quick Fixes
Applying Other Quick Assists
Quick Assists
Quick Assist View
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
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
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
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
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
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.
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.
4. The Rename function shows you the changes that will be made. Use the navigation buttons to step through the changes.
Results
The wizard renames the selected element and updates the references.
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Note
You can undo the renaming by choosing
Related Information
Renaming Identifiers
Renaming Elements in a Single Source Unit
Description
SP02
SP05
SP11
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
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.
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.
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.
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
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.
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
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Context
In the source code editor, you have the following options for extracting constants:
Function
Description
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
SP11
SP05
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
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.
Related Information
Reusing Existing Constants
Converting Locals to Class Members
Literal (literal)
Extracting Constants from Literals
Quick Assists
Quick Assist View
Prerequisites
An existing constant is already defined for the same literal in a certain ABAP class.
Context
Example
Before Execution
After Execution
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.
Description
SP14
SP05
SP11
SP05
SP11
SP05
SP11
SP05
SP11
SP05
SP05
SP08
SP06
SP02
Related Information
Extracting Methods
Extracting Constants
Moving Members
Quick Assists
Literal (literal)
Exception Handling
Extracting Variables from Literals
Quick Assist View
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.
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
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
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
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
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
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
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
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.
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
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.
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
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.
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
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
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.
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
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.
Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.
Context
Example
Before Execution
After Execution
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.
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
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.
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.
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
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.
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.
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.
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.
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 ....
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.
Generating an Alias
Related Information
Correcting Misspelled Variables
Using Similar Variables
Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.
Context
Example
Before Execution
After Execution
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.
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
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.
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.
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
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.
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.
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.
Context
Example
Before Execution
After Execution
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.
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 ....
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
Prerequisites
This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.
Context
Example
Before Execution
After Execution
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.
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
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.
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.
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 ....
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.
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
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
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
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
Description
SP06
SP02
SP11
SP05
Removing member definitions from a subclass and adding them to the superclass.
SP08
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
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.
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
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.
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.
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
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.
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.
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
Description
Propagating an Exception
SP11
SP05
SP11
SP05
Related Information
Extracting Methods
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
Extracting Constants
Extracting and Converting Variables
Moving Members
Exception Handling
Quick Assists
Quick Assist View
Prerequisites
This functionality is provided for SAP NetWeaver release 7.40 SP05 / 7.31 SP11 and higher.
Context
Example
Before Execution
After Execution
In the signature of the drive method, the cx_no_fuel exception class is added to
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
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.
Context
Example
Before Execution
After Execution
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
Description
Creating Method Implementations from the Creating an empty method implementation from an existing
Method Definition
declaration in an ABAP class.
SP06
SP02
SP06
SP02
SP06
SP02
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
SP05
Starting the creation wizard of an ABAP include from the name of the
SP11
PUBLIC
2014 SAP SE or an SAP affiliate company. All rights reserved.
SP11
SP05
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.