Amdt New Exemple
Amdt New Exemple
Step 1
A wizard appears to create a new ABAP Program. Enter z_invoice_items_euro in the name field.
Enter a meaningful text in the description field. Choose Finish to create the report.Afterwards an
editor will be opened which shows the empty report.
Done
Step 2
Create ABAP local class
1. Type lcl and choose Ctrl+Space to get code completion proposals. Select the code
template for the insertion of a local class by choosing lcl - Local class or
choose Enter if the right entry is already selected.
2. Adjust the name of the local class to lcl_main using inline editing.
Done
Step 3
Position the cursor in the class definition statement and choose Ctrl+1 to open the Quick Fix menu.
Choose Generate factory method create to create a static factory method.
Done
Step 4
1. Add the definition of an additional instance method run by entering methods run. in
the public section.
2. Then position the cursor on the method name and choose Ctrl+1 to open the Quick-
Fix menu. Choose Add implementation for run.
Step 5
ABAP
Copy
START-OF-SELECTION.
lcl_main=>create( )->run( ).
Class methods are called using => ; instance methods are called using ->.
Done
Step 6
Save and activate your program by choosing Save and Activate in the toolbar.
Done
Step 7
Run the ABAP program
Choose F8 to run your program. An embedded SAP GUI will open inside an Eclipse editor. After
checking the output of the report choose Close.
Done
Step 8
You will now enhance the program to output your user name and today’s date. Change
the WRITE statement to:
sy- is the table containing all the system fields. For the complete list, see the ABAP keyword
documentation: ABAP System Fields.
/ is simply the new line character. (See also ABAP keyword documentation: WRITE.)
Done
Step 9
Again, choose F8 to run your program. Your output should now look something like this:
Done
Step 10
ABAP
Copy
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT z_invoice_items_euro.
public section.
methods run.
CLASS-METHODS create
RETURNING
protected section.
private section.
endclass.
class lcl_main implementation.
method create.
endmethod.
method run.
endmethod.
endclass.
START-OF-SELECTION.
lcl_main=>create( )->run( ).
Done
Step 11
Test yourself
Which event keyword is used to turn a report into an executable program? Choose one answer
only.
o INITIALIZE.
o START-OF-SELECTION.
o MAIN.
aparnami
Participant
Subscribe
Options
38 Kudos
44,939
ABAP Development,
SAP HANA,
INTRODUCTION:
ABAP Core Data Service Views also known as ABAP CDS Views. There are so many limitations in SE11
views but we can come out of all the limitations and create a powerful views with the help of ABAP
CDS Views.
In general SE11 views and ABAP CDS Views both will create a database views at the backend. When
we try to access these views as a table in the ABAP code, this code will be executed at the database
level.
Hence, SE11 views and ABAP CDS Views both will implement code push-down, In-spite of this, CDS
views has many advantages in CDS views.
Below are the comparison between SE11 views and ABAP CDS Views:
Below are the prerequisite knowledge required to create a ABAP CDS View:
1. Creation of ABAP Project
3. ABAP programming
I have already created the ABAP Project and ABAP Package in the HANA Development perspective
and below are the screen shot of these object.
1. ABAP Project
2. ABAP Package
Note: Make sure that you should create a ABAP package inside the ABAP project.
I am demonstrating the ABAP CDS view creation using SPFLI table with all the fields of it.
Step1. Right click on the ABAP Package and select new ABAP repository object and navigate to
Core Data Services, select the Data Defination and provide a name to CDS view.
Step2 and Step 3. Please provide a suitable name based on your project's naming
convention. Click on next and select the Transport request as shown below:
Step 4. Select the template based on your requirement and Click finish. I am selecting Define View
template since I am creating a ABAP CDS view with all the fields of Database table SPFLI.
Step5. As soon as you click on the finish, Below code will appears. Please refer the screen shot for
explanation.
Step8. Click on data preview to view the data of this CDS view.
With this example, we have completed the First part of ABAP CDS VIEWS simplified.
Please like and comment on it if you find it helpful.
https://community.sap.com/t5/technology-blogs-by-members/abap-cds-views-simplified-part-1/ba-
p/13426951