Contenu connexe
Similaire à ABAPCodeRetreat 23.7.2016 - Abap in Eclipse (20)
ABAPCodeRetreat 23.7.2016 - Abap in Eclipse
- 1. © Kaufland 2016 |
ABAP CODERETREAT WEINSBERG
ABAP in Eclipse
KIS, Weinsberg, 23.07.2016
ABAP CodeRetreat Weinsberg121.07.2016
- 2. © Kaufland 2016 |
WHO WE ARE
KAUFLAND
We are more than just a successful international trading company:
We are a company where many colleagues become a team, jobs
are safe workplaces and real satisfaction
Diversity and stability
We offer a wide range of jobs with many different entry-levels and
career opportunities. Our company is continuously growing, that
makes us self-confident
Openness and friendly cooperation
We support a cooperation based on friendliness and mutual trust
ABAP CodeRetreat Weinsberg221.07.2016
- 3. © Kaufland 2016 |
WHERE WE ARE
KAUFLAND
Expansive growth, economic size
• We are successfully expanding in Germany, Poland, Czech
Republic, Slovakia, Croatia, Romania and Bulgaria
• Over 150,500 employees form our strong Kaufland team in
Europe
International cooperation and prospects
• We offer an international work environment
• We provide a wide variety of tasks in collaboration with our
international colleagues
• According to the area of deployment you will have the
opportunity to collect experience abroad, in one of our
European locations
ABAP CodeRetreat Weinsberg321.07.2016
- 4. © Kaufland 2016 | ABAP CodeRetreat Weinsberg4
KAUFLAND INFORMATION SYSTEMS
We are the IT service provider for Kaufland. Ensuring high
business performance and carrying data streams on the right track
is our daily responsibility
Keep IT simple and safe
Our objectives are to comprehensively advice our business
departments in designing their business processes and to
implement software solutions
OUR IT IN FIGURES
21.07.2016
220
SAP
Systems
40
SAP
Developers
25k Z Reports
- 5. © Kaufland 2016 |
• Eclipse started as a proprietary IBM product (IBM Visual age for Smalltalk/Java)
• Embracing the open source model IBM opened the product up
• Open Source
• It is a general purpose open platform that facilitates and encourages the development of third party
plug-ins
• Best known as an Integrated Development Environment (IDE)
• Provides tools for coding, building, running and debugging applications
• Originally designed for Java, now supports many other languages
• Good support for C, C++
• Python, PHP, Ruby, etc...
• And ABAP
• Eclipse is the strategic future ABAP Development Tool from SAP
ABAP CodeRetreat Weinsberg5
WHAT IS ECLIPSE?
21.07.2016
- 6. © Kaufland 2016 | ABAP CodeRetreat Weinsberg6
ECLIPSE IDE COMPONENTS
21.07.2016
Perspective Switch
We can switch between
several perspectives here
Editor View
This is where we edit
our source code
Menubars
Full drop down menus
plus quick access to
common functions
Project Explorer
View
This is where our projects
/ objects are listed
Windows (Views)
The windows (views) are
not firmly set but can be
arranged however you
prefer on the screen !
- 7. © Kaufland 2016 | ABAP CodeRetreat Weinsberg7
CREATING A NEW PROJECT
21.07.2016
• All code in Eclipse needs to live under a project
• To create a project: File -> New -> ABAP Project
• A new System Connection window will open, choose the SAP system in which you want to develop ABAP Objects
Hit NEXT button to enter SAP system credentials
- 8. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
CREATING A NEW PROJECT
21.07.2016
• click FINISH to create ABAP Project
Enter SAP system credentials
- 9. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
CREATING A CLASS
21.07.2016 9
We are saving the class as a $TMP package
so a transport request is not required
To create a new global class , choose any package under the ABAP project.
Right click on the package -> NEW -> ABAP Class
- 10. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
CREATING A METHOD
21.07.2016 10
Write the definition of method -> Ctrl +1 on the method name
- 11. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
CREATING A PROGRAM
21.07.2016 11
To create a ABAP program, choose any package under the ABAP project.
Right click on the package -> NEW -> ABAP program
We are saving the program as a $TMP package
so a transport request is not required
- 12. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
RUNNING CODE
21.07.2016 12
An easy way to run code is to right click on the program and select
Run As -> ABAP Application (F8)
- 13. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
RUNNING CODE
21.07.2016 13
The output of running code can be seen in a new SAP GUI editor window
- 14. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
RUNNING CODE
21.07.2016 14
Running a single method -> mark a method and F8
- 15. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
RUNNING CODE
21.07.2016 15
Enter the Import Parameters and execute the method
- 16. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
RE-RUNNING CODE
21.07.2016 16
After you run the code for the first time, you can re-run it just by selecting it from the RUN drop down menu
- 17. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
DEBUGGING CODE
21.07.2016 17
• Eclipse comes with a pretty good built-in debugger
• You can set break points in your code by double clicking in the left hand margin
break points are
represented by
these blue bubbles
- 18. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
DEBUGGING CODE
21.07.2016 18
• The first time you try to debug code you will be presented with the following dialog
• Eclipse is asking if you want to switch to a perspective that is more suited for debugging, click yes
• Eclipse has many perspectives based on what you are doing (by default we get the ABAP perspective)
- 19. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
DEBUG PERSPECTIVE
21.07.2016 19
This view shows the
current line of code
we broke on
It‘s possibe to change
the code during the
debugging !
List of breakpoints
These buttons allow you to
step through the code
Variables in scope are listed
here along with their current
values – by right clicking you
can change values of variables
as your program is running
Note new Debug
perspective – click
ABAP to return to
normal
- 20. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
CONTENT ASSIST
21.07.2016 20
Content assist is a functionality in Eclipse which allows the developer
to get context-sensitive code completion in an editor upon user request.
It can be invoked by pressing Ctrl+Space.
...
- 21. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
QUICK FIX
21.07.2016 21
Quick Fix can be used to make typing much faster
and to quickly generate code ...
press Ctrl+1 on class
Press Ctrl+1 on method
Press Ctrl+1 on parameter
Press Ctrl+1 on variable
- 22. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
REFACTORING
21.07.2016 22
Renaming a class / method that is used widely throughout a project could take a lot of time and is error-prone. But the Eclipse
refactoring wizard makes the job easier by automatically detecting all dependencies on the class / method beeing renamed and
modifying them also in the same time.
The refactoring menu can be opened by Ctrl+1
click Finish to perform the refactoring
- 23. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
REFACTORING
21.07.2016 23
Result of renaming class ZCL_ACR_01 -> ZCL_ACR_02
- 24. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
REFACTORING
21.07.2016 24
Refactoring a method (Ctrl+1)
Refactoring a field (Ctrl+1)
Refactoring a parameter of a method (Ctrl+1) ... and so on
- 25. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
REFACTORING
21.07.2016 25
Rename in source unit (Ctrl+1)
... while renaming the field the
dependencies in the source
code will be automatically
changed
- 26. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
HISTORY
21.07.2016 26
Right click on source code – Compare With – Local History / Revision History…
Revision History Local History
- 27. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
HISTORY
21.07.2016 27
Mark 2 versions and right click – Compare with Each Other
A new editor window opens with the
comparison of both versions.
This compare works also between projects
(SAP systems).
- 28. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
ABAP ELEMENT INFO
21.07.2016 28
Press F2 on any element ...
- 29. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
ABAP DOC
21.07.2016 29
• With ABAP Doc you can write your
documentation directly within your
source code using special comments
in front of a declarative statement
• This means you can document globally
available elements (like classes,
interfaces and their method and
attribute) but also local elements (like
local variables and field-symbols)
- 30. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
ABAP KEYWORDS COLORS
21.07.2016 30
Click Windows -> Preferences ...
- 31. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
TRANSPORT ORGANIZER
21.07.2016 31
With the transport organizer you can edit transports (Release, Change Owner)
- 32. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
SHORT CUTS
21.07.2016 32
Hit Ctrl + Shift + L to open
the Short cut list
Hit Ctrl + Shift + L again to edit or create Short cuts
- 33. © Kaufland 2016 | ABAP CodeRetreat Weinsberg
SHORT CUTS
21.07.2016 33
F2 Code Information Ctrl + L Goto Line
F3 Navigate to Ctrl + M Maximize Active View or Editor
F5 Refresh Ctrl + O Quic Outline
Alt + U Delete unused variables (all) Ctrl + Q Last Edit Location
Alt + F2 Show method Information Ctrl + T Quick Type Hierarchie
Alt + F8 Run an ABAP development object Ctrl + U Display Mode
Alt + PfeilOben Moves Lines Up Shift + F1 Pretty Printer
Alt + Shift + A Toggle Block Selection Ctrl + F3 Activate
Alt + Shift + B Show In Breadcrumb Ctrl + F6 Easily switch between the editor tabs (Like Tab for Windows) !!
Alt + Shift + M Extract Method › Define Method Signature Ctrl + F7 Easily switch between all eclipse views
Alt + Shift + W Show in ... Ctrl + F8 Easily switch between the perspectives
Alt + Shift + Q Show View Ctrl + Alt + H Open Call Hierarchy
Ctrl + 1 Quick Fix Ctrl + Alt + S, S Splitscreen vertikal
Ctrl + 2 + R Rename Ctrl + Alt + S, F Splitscreen zurücknehmen
Ctrl + 3 Quick Access Ctrl + Shift + A Open Development Object
Ctrl + D Delete Line Ctrl + Shift + E Switch to Editor
Ctrl + E Quick Switch Editor Ctrl + Shift + G ABAP Where-used List
Ctrl + F Find / Replace Ctrl + Shift + N New (ABAP Repository Object)
Ctrl + H Open File Search Ctrl + Shift + F2 Run ABAP Test Cockpit