ABAP Development Cycle in Eclipse
ABAP Development Cycle in Eclipse
Eclipse
Table of Contents
Table of Contents 2
Learning Assessment 25
2
Overview
In the creation Repository Objects part, you will learn how to create
repository objects and perform basic editor tasks.
● ABAP programs
● ABAP dictionary objects, such as database table definitions and data types
3
● Screens
● Web Dynpro components(Dynpro: is the SAP standard UI technology for
developing Web applications in the ABAP environment)
● Function groups and function modules
● ABAP classes and interfaces
Different tools are available for creating, editing and displaying ABAP
Repository Objects in ADT. Some of these tools are native to Eclipse but some
objects must be displayed and edited in the SAP GUI.
The keyboard commands used to perform these basic functions are exactly
the same as those of the SAP GUI-based editors (CTRL + F2 for syntax check,
4
and CTRL + F3 for activation). However, the buttons have slightly different
icons.
Create a Program
Business Example: You are a programmer for an SAP customer and work
with the new ABAP Development Tools. You want to create an ABAP program
in Eclipse, then activate it and run it as an ABAP application.
5
Solution
Use the WRITE statement to display the text 'This is my first program' and
save the program.
b) In the New ABAP Program dialog box, ensure that your own project
appears in the Project field. If it does not, choose Browse and select your
project.
f) Choose Next.
6
2. Activate the new program.
a) In the Project Explorer view, from the program's context menu choose
Activate (or press Ctrl + F3 - the same key combination used in the
traditional ABAP Editor).
a) In the Project Explorer view, from the program's context menu choose
Run As → 1 ABAP Application(or press F8 - the same key used in the
traditional ABAP Editor).
Eclipse and SAP GUI Editors
ABAP Development Tools integrates two different types of tools for ABAP
development - Eclipse-based tools and SAP GUI-based tools.
The SAP GUI is installed locally together with the Eclipse-based client. SAP
GUI-based tools represent, in the broadest sense, the tools and utilities of
the traditional ABAP Workbench. Typical examples are the Package
Builder, parts of the ABAP Dictionary, and the utilities for maintaining text
elements for ABAP programs.
When you try to open a development object in the Project Explorer view,
an Eclipse-based editor will open if one is available. If not, a SAP-GUI based
tool will open in the editor area. Any additional objects that require a SAP
GUI-based tool open in separate tabs in the editor area.
7
With GUI-based tools, you have complete access to the functionality of the
traditional ABAP Workbench. You can, for example, start any applications
you need by entering a transaction code or OK code.
You may occasionally want to start the SAP GUI independently of the
selection of any development object – for example, you may want to
change user settings. To do so choose Ctrl + 6 or choose the Open SAP GUI
button on the Workbench toolbar . Select the relevant ABAP project and
choose OK. The SAP GUI will be launched in the editor area of the ABAP
Perspective.
Transport
Development projects are carried out in a development system. Upon
completion, the development objects associated with that project must be
transported to other systems for testing or to the production system. This
happens via a change request. Change requests are often referred to as
transport requests.
8
Change requests are created by the project manager at the start of the
development process. Each developer working on the project is assigned a
‘task’ in the change request.
The Transport Organizer view in ABAP Development Tools offers the basic
transport functionality of the SAP GUI- based Transport Organizer. You
can use it to perform the following functions:
● View the transport requests, tasks, and object lists of any user.
9
Create a Package
Business Example: You are a programmer for an SAP customer and work
with the new ABAP Development Tools. Your current task is to create a
new ABAP package.
Solution
b) In the New window, expand the ABAP node and choose ABAP
Repository Object.
c) Choose Next.
d) In the Project field of the New ABAP Repository Object window, enter
the name of your project.
f) Choose Next.
g) In the Object name field, enter the package name ZBC404_##, then
choose Finish.
h) In the Create Package window, enter the short description in the Short
Description field. Note that this field has a tick, meaning its completion is
mandatory.
10
i) Ensure that the appropriate values are entered in the Application
Component and Software Component fields — CA and HOME, respectively.
j) Choose Continue.
ADT's keyword completion feature allows you to reduce the time spent on
pure code editing by proposing valid ABAP keywords and identifiers that may
be inserted at any given position within the source code. To use keyword
completion, you simply begin typing the first few characters of a keyword or
identifier - suggestions appear automatically.
If the initial suggestion is correct, simply choose the TAB key to accept it. To
see more options, choose Ctrl + Space, and then choose the desired ABAP
keyword or identifier from the list of suggested entries. Note that keyword
completion can be turned off in Preferences but it is enabled by default.
11
Code Completion
The keyboard shortcut Ctrl + Space is not used solely for keyword
completion. You can also use it to access code completion suggestions for
the following:
● Function modules
● Class names
When you choose Ctrl + Space, a full list of objects matching what you have
already typed appears. As you continue to type, the list is narrowed down. To
insert the name of a variable, function module, or method into your code,
select the entry and choose Enter or double-click the name. For function
modules and methods, you will often want to insert not just the name but
also the full interface or signature. To do this, highlight the function module
or method and choose Shift + Enter.
12
Write a Program Using Keyword and Code
Completion
Business Example
You are a programmer for an SAP customer and work with the new ABAP
Development Tools. You want to create a program using keyword and code
completion.
2. Declare a standard internal table with line type sflight. Remember that as
ABAP keywords are suggested, you can insert them by pressing the Tab key.
3. Fill the internal table with data from table sflight. Use the array fetch
technique (SELECT ... INTO TABLE).
4. Use the ALV object model to display the data. Declare a reference variable
with TYPE REF TO cl_salv_table.
6. Use code completion to find the appropriate method to display the data on
the screen.
Solution
13
1. In the ABAP package ZBC404_##, where ## is the user name assigned to
you by your instructor, create an ABAP program called
ZBC404_##_CODE_COMPLETION. Give it the description Code completion
program and use the transport request created by your instructor.
b) In the New ABAP Program dialog box, ensure that your own project
appears in the Project field. If it does not, choose Browse and select your
project.
f) Choose Next.
2. Declare a standard internal table with line type sflight. Remember that as
ABAP keywords are suggested, you can insert them by pressing the Tab key.
3. Fill the internal table with data from table sflight. Use the array fetch
technique (SELECT ... INTO TABLE).
14
4. Use the ALV object model to display the data. Declare a reference variable
with TYPE REF TO cl_salv_table.
6. Use code completion to find the appropriate method to display the data on
the screen.
a) Enter go_alv-> then press Ctrl + Space. Place the cursor on display, then
choose Shift + Enter.
15
The Debug Perspective
ABAP Development Tools includes a native debugger.
Note: ADT's native debugger is only available if your AS ABAP system has SAP
Kernel 7.21 or higher. If you do not have this release, you have to use the
GUI-based debugger.
● Breakpoints
16
● Display the attributes of an exception object
● Direct editing in the debugger This last feature - the ability to correct a
mistake as soon as you find it - is very useful and is not available in the SAP
GUI-based debugger. Other features are available in the SAP GUI debugger
but not the ADT debugger. Some are available in both.
17
Table 1: Debugger Feature Availability
When ABAP encounters an active breakpoint, ADT switches from the ABAP
perspective to the Debug perspective. The first time this happens, you will be
asked to confirm the change. When you do, you can also tell ADT to switch
automatically in future.
● The navigation toolbar of the Debug view lets you control execution in the
debugger, stepping through your code, resuming or canceling execution.
18
● The Debug view also shows you the active call stack. You can click on
entries in the call stack to open the code at that level of the stack. You can
then inspect active variables, set breakpoints, or edit your code.
● The editor view shows the code you are debugging. You can follow
debugger execution in the code, show the values of variables by hovering
with the cursor over them, and open them in the Variables view by clicking on
them. You can correct mistakes in your coding directly in the editor; there's
no need to switch to the ABAP perspective to edit your code.
● The ABAP Internal Table view opens at the bottom of the Debug
perspective. Double clicking on an internal table opens the table not only in
the Variables view but also in the
ABAP Internal Table view. You can also type an internal table name directly
into the view or find a table in the code that you are debugging. You can view
and edit the rows of the table, rearrange table columns for better display
using drag-and-drop, and so on.
Debugger Settings
You can change how the ABAP debugger behaves using the General Settings
(choose Window → Preferences and then choose Debug under the ABAP
19
Development node). The choices you make here apply to all of your ABAP
projects. The options are presented in the following table:
20
Jump to Raised Exception Location
When an exception occurs during a step in the ABAP debugger, you are
notified by the display of a red '!' exclamation point in the left hand gutter of
the editor window.
You can use the context menu of the line where the exception has been
raised to access the Go to Exception Raise Location and Show Exception
Variable functions. To return to the CATCH statement, use the keyboard
shortcut Alt + Left Arrow.
21
1. To jump to a raised exception, choose the context menu of the line
marked with a red exclamation mark in the source code and choose Go to
Exception Raise Location.
2. To display the attributes of the exception object, choose the context menu
of the line marked with a red exclamation mark in the source code and
choose Show Exception Variable.
Debug a Program
Business Example
You are a programmer for an SAP customer and work with the new ABAP
Development Tools. You have been asked to debug an ABAP program.
What are the five views that are immediately visible in the Debug
perspective?
4. Check that the fields on the selection screen have been populated and
execute the program, at which point the Debug perspective opens.
22
6. When the program stops again, return to the Debug perspective and enter
the name of the target structure of the SELECT statement in the Variables
view. Expand the display to show all components of the structure and
execute the next single step to ensure that the structure is filled.
7. Continue running the program until you reach the statement SELECT
bookid customid class loccuram loccurkey forcuram forcurkey FROM sbook …
Then use the ABAP Internal Table (Debugger)view to display the internal
table.
8. How many columns does the Table view contain? Choose the correct
answer.
A3
B5
C7
D9
10. Resume the program. As soon as you reach a SELECT statement that is
not part of a program, class, or function module beginning with BC404 or
CL_BC404, disable the statement breakpoint. Terminate the debugger and
return to the ABAP perspective.
11. Delete the breakpoint in the INITIALIZATION event, set a new breakpoint
on the CREATE OBJECT statement in the AT SELECTION-SCREEN event, and
run the program.
23
12. On the selection screen, enter invalid data. Execute the CREATE OBJECT
statement and go to the raised exception.
What is the name of the class in which the exception was raised?
13. Switch to the SAP GUI window containing the selection screen and verify
that the application has behaved correctly.
Solution
c) Choose the only transport request that is available to you and choose
Finish. The duplicate program ZBC404_##_FLIGHT_APP opens in Eclipse.
a) Choose Activate.
What are the five views that are immediately visible in the Debug
perspective? Debug, Variables, Source Code, Outline, and Console.
24
a) Choose the context menu in the left margin next to the first statement of
the INITIALIZATION event (line 16) and choose Toggle Breakpoint.
b) To run the program, choose F8. The program will stop at the breakpoint
and the Debug perspective will open.
4. Check that the fields on the selection screen have been populated and
execute the program, at which point the Debug perspective opens.
6. When the program stops again, return to the Debug perspective and enter
the name of the target structure of the SELECT statement in the Variables
view. Expand the display to show all components of the structure and
execute the next single step to ensure that the structure is filled.
a) When the program stops running, choose the Debug perspective, then
choose the Variables view.
25
b) Select the field.
c) Enter the name of the target structure of the SELECT statement, ls_flight.
e) Choose F5 to execute the next single step to ensure that the structure is
filled.
7. Continue running the program until you reach the statement SELECT
bookid customid class loccuram loccurkey forcuram forcurkey FROM sbook …
Then use the ABAP Internal Table (Debugger)view to display the internal
table.
8. How many columns does the Table view contain? Choose the correct
answer.
A3
B5
C7
D9
26
How many records were selected?
a) Choose F5
10. Resume the program. As soon as you reach a SELECT statement that is
not part of a program, class, or function module beginning with BC404 or
CL_BC404, disable the statement breakpoint. Terminate the debugger and
return to the ABAP perspective.
b) When you reach the appropriate SELECT statement, position the cursor on
the breakpoint definition in the Breakpoints view and choose Alt+Enter.
c) In the properties dialog, deselect the Enabled checkbox, then choose Enter.
11. Delete the breakpoint in the INITIALIZATION event, set a new breakpoint
on the CREATE OBJECT statement in the AT SELECTION-SCREEN event, and
run the program.
b) Choose the context menu in the margin by the CREATE OBJECT statement
in the AT SELECTION-SCREEN event (line 25) and choose Toggle Breakpoint.
27
c) To run the program, choose F8.
12. On the selection screen, enter invalid data. Execute the CREATE OBJECT
statement and go to the raised exception.
What is the name of the class in which the exception was raised?
➔ CL_BC404_FLIGHT_3.
a) Enter invalid data, such as LH in the PA_CAR field and 999 in the PA_CON
field.
c) Choose the context menu of the exclamation mark next to the CATCH
statement and choose Go To Exception Raise Location.
13. Switch to the SAP GUI window containing the selection screen and verify
that the application has behaved correctly. Then terminate the debugging
session.
a) Choose the SAP GUI view. The selection screen should still be displayed
with the message 'Flight Does Not Exist' in the status bar.
28
Learning Assessment
29