|
The Best-Run Business Run SAP |
First of all, just before using Eclipse for ABAP development we have to perform some necessary prerequisites.
1. Check whether Java Runtime Environment (JRE) 1.6 or higher, 32-Bit (for the 32-Bit version of ABAP Development Tools) or 64-Bit (for the 64-Bit version of ABAP Development Tools) is installed on your local drive. Download it right from Oracle website (ver. 1.7).
2. After Java installation, you're ready to download and setup Eclipse IDE. It doesn't matter what Eclipse package to choose (Juno or Kepler) and you can download it right from the official website.
3. Download SAP Development Tools for Eclipse.
- In Eclipse, choose in the menu bar Help > Install New Software...
- In the Install dialog, enter the following update site URL in the Work with entry field:
- https://tools.hana.ondemand.com/kepler for Eclipse Kepler (4.3)
- https://tools.hana.ondemand.com/juno for Eclipse Juno (4.2)
- Press Enter to display the available features.
- Select ABAP Development Tools for SAP NetWeaver and choose Next.
- On the next wizard page, you get an overview of the features to be installed. Choose Next.
- Confirm the license agreements and choose Finish to start the installation.
Now we're ready to go!
Open Eclipse and create your first project. Go to menu: File -> New -> ABAP Project. A new window will appear:
Create a new connection to SAP system (or choose from existing ones). I don't consider connection creation process in details and if you don't know how to do that, please refer to SAP documentation or ask on our forum...
Note: I've deliberately skipped an SNC-name creation for the connection as I have my own SAP installation locally and there is no reason to protect it.
So! I suppose you have successfully created a new project and ready to go further. Create a new ABAP program: right-click on the project name -> New -> ABAP Program. Give it a reasonable name (according to the SAP naming convention, the user-defined module has to start from letter Z, ie "ZTEST001" or whatever you like).
Key some source code in order to check how it works. We'll create a small program which selects flight numbers from the database:
report ztest0001.
*Data declaration
tables sflight.
data: begin of t_report occurs 3,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
seatsmax like sflight-seatsmax,
end of t_report.
*Selection screen
select-options s_carrid for sflight-carrid.
select-options s_connid for sflight-connid.
select-options s_date for sflight-fldate.
*Get data
SELECT * from sflight
where carrid in s_carrid and
connid in s_connid and
fldate in s_date.
t_report-carrid = sflight-carrid.
t_report-connid = sflight-connid.
t_report-fldate = sflight-fldate.
t_report-seatsmax = sflight-seatsmax.
append t_report.
endselect.
if sy-subrc ne 0.
write 'Data not found'.
endif.
*Write data
loop at t_report.
skip. "comment:Go to next line
write t_report-carrid.
write t_report-connid.
write t_report-fldate.
write t_report-seatsmax.
endloop.
We are ready to run a project. Press CTRL+F11, familiar SAP window will appear. Press F8 to execute a program and look at the results window:
Horray! You've just finished your first journey to ABAP development with Eclipse... I hope it was the enjoyable and informative topic.
Next time we'll proceed with more complicated ABAP development and see how deep rabbit hole is ))
___________________
Please be aware that topics re-publishing from this website (in any kind) are only possible with author's permit.