Sunteți pe pagina 1din 18

CODEJAM: ABAP FOR SAP HANA

1 – ABAP DEVELOPMENT TOOLS IN SAP


NETWEAVER AS ABAP

June 2015 – SAP SE

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.
2

Table of Contents
A. ABAP Development Tools ...................................................................................................................... 3
Introduction ............................................................................................................................................................ 3
Summary ............................................................................................................................................................... 18

ABAP for SAP HANA


3

A. ABAP Development Tools

Introduction
This exercise introduces the ABAP Development Tools (ADT) for SAP NetWeaver also known as "ABAP in
Eclipse". It is the recommended integrated development environment (IDE) for developing ABAP applications
for SAP HANA. 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).

The ABAP Development Tools provide a set of powerful tools for developing ABAP applications. The tools
(Eclipse editors and Eclipse views) are ideally positioned in the IDE to facilitate your tasks. The diagram below
shows the default layout of the ABAP perspective:

· Project Explorer View:


Provides a hierarchical view of your ABAP Projects. From here you can browse the ABAP Development
Objects in the ABAP system (similar to the Repository Browser in the Object Navigator (SE80)) and open
your ABAP Development Objects in the corresponding editor.
· Editor Area:
The editors for the ABAP Development Objects are opened in the area reserved in the center of the IDE.
· Outline View:
This view displays a structured overview of the ABAP Development Object that is currently open in the
editor area. The contents of the outline view are editor-specific.
· Feature Explorer View:
This view provides you with an interactive tutorial to help you get familiar with the basic features in ABAP in
Eclipse.
· Other Views:
Several other useful views are stacked underneath the editor area in a tabbed container. Two of the most
commonly used views are the•
o Problems View: This view displays the syntax errors, warnings or other information associated with an
ABAP Development Object (typically opened in the editor area)
o Properties View: This view displays the basic properties of the ABAP Development object that is
currently open in the editor area, e.g.: "Last changed by", "Created on", etc.

ABAP for SAP HANA


4

In this exercise you will get familiar with ADT, learning the basic concepts and interaction patterns so that you can
develop an end-to-end application from SAP HANA via ABAP to SAP Fiori.

In this exercise, you’ll


· create an ABAP Project
· create, implement, and execute an ABAP program
· get helpful information as you move along

Explanation Screenshot

1. Before starting the


Development Environment
ensure that your hosts file is
updated with the IP address
entry for your session.
You have to start notepad as
administrator in order to
change the file. For doing so,
select the notepad icon, press
the right mouse button, and
select Run as
administrator.

2. Go to directory
C:\Windows\System32\dr
ivers\etc, choose All
Files, and open the file
hosts.

3. Add a line with the IP address


for your session and the
names abapci
abapci.dummy.nodomain.
Don’t forget to save the file!

4. Now start Eclipse, your


Integrated Development
Environment (IDE).

ABAP for SAP HANA


5

5. After the first launch, you will


see the Welcome Page. Just
close it.

6. Switch to the ABAP


perspective by clicking the
Open Perspective button or
via the Menu Window à
Open perspective à
Other

7. Choose the ABAP


perspective and press OK

8. The ABAP perspective opens


and you’re welcomed by the
ABAP Feature Explorer.

The layout is as described in


the introduction of this
exercise, so you know
already, why there are so
many views in this
perspective.

ABAP for SAP HANA


6

9. Okay, let’s start with the first


step – create an ABAP
Project, the central interface
between the IDE and the
ABAP backend system.

ABAP for SAP HANA


7

10. In the New ABAP Project


dialog, choose “Define
Manually”

11. Fill in the connection


properties and continue with
Next.

ABAP for SAP HANA


8

12. You are asked to provide the


logon information for system
A4H:

· Client: 001
· User: DEVELOPER##
(## is your group number)
· Password: Welcome1

In principle, you’re project is


ready to use and you could
finalize the project creation.
Yet, it’s quite helpful to define
favorite package, therefore,
please continue with Next.

13. Add favorite packages to for


your project via the Add
button.

14. Add the ABAP packages


· TEST_A4H_EX_#
(# is your group number)
· TEST_A4H_SOLUTIONS
(containing the suggested
solutions for all exercises).

The screenshot on the right


hand side shows how to
add package
TEST_A4H_EX_# (for
group number 50).
Package
TEST_A4H_SOLUTIONS,
can be added accordingly.

ABAP for SAP HANA


9

15. You see a list of packages


that will be added as
favorites.

You may of course add any


further package.

Hint: You can of course add


favorite packages to the ABAP
project at a later point in time. To
do so, you just right-click on the
Favorite Packages in the Project
Explorer view and select Add a
Package from the context menu.

16. The ABAP Project is created


and you can see it as a new
(well, the only) entry in the
Project Explorer view.

17. Let’s customize a bit the


ABAP perspective, e.g. close
the Feature Explorer.

Hint: There’s almost no limit in


changing the layout, i.e. you can
change the view sizes, re-arrange
the layout, close views, open new
ones, move the views, etc. This
might lead to the situation, where
you feel like you messed up
everything, in this case, just use
Windows > Reset Perspective
from the menu bar to reset the
ABAP perspective to the default
layout.

18. Now, let’s explore a bit the


views in the ABAP
perspective, e.g. set the focus
to the Problems view.

ABAP for SAP HANA


10

19. Initially, there should be no


problems (hope this status
continues J).

You’ll later understand the


purpose of the Problems
view.

20. Now, let’s expand the ABAP


project in the Project Explorer
view, using the + indicators.

Besides the manually added


packages, your $TMP
package is added by default
to the list of Favorite
Packages. And you can see
that there’s already some
ABAP content in your
TEST_A4H_EX_# package.

21. Ready to create you first


ABAP program?

Just right-click on your


exercise package
TEST_A4H_EX_# to open the
context menu and select
New > ABAP Program.

Remark: The context menu is


filled with the recently used
object. If you can’t find the
menu item New ABAP
Repository Object, select New
> Other ABAP Repository
Object.

ABAP for SAP HANA


11

22. A creation wizard opens. The


project and package are
automatically included. So,
you only have to provide
name and description for the
ABAP program:
· Name:
ZR_HELLO_WORLD_#
(with group number #)
· Description:
Valid description like “ADT
Exercise”

Continue with Next

23. 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_EX_## and
you’re informed that the
change recording is not
enabled for the package.
So you can simply proceed
via the Finish button.

24. The ABAP program is created


and opened in the editor area,
ready for you to implement.

25. 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.

ABAP for SAP HANA


12

26. You can copy the necessary


source code from our Code
Snippet App. To start the
Coding App press the Run
ABAP Application icon
use Alt+F8.

27. Enter ZA4H_CODING into the


search field, select the
Transaction entry and press
OK

28. The Code Snippet App starts


in a browser window. You can
use it to copy Code from the
solutions into your editor.

29. Enter the code into the editor


area and replace the ## with
your group number.

ABAP for SAP HANA


13

30. Trigger the ABAP Pretty


Printer (shortcut Shift+F1)

If not done yet, you have to


configure the source code
formatter (aka Pretty Printer).

31. In the following popup


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

32. 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.

ABAP for SAP HANA


14

33. Save (Ctrl+S) and activate


(Ctrl+F3) the program.

34. Ready to execute the


program?

You can either use the


cumbersome way via
Run > Run As > ABAP
Application or just use the
well-known ABAP
shortcut F8.

35. An embedded SAPGUI opens


and the result is displayed as
depicted in the screenshot.

ABAP for SAP HANA


15

36. Let’s explore some more


features of the ABAP
Development Tools.

Go back to the ABAP


program (shortcut
ALT+Left), and enhance the
program with the code from
the code snippet app step 2.

37. 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

38. 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

ABAP for SAP HANA


16

39. 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)

40. The resulting Where-used list


is depicted in the Search view
(at the bottom of the screen).

41. 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.

42. 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;

ABAP for SAP HANA


17

the completion is then


triggered via the return key.

43. In addition to the completion


of a structure element, the
auto-completion can be used
to insert a full signature.

Insert the call of a method of


cl_system_uuid and
trigger the auto-completion
via CTRL+Space. Instead of
inserting only the function
name
convert_uuid_c32_stati
c, use the shortcut
Shift+Enter to insert the
full signature.

44. As a result, the full signature


of the method call is inserted.

45. Two more hints:

· If you would like to reset


the layout of your ABAP
perspective, just use
Windows > Reset
Perspective.

· More help can be found in


Help > Help Contents

ABAP for SAP HANA


18

Summary
Congratulations, you finished the ABAP Development Tools exercise. You launched the “ABAP in Eclipse”
and created an ABAP Project. You even created an ABAP program.

This first exercise seems very tool-driven and you might ask: Is it mandatory in the context of ABAP
Development for SAP HANA? The answer is yes! You might have heard before (or will learn as we move
along), the ABAP Development Tools are mandatory for creating and maintaining ABAP artefacts like Core
Data Services (CDS) Views or ABAP Managed Database Procedures (AMDP) as you will see in the
following exercises.

ABAP for SAP HANA

S-ar putea să vă placă și