You are on page 1of 18

CODEJAM: ABAP FOR SAP HANA

1 ABAP DEVELOPMENT TOOLS


FOR SAP NETWEAVER AS ABAP
January 2015 SAP AG

This document outlines our general product direction and should not be relied on in making a purchase decision. This
document is not subject to your license agreement or any other agreement with SAP. SAP has no obligation to pursue
any course of business outlined in this document or to develop or release any functionality mentioned in this
document. This document and SAP's strategy and possible future developments are subject to change and may be
changed by SAP at any time for any reason without notice. This document is provided without a warranty of any kind,
either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular
purpose, or non-infringement. SAP assumes no responsibility for errors or omissions in this document, except if such
damages were caused by SAP intentionally or grossly negligent.

ABAP Development Tools for SAP NetWeaver AS ABAP

Table of Contents
A. Whats inside this exercise? ...................................................................................................................... 2
B. Getting Started with the ABAP Development Tools for SAP NetWeaver ................................................... 3
C. Create a Hello World program ................................................................................................................ 9
D. Advanced Functionality ........................................................................................................................... 13
E. Conclusion .............................................................................................................................................. 16
F. ADT Shortcuts......................................................................................................................................... 17

A. Whats inside this exercise?


With the ABAP Development Tools for SAP NetWeaver (ADT) aka ABAP in Eclipse SAP provides an
Eclipse-based development environment for ABAP development. This toolset is not mandatory for standard
ABAP development such as creation or maintenance of ABAP reports or ABAP classes. However, it
becomes mandatory for ABAP for SAP HANA development, e.g. for the creation of CDS views or ABAP
managed database procedures as you will see in the corresponding CodeJam exercises later on. In such
development scenarios, the necessary features are only provided in ADT and not in the ABAP Workbench
(SE80).
Other development tools by SAP also make use of Eclipse as platform such as for example the SAP HANA
Studio or the UI Development Tools for SAPUI5 or FIORI.
In this exercise you will familiarize yourself with the ABAP Development Tools for SAP NetWeaver. The
Exercise consists of the following steps

Getting Started with the ABAP Development Tools for SAP NetWeaver

Create a Hello World program

Advanced functionality like forward navigation, cross-references, element info, and code completion.

CodeJam: ABAP for SAP HANA

ABAP Development Tools for SAP NetWeaver AS ABAP

B. Getting Started with the ABAP Development Tools for SAP NetWeaver
Explanation
1. Start the ABAP Development

Tools via the desktop shortcut


(or via the
ABAPDevelopmentTools.e
xe in your installation folder)

2. You can find several links on

the Welcome screen, e.g. to


navigate to the open the online
help for ABAP on HANA
Development Tools, etc.
Close the Welcome screen by
clicking on the Workbench icon
in the upper-right corner.

3. You are in the ABAP

perspective.
If not, open the ABAP
perspective via the Open
Perspective icon, select ABAP
in the popup window, and
continue with OK.

CodeJam: ABAP for SAP HANA

Screenshot

ABAP Development Tools for SAP NetWeaver AS ABAP

Explanation
4. You are in the ABAP

perspective now. Typically, the


first step is to create an ABAP
project, which serves as the
connection to the ABAP
backend system.
The ABAP Development Tools
uses the ABAP system
information stored in your SAP
Logon application; therefore we
start with the system
configuration in the SAP Logon
(see next step).

5. Go to the SAP Logon

application and maintain a new


system entry.
You will find the system details
in a separate document, e.g. as
a handout document or emailed
to you. Use that system
information to create the
system entry.

CodeJam: ABAP for SAP HANA

Screenshot

ABAP Development Tools for SAP NetWeaver AS ABAP

Explanation

6. In the ABAP perspective of the

ADT, you can create the ABAP


project.
Right-click in the Project
Explorer view, select New >
ABAP Project (shortcut
Ctrl+Alt+Shift+P).

7. In the New ABAP Project

dialog, use the Browse button


to select from the list of existing
systems. Depending on the
description given in the SAP
Logon, you can select the
system (double-click on the
system entry).

CodeJam: ABAP for SAP HANA

Screenshot

ABAP Development Tools for SAP NetWeaver AS ABAP

Explanation

8. The system information is filled

automatically. You can just


continue via the Next button.

CodeJam: ABAP for SAP HANA

Screenshot

ABAP Development Tools for SAP NetWeaver AS ABAP

Explanation

9. Insert the logon credentials for

ABAP user DEVELOPER##


(where ## represents your
group number) with the
password provided on the
separate document, and
proceed via the Finish button.

10. In principle you are ready to

do ABAP development now.


Its helpful to define a
favourite package containing
the training materials to
simplify the navigation. For
this purpose, expand the
ABAP project you just
created, right-click on the
Favourite Packages entry,
and click on Add a Package.

CodeJam: ABAP for SAP HANA

Screenshot

ABAP Development Tools for SAP NetWeaver AS ABAP

Explanation

Screenshot

11. You can filter for specific

packages (as depicted with


the filter TEST_A4H_102 in
the screenshot). Select your
exercise package
TEST_A4H_102_EX_## (with
your group number ##) and
continue with OK.
You may want to repeat the
steps to additionally add the
solutions package to the list of
Favourite Packages.

You have now successfully

Created an ABAP Project in the ABAP Development Tools


Customized the ABAP Project by adding Favorite Packages

Information: You are in the ABAP development perspective and if thats the first time you experience it
you certainly feel lost with the icons, toolbars, views, and tabs within the views. So its time to say a couple
of words about the purpose of all this.
A perspective is a collection of menu bars, toolbars, and views, designed to serve best for the task at hand,
which, in our scenario, is ABAP development. Therefore, the ABAP perspective gives you the views and
tools you might probably need to do ABAP development, like the project explorer, space for the editor view
(not visible yet), the outline view, the transport organizer view, etc. You can customize all these views,
enlarge and minimize them etc. This customizing is saved, so you can restart the studio with exactly the
same settings. A useful tip for you in case you feel like you screwed up the perspective in the menu bar
you can find Windows > Reset Perspective, which will reset all views of the current perspective to the
default layout.

CodeJam: ABAP for SAP HANA

ABAP Development Tools for SAP NetWeaver AS ABAP

C. Create a Hello World program


In this exercise, youll create an ABAP Hello World program ZR_HELLO_WORLD_## in your ABAP package
TEST_A4H_102_EX_## (## denoting your group number).
Explanation

1. In the ABAP perspective,

right-click on your package


A4H_102_EX_## in the
Project Explorer. Then select
New > ABAP Program in the
context menu.
Remark: The context menu
is filled with the recently
used object. If you cant find
the menu item New ABAP
Repository Object, select
New > Other ABAP
Repository Object.

2. Enter the program name and

the description. Then


continue via the Next
button.

CodeJam: ABAP for SAP HANA

Screenshot

ABAP Development Tools for SAP NetWeaver AS ABAP

Explanation

Screenshot

3. Typically the next step is to

create or select a transport


request. However, the
development done in this
exercise is performed on
package
TEST_A4H_102_EX_## and
youre informed that the
change recording is not
enabled for the package. So
you can simply proceed via
the Finish button.

4. The editor view displays the

yet-empty (except for the


REPORT statement) ABAP
report.

5. The next step is to do the

necessary ABAP coding.


The program should create
the output depicted in the
screenshot.
Hint: The username is
obtained via a class method
of CL_ABAP_SYST.
Code: ZR_HELLO_WORLD_##
REPORT zr_hello_world_00.
DATA lv_string TYPE string.
DATA lv_name TYPE sy-uname.
lv_name = cl_abap_syst=>get_user_name( ).
lv_string = |Hello { lv_name }, welcome to the ABAP on HANA CodeJam!|.
WRITE: lv_string.

CodeJam: ABAP for SAP HANA

10

ABAP Development Tools for SAP NetWeaver AS ABAP

Explanation

6. Insert the coding and activate

the program via the toolbar


icon (shortcut CTRL+F3)

7. Trigger the ABAP Pretty

Printer (shortcut Shift+F1)


If not done yet, you have to
configure the source code
formatter (aka Pretty Printer).

8. In the following popup

window, activate the


Checkbox and select your
favorite Code style.
Continue with the OK button.

CodeJam: ABAP for SAP HANA

Screenshot

11

ABAP Development Tools for SAP NetWeaver AS ABAP

Explanation

Remark: If you want to change


the ABAP Pretty Printer settings,
go in the menu bar to Windows
> Preferences. Select ABAP
Development > Editors >
Source Code Editors and
select the Formatter.

9. Run the ABAP program

ZR_HELLO_WORLD_##.
Right-click on the program in
the Project Explorer and
select Run As > ABAP
Application from the context
menu or simply use the wellknown shortcut F8.

CodeJam: ABAP for SAP HANA

Screenshot

12

ABAP Development Tools for SAP NetWeaver AS ABAP

13

D. Advanced Functionality
The following steps will help you to familiarize yourself with some advanced functionality of the ABAP
Development Tools for SAP NetWeaver. You will work with functions which you probably already know from
the ABAP development in SAP GUI.
In particular, you will be using forward navigation, cross-references, element info, and code completion.
Explanation

Screenshot

1. Enhance your ABAP

Program
ZR_HELLO_WORLD_##
(where ## is your group
number) with the code
snippet given below.

Code: ZR_HELLO_WORLD_##
REPORT zr_hello_world_00.
DATA lv_string TYPE string.
DATA lv_name TYPE sy-uname.
DATA ls_t100 TYPE t100.
lv_name = cl_abap_syst=>get_user_name( ).
lv_string = |Hello { lv_name }, welcome to the ABAP on HANA CodeJam!|.
WRITE: lv_string.
SELECT * FROM t100
INTO ls_t100
WHERE sprsl = 'E'
AND arbgb = 'S_EPM_OIA'.
WRITE: / ls_t100-text.
ENDSELECT.

CodeJam: ABAP for SAP HANA

ABAP Development Tools for SAP NetWeaver AS ABAP

Explanation

2. In the SELECT statement,

click on the table T100 and


navigate to the Data
Dictionary via the shortcut F3
(alternatively keep the CTRL
key pressed and click on the
table).
The transparent table T100 is
shown in an embedded SAP
GUI window.
Note: The fallback to use the
embedded GUI is used for the
tools not natively supported in
the ABAP Development Tools.

3. Go back to the ABAP

program and click on the


variable lv_string in the
coding. A local where-used
list is triggered and all
references are marked. Next
to the vertical scroll bar on
the right-hand side of the
editor window (not depicted
in the screenshot) you see
all references in the current
compilation unit

CodeJam: ABAP for SAP HANA

Screenshot

14

ABAP Development Tools for SAP NetWeaver AS ABAP

Explanation

4. For a global where-used list,

click on the usage of the


table T100 and use the entry
Get Where-used list from the
context menu (shortcut
CTRL+Shift+G)

5. The resulting Where-used

list is depicted in the Search


view (at the bottom of the
screen).

6. The elements of a structure

or an ABAP class can be


inspected using the element
info functionality. For this
click on the structure type
T100 and press F2.
The element info on the
structure T100,
documentation, components,
etc. are displayed in the
resulting popup window.

CodeJam: ABAP for SAP HANA

Screenshot

15

ABAP Development Tools for SAP NetWeaver AS ABAP

Explanation

16

Screenshot

7. Enhance the WRITE

statement to include the


message number. Insert
ls_t100- and trigger the
auto-completion via the
shortcut CTRL+Space.
You can select the entry
msgnr via the cursor keys;
the completion is then
triggered via the return key.
8. In addition to the completion

of a structure element, the


auto-completion can be used
to insert a full signature.
Insert the function call of
BAPI_TRANSACTION_ and
trigger the auto-completion via
CTRL+Space. Instead of
inserting only the function
name
BAPI_TRANSACTION_COMMIT,
use the shortcut
Shift+Enter to insert the
full signature.

9. As a result, the full signature

of the function call is


inserted.

E. Conclusion
You have now made your first steps with the ABAP Development Tools for SAP NetWeaver. But that has
just been a very brief scratch on the surface. In the following exercises you will intensify the usage of the
ADT and we hope youll continue once youre back in your office.
Curious? Theres even a dedicated CodeJam on the ABAP Development Tools for SAP Netweaver meet
our ADT colleagues at an event near your location!

CodeJam: ABAP for SAP HANA

ABAP Development Tools for SAP NetWeaver AS ABAP

F. ADT Shortcuts

Edit
Ctrl+Shift+A Open development object
Ctrl+F2 Check development object
Ctrl+F3 Activate development object
Ctrl+Shift+F3 Activate all inactive objects
Ctrl+Space Code completion
Ctrl+1 Quick fix proposal
Ctrl+< Add comment
Ctrl+Shift+< Remove comment
Shift+F1 Format source aka pretty printer
Help
F1 ABAP keyword documentation
F2 Show code element information
Ctrl+3 Search for commands & views
Ctrl+Shift+L List all keyboard shortcuts
Navigate

F3 Open definition
Alt+Left Backward history
Alt+Right Forward history
Ctrl+T Quick hierarchy
F4 Open Type Hierarchy
Ctrl+O Quick outline
Ctrl+Shift+G Where-used list
Run, Debug

F8 Run current ABAP object


Alt+F8 Select & run ABAP application
Ctrl+Shift+B Toggle breakpoint
F5, F6, F7, F8 Step into, over, return, resume

CodeJam: ABAP for SAP HANA

17

2013 by SAP AG. All rights reserved.


SAP and the SAP logo are registered trademarks of SAP AG in Germany and other countries. Business Objects and the Business Objects logo are trademarks or
registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company.Sybase and the Sybase logo are registered trademarks of Sybase Inc.
Sybase is an SAP company such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

You might also like