abapcoderetreat 23.7.2016 - abap in eclipse
TRANSCRIPT
© Kaufland 2016 |
ABAP CODERETREAT WEINSBERGABAP in Eclipse
KIS, Weinsberg, 23.07.2016
ABAP CodeRetreat Weinsberg121.07.2016
© 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, jobsare safe workplaces and real satisfaction
Diversity and stability
We offer a wide range of jobs with many different entry-levels andcareer opportunities. Our company is continuously growing, thatmakes us self-confident
Openness and friendly cooperation
We support a cooperation based on friendliness and mutual trust
ABAP CodeRetreat Weinsberg221.07.2016
© 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 ourinternational colleagues
• According to the area of deployment you will have theopportunity to collect experience abroad, in one of ourEuropean locations
ABAP CodeRetreat Weinsberg321.07.2016
© 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 trackis our daily responsibility
Keep IT simple and safe
Our objectives are to comprehensively advice our businessdepartments in designing their business processes and toimplement software solutions
OUR IT IN FIGURES
21.07.2016
220 SAP Systems
40SAP Developers
25k Z Reports
© 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
© Kaufland 2016 | ABAP CodeRetreat Weinsberg6
ECLIPSE IDE COMPONENTS
21.07.2016
Perspective SwitchWe can switch between
several perspectives here
Editor ViewThis is where we edit
our source code
MenubarsFull drop down menusplus quick access tocommon 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 !
© 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
© Kaufland 2016 | ABAP CodeRetreat Weinsberg
CREATING A NEW PROJECT
21.07.2016
• click FINISH to create ABAP Project
Enter SAP system credentials
© Kaufland 2016 | ABAP CodeRetreat Weinsberg
CREATING A CLASS
21.07.2016 9
We are saving the class as a $TMP packageso 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
© Kaufland 2016 | ABAP CodeRetreat Weinsberg
CREATING A METHOD
21.07.2016 10
Write the definition of method -> Ctrl +1 on the method name
© 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 packageso a transport request is not required
© 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 selectRun As -> ABAP Application (F8)
© 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
© Kaufland 2016 | ABAP CodeRetreat Weinsberg
RUNNING CODE
21.07.2016 14
Running a single method -> mark a method and F8
© Kaufland 2016 | ABAP CodeRetreat Weinsberg
RUNNING CODE
21.07.2016 15
Enter the Import Parameters and execute the method
© 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
© 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 arerepresented by
these blue bubbles
© 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)
© 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 Debugperspective – clickABAP to return to
normal
© 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.
...
© 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
© 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 Eclipserefactoring wizard makes the job easier by automatically detecting all dependencies on the class / method beeing renamed andmodifying them also in the same time.
The refactoring menu can be opened by Ctrl+1
click Finish to perform the refactoring
© Kaufland 2016 | ABAP CodeRetreat Weinsberg
REFACTORING
21.07.2016 23
Result of renaming class ZCL_ACR_01 -> ZCL_ACR_02
© 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
© Kaufland 2016 | ABAP CodeRetreat Weinsberg
REFACTORING
21.07.2016 25
Rename in source unit (Ctrl+1)
... while renaming the field thedependencies in the sourcecode will be automatically
changed
© 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
© 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 thecomparison of both versions.
This compare works also between projects(SAP systems).
© Kaufland 2016 | ABAP CodeRetreat Weinsberg
ABAP ELEMENT INFO
21.07.2016 28
Press F2 on any element ...
© Kaufland 2016 | ABAP CodeRetreat Weinsberg
ABAP DOC
21.07.2016 29
• With ABAP Doc you can write yourdocumentation directly within yoursource code using special commentsin front of a declarative statement
• This means you can document globallyavailable elements (like classes, interfaces and their method andattribute) but also local elements (like local variables and field-symbols)
© Kaufland 2016 | ABAP CodeRetreat Weinsberg
ABAP KEYWORDS COLORS
21.07.2016 30
Click Windows -> Preferences ...
© Kaufland 2016 | ABAP CodeRetreat Weinsberg
TRANSPORT ORGANIZER
21.07.2016 31
With the transport organizer you can edit transports (Release, Change Owner)
© 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
© Kaufland 2016 | ABAP CodeRetreat Weinsberg
SHORT CUTS
21.07.2016 33
F2 Code Information Ctrl + L Goto LineF3 Navigate to Ctrl + M Maximize Active View or EditorF5 Refresh Ctrl + O Quic OutlineAlt + U Delete unused variables (all) Ctrl + Q Last Edit LocationAlt + F2 Show method Information Ctrl + T Quick Type HierarchieAlt + F8 Run an ABAP development object Ctrl + U Display ModeAlt + PfeilOben Moves Lines Up Shift + F1 Pretty PrinterAlt + Shift + A Toggle Block Selection Ctrl + F3 ActivateAlt + 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 viewsAlt + Shift + W Show in ... Ctrl + F8 Easily switch between the perspectivesAlt + Shift + Q Show View Ctrl + Alt + H Open Call HierarchyCtrl + 1 Quick Fix Ctrl + Alt + S, S Splitscreen vertikalCtrl + 2 + R Rename Ctrl + Alt + S, F Splitscreen zurücknehmenCtrl + 3 Quick Access Ctrl + Shift + A Open Development ObjectCtrl + D Delete Line Ctrl + Shift + E Switch to EditorCtrl + E Quick Switch Editor Ctrl + Shift + G ABAP Where-used ListCtrl + F Find / Replace Ctrl + Shift + N New (ABAP Repository Object)Ctrl + H Open File Search Ctrl + Shift + F2 Run ABAP Test Cockpit