0% found this document useful (0 votes)
20 views

WP02 - D Developing With ABAP in Eclipse

Developing with ABAP in Eclipse

Uploaded by

mailsidh2006
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

WP02 - D Developing With ABAP in Eclipse

Developing with ABAP in Eclipse

Uploaded by

mailsidh2006
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 79

5Steps2Fiori – Developer – WP02

Developing with ABAP Development Tools (ADT) for Eclipse


CUSTOMER
TABLE OF CONTENTS
INTRODUCTION...................................................................................................................................................... 3
PREREQUISITES – ECLIPSE AND ADT INSTALLATION ................................................................................... 4
1. Install a JVM .......................................................................................................................................... 4
2. Install Eclipse IDE ................................................................................................................................. 5
3. Configure JVM in eclipse ..................................................................................................................... 6
4. Install ABAP Development Tools in Eclipse ...................................................................................... 6
DEVELOPMENT BASICS ....................................................................................................................................... 7
Developing with ABAP in Eclipse ........................................................................................................................ 7
Open ABAP in Eclipse ........................................................................................................................................... 8
Use the Data Preview & the SQL Console ......................................................................................................... 17
Create and run an ABAP Program ..................................................................................................................... 25
Create a global ABAP Class for data retrieval .................................................................................................. 33
Using Core Data Services Views ........................................................................................................................ 57
Create a CDS View ............................................................................................................................................... 58
Use the CDS View in ALV with IDA .................................................................................................................... 69

2
INTRODUCTION
This document explains the steps required to complete all the activities planned for the current work package.
In this work package you will install the ABAP Development Tools in Eclipse and understand basics of developing ABAP in Eclipse.

3
PREREQUISITES – ECLIPSE AND ADT INSTALLATION

In this section we will explain the main steps to install Eclipse IDE and the ABAP Development Tools.

1. Install a JVM
Installation of a Java virtual machine (JVM) is required for you to make use of Eclipse IDE.

Depending on your preferences you may choose to install either a Java Runtime Environment (JRE), or a Java Development Kit (JDK), installing a JDK is the preferred option
by most developers but if you wish to save some disk space you may install a JRE.

The required JDK/JRE version for the latest Eclipse release must be a 64-bit JVM with Java 11.

See SAP Note 2949356 2949356 - Java 11 is mandatory for ADT in February 2021 for details.

Recommended Java Versions:

• Java 11: SapMachine 11

Once you have installed the JVM you may proceed with the installation of Eclipse IDE.

4
2. Install Eclipse IDE
There are 5 steps to install Eclipse IDE via the Eclipse Installer, you can follow the steps described in the following installation guide:

https://www.eclipse.org/downloads/packages/installer

When prompted for Eclipse version selection, choose “Eclipse IDE for Java EE Developers”, installer should then download the required components and run the
installation successfully.

5
3. Configure JVM in eclipse
In order to ensure that Eclipse is using the JVM that you have downloaded and to avoid interference by any other software installed in your system it is highly recommended
you configure Eclipse with the specific JVM you need.

To do this, you must modify the Eclipse.ini file in your installation folder. You can find the instructions to modify this file in all major OS versions in the following link:

https://wiki.eclipse.org/Eclipse.ini#Specifying_the_JVM

4. Install ABAP Development Tools in Eclipse


Once Eclipse IDE has been setup, you can proceed with the installation of ABAP Developer Tools by going thorugh the next steps:

a) In Eclipse, choose in the menu bar Help > Install New Software...
b) Add the URL https://tools.hana.ondemand.com/latest
c) Press Enter to display the available features.
d) Select ABAP Development Tools and choose Next.
e) On the next wizard page, you get an overview of the features to be installed. Choose Next.
f) Confirm the license agreements and choose Finish to start the installation

**NOTE:
Further information about Eclipse and ADT installation, including troubleshooting and know issues can be found in the ABAP Development Tools Installation
Guide

6
DEVELOPMENT BASICS

Introduction to ABAP in Eclipse


In this exercise you will learn the basics to jumpstart the use of ADT in Eclipse, you will start by creating simple reports and end in creating a custom CDS view that is
consumed by an ABAP report.

You can find the step-by-step exercise in this document in the third chapter.

Estimated execution time: 2 hours

The ABAP Development Tools (ADT) for SAP NetWeaver, also known as "ABAP in Eclipse", is the recommended IDE for developing ABAP applications. It is available
from SAP NetWeaver 7.31 SP4 onwards and it integrates seamlessly into your existing ABAP development systems. In this series of exercises, you will get an
introduction to the powerful tools delivered with ADT and experience the advantages of using ABAP in Eclipse for your ABAP developments.

All the solutions to the exercises are provided as a reference - this way you can also see the solutions for the exercises you did not finish. Feel free to experiment with
the IDE yourself. These exercises are only a guideline.

The exercises are based on the demo tables of the SAP NetWeaver EPM Model (you can find details in the SCN http://scn.sap.com/docs/DOC-31458 ). So you can
reiterate the exercises on any SAP NetWeaver 7.40 or later systems.

Developing with ABAP in Eclipse


Overview
Estimated time: 60 minutes

Objective
In this exercise you will learn how to use ABAP in Eclipse. You will create an ABAP Project, use the Data Preview and SQL Console and implement and run an ABAP
Application. You will also learn how to use Quick Assists to speed up your development.

Exercise Description:
• Open ABAP in Eclipse
• Create an ABAP Project
• Use the Data Preview and the SQL Console
• Create and run an ABAP Program
• Create a global ABAP Class for data retrieval

7
Open ABAP in Eclipse

Step/Comments Screenshot
1. Start Eclipse

8
2. Accept the proposed
workspace / choose your
own workspace.

9
3. Close the Welcome page.

10
Step/Comments Screenshot

4. Click the Window


menu item.
Then click on Perspective →
Open Perspective → Other

11
6. Select the entry
ABAP to
open the ABAP perspective
with the ABAP development
tools.

12
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
After starting the IDE and Repository Browser in the Object Navigator (SE80)) and open your ABAP Development Objects in the corresponding editor.
opening the ABAP perspective, Editors Area
the ABAP tools are ideally The editors for the ABAP Development Objects are opened in the area reserved in the centre of the IDE.
Outline View
positioned in the IDE to This view displays a structured overview of the ABAP Development Object that is currently open in the editor area. The contents of the outline
facilitate your development view are editor-specific.
tasks. Nevertheless you are Feature Explorer View
free to rearrange all views and This view provides you with an interactive tutorial to help you get familiar with the basic features in ABAP in Eclipse.
Other Views
editors to your personel needs.
Several other useful views are stacked underneath the editor area in a tabbed container. Two of the most commonly used views are the:
• Problems View: This view displays the syntax errors, warnings or other information associated with an ABAP Development Object
Project Explorer View (typically opened in the editor area)
Provides a hierarchical view of your • Properties View: This view displays the basic properties of the ABAP Development Object that is currently open in the editor area, e.g.:
ABAP Projects. From here you can "Last changed by", "Created on", etc.
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.
Editors Area
The editors for the ABAP
Development Objects are opened in
the area reserved in the centre 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 like transport organizer,
bookmarks, tasks and so on.

13
Step/Comments Screenshot

After starting the IDE, you have to


create an ABAP Project
(essentially a user connection to
the ABAP system).

7. Click the File menu


item.

8. Click New
9. Click the ABAP
Project

10. Select the


system
connection from
the list or define
a new
connection (by
clicking on „new
system
connection“) if
your system is
not in the list.

14
Step/Comments Screenshot
12. Enter your developer ID
(e.g. 5STEPS2FIORI) in the
User: * box.

Confirm your entry by pressing


the Tab key.

13. Enter your password.

15
14. Your ABAP Project has
been created and you have
successfully logged on to the
ABAP system. Your ABAP
Project is visible in the Project
Explorer.

16
Use the Data Preview & the SQL Console

Step/Comments Screenshot

1. Click or use the shortcut


Alt+F8 to execute an ABAP
Development Object. We will
"execute" the database table
snwd_so_inv_item. This will
open the Data Preview which
will allow us to explore the
invoice items in the EPM
model.

17
2. Enter snwd_so_inv_item in
the search field.

3. Once the search has


delivered a result or if the table
is already in the history
list, click on the
entry SNWD_SO_INV_ITEM.

4. Press to open
the Data Preview.

5. In the Data Preview Click


to change
which fields are retrieved from
the database.

18
Step/Comments Screenshot
6. First click Deselect All.

7. Only select the fields


GROSS_AMOUNT...

8. and CURRENCY_CODE.

9. Press to confirm
your selection.

The Data Preview is refreshed


accordingly.

19
10. Press Add filter and...

11. choose
CURRENCY_CODE.

12. Enter EUR in the text field


to filter the items that are in
Euro and press the Enter key.

The Data Preview is refreshed


accordingly.

20
Step/Comments Screenshot

13. to open
the SQL Console.

The SQL Console shows the


select statement which was used
to retrieve the data for the Data
Preview.
In the following steps you will
adjust the select statement to
read the payment status of the
order and the company name from
the buyer.

NOTE: If the filter for EUR in step


12 did not work, you can use the
code SELECT DISTINCT
SNWD_SO_INV_ITEM~CURREN
CY_CODE FROM
SNWD_SO_INV_ITEM and run
this in the SQL console – this will
tell you what currencies were
created when your data was
generated & you can adjust your
filter accordingly.

21
Adjust the select statement in SQL
Console in order to get the
payment status from the order
header by doing the following:

14. Add a JOIN condition for


the table snwd_so_inv_head

15. Correct the WHERE clause

16. Add the


field payment_status from
the table snwd_so_inv_head
to the SELECT list

17. Click Run to execute the


current query or press F8.

22
Step/Comments Screenshot
18. Check that the output on
the right hand side contains the
payment status.

Adjust the select statement


again in order to retrieve the
company name from the table
snwd_bpa by doing the following:

19. Add a join condition for


the table snwd_bpa
20. Add the field
company_name from the table
snwd_bpa to the select list.

21. Add an order by clause to


sort the result by the company
name of the buyer.

23
22. Click .

23. Check that the output on


the right hand side contains the
company name.

You will reuse this select


statement later for data retrieval
in an ABAP class. So just leave
the SQL Console open.

24
Create and run an ABAP Program

Step/Comments Screenshot
1. Right click on Logical
Objects ($TMP)

25
2. Search and select
ABAP Program

menu item.

3. Enter
Z_INVOICE_ITMES_EURO_<
NN> in the Name: * box.
Please refer to the Setup-
Information and exchange
_<NN> with your user number.

Confirm your entry by pressing


the Tab key.

4. Enter Euro Invoices in the


Description: * box.

5. Click Finish .

26
6. Type lcl and press
Ctrl+Space to get code
completion proposals.

7. Select the code template for


the insertion of a local class by
double-clicking on lcl - Local
class or press Enter when the
right entry is selected.

27
Step/Comments Screenshot
8. Adjust the name of the local
class to lcl_main using inline
editing.

9. Position the cursor in the


class definition statement and
press Ctrl+1 to open the Quick
Fix menu.
Double-click on Generate
factory method to create a
static factory method.

28
10. Add the defintion of an
additional instance method run
in the public section.

11. Position the cursor on the


method name and press
Ctrl+1 to open the Quick-Fix
menu.
Double-click on Add
implementation for run.

12. Fill the method


implementation of run with a
simple write statement.

13. Add a start-of-selection


event to your report and create
an instance of the local
class lcl_main. Call the
method run.

29
14. Click Activate
(Ctrl+F3) .

30
Step/Comments Screenshot

15. Click Run As... .

16. Double click on the entry


ABAP
Application
to select it.

31
17. Click the [F00]
Z_INVOICE_ITMES_EURO_<
NN>

tab to select it.

32
Create a global ABAP Class for data retrieval
In this part of the exercise, you will replace the write statement in your report with data retrieval logic based on the select statement created before in the SQL
Console. Then you will display the retrieved data using the SAP ABAP List Viewer (ALV). In order to separate concerns properly and to show you a wider toolset the
data retrieval logic will be encapsulated in a global ABAP class.

Step/Comments Screenshot
1. First remove the write
statement. Place the cursor
somewhere in the write
statement and use the shortcut
Ctrl+D to delete the whole line.

2. Create a local variable in the


run method. The variable
should be type ref
to zcl_invoice_retrieval_NN.
This is the global class for the
data retrieval.

3. Since this class does not yet


exist, you will get a syntax
error. To create the class place
the cursor on the class name
and press Ctrl+1 to get a Quick
Assist. In the Quick Fix menu
double-click on Create global
class
zcl_invoice_retrieval_NN .

A wizard will appear to create a


new ABAP class.

33
4. Enter
ZCL_INVOICE_RETRIEVAL_
NN in the Name: * box.
Replace NN with your user
number.

5. Enter Demo invoice


retrieval in the Description: *
box.
Confirm your entry by pressing
the Enter key.

6. Click Finish .

34
Step/Comments Screenshot
A new editor will be
opened showing the created class.

7. Back in your report trigger


the syntax check using the
keyboard shortcut Ctrl+F2. The
syntax error should no longer
occur.

8. Create an instance of class


zcl_invoice_retrieval_NN using
the new operator.

9. Call the method


get_items_from_db to read
the items from the database.
This method does not yet exist
and we will create it with a
Quick Assist.

10. Position the cursor on the


name of the missing method
and press Ctrl+1. In the Quick
Fix menu double-click on
Create method
get_items_from_db.

35
11. Click Finish to confirm the
creation of
get_items_from_db as a
public method without
parameters.

36
Step/Comments Screenshot
12. A method definition and...

13. an empty method


implementation have been
created by the Quick Fix.

37
14. Add an ABAP Doc comment to
the newly created method definition.

ABAP Doc comments can be used to


document APIs and are displayed in the
Element Info.
ABAP Doc comments begin with
"! .

15. Go to the SQL Console.

38
On the bottom left hand side of the SQL
console is the query section. It contains
the last executed select statements as
Open SQL statements ready to be
transferred into your ABAP code.

16. Resize the query section and


copy the Open SQL statement
using the shortcut Ctrl+C.

39
Step/Comments Screenshot
17. Paste the statement into
the method implementation of
get_items_from_db. Add the
ABAP statement terminator
(period character) at the end of
the statement to ensure that it
is syntactically correct.

18. Now is a good time to pretty


print the source code. Open the
Source menu and Click
Format. Alternatively use the
shortcut Shift+F1.

40
Since there are no formatting
settings defined for your user on
the ABAP server a dialog appears
which allows you to maintain these
settings.

19. Click on the link in the pop-


up
dialog to

41
This takes you to the
corresponding page in the
properties dialog of the project.

20. Click on the checkbox to


indent lines in your source
code.

21. Choose Custom as case


conversion methos and then
select your prefered code style
from the combobox e.g.:
Keywords uppercase,
identifiers lowercase.

22. Click Apply to activate


these settings.

23. Click OK to close the


Properties dialog.

42
Step/Comments Screenshot
24. Trigger
source formatting again by
pressing Shift+F1.

25. Use the shortcut Ctrl+D to


remove the UP TO 100 ROWS
addition.

43
26. Add some line breaks in the
join conditions to make the
select statement more
readable.

44
The method still doesn't deliver
any result data. You will now
execute a sequence of quick
assists to transform the inline
declared variable lt_result into a
fully typed returning parameter.

27. First position the cursor on


the inline declared
variable lt_result and press
Ctrl+1.

28. Select Declare local


variable lt_result
explicitlywith a double click in
the Quick Fix menu.

45
Step/Comments Screenshot

Wow! The local variable was


declared explicitly and a local
helper type was generated which
reflects the structure of our select
list containing the fields
company_name, gross_amount,
currency, and payment_status.

29. Position on the type name


helper_type and trigger
the Quick Fix proposals (
Ctrl+1 ).

30. In the Quick Fix menu


double-click on Convert
helper_type to class type.

46
The Quick Assist moved the
helper type from inside the method
implementation into the private
section. In order to use this type
for a parameter of your public
method get_items_from_db the
type should be moved into the
public section. Let's see if we can
find a Quick Assist for that.

31. Again put the cursor on the


type name helper_type and
press Ctrl+1.

32. In the Quick Fix


menu select Make helper_type
public with a double-click.

Now the helper_type has moved


into the public section and we can
transform the local
variable lt_result into a returning
parameter.

33. To do so place the cursor


on the variabe lt_result and
press Ctrl+1.

34. Double-click on Convert


lt_result to returning
parameter.

47
Step/Comments Screenshot

Note that the returning parameter


was added to the method and an
additional table type based on the
helper_type was generated.

35. ABAP Doc also offers the


possibility to document method
parameters and we have a
quick assist to do so. Place the
cursor inside of the ABAP Doc
comment. Then press Ctrl+1 to
open the Quick Fix menu and
double-click on Add missing
parameters to
documentation.

36. Add a proper text to


comment the parameter.

37. Activate the class by


clicking the activation
icon in the toolbar and go
back to your report.

48
38. Back in the report position
the cursor on the method call
get_items_from_db and Press
F2 to see the Element Info of
the method. In addition to the
method signature it also shows
the ABAP Doc you wrote
before.

39. Press ESC or click


somewhere in the editor to
close the Element Info.

40. Use a new inline declared


variable to receive the result of
the returning parameter.

Now you can display the invoice


items using the class
cl_salv_table.

41. Type cl_salv_table=> and

49
Step/Comments Screenshot
press Ctrl+Space to get code completion proposals.

42. Click on the static method factory and ...

43. Press Shift+Enter to insert the full signature of the


method call.

If you prefer to insert the full signature by default, you can


change the behaviour of the code completion in the
Preferences.
Select Window in the menu and click on Preferences. In the
Preferences Dialog enter code completion in the filter field or
open the following path ABAP Development > Editors >
Source Code Editors > Code Completion. In the Code
Complition settings you can activate a checkbox to Always
insert full signature on completion.

50
44. In the generated method call...
• Remove the commented importing parameters
list_display, r_container, and container_name
using the shortcut Ctrl+D
• Uncomment the exporting parameter
r_salv_table using the shortcut Ctrl+7 and
assign it to an inline variable alv_table
• Assign the variable invoice_items to the
changing parameter t_table

Your method call should be the same as the statement


in the screenshot.

51
Step/Comments Screenshot
45. Finally, call the display
method of alv_table.

46. Activate your report by


clicking the activation
icon in the toolbar or
using the keyboard shortcut
Ctrl+F3.

47. Run your report by


pressing F8.

48. The invoice items are


displayed in the SAP List
Viewer.

Notice that the payment status


can contain the internal codes
P or <SPACE>. In our case all
record have status <SPACE>.
Wouldn't it be better to display
more readable texts, e.g. Paid
and Open?

52
49. Go back to your invoice
retrieval class and adjust the
payment_status component of
the helper_type so that it can
hold 10 characters.

50. Add a loop in


the implementation part of the
method get_items_from_db
which transforms the values of
payment_status into readable
text.

53
51. Activate the class
by clicking or use the
shortcut Ctrl+F3.

54
Step/Comments Screenshot

52. Go back to your report by


clicking on the corresponding
editor tab and execute it by
pressing F8.

Check the result of your changes


in the SAP List Viewer.

55
You have completed the exercise!

You are now able to:


• Create an ABAP Project which represents a logon to your development system
• Use the Data Preview to look at the content in database tables and views
• Use the SQL Console to create and fine tune more complex select statements
• Create ABAP Programs and Classes
• Use Quick Assists via the shortcut for quick fixes Ctrl+1

56
Using Core Data Services Views

Overview
Estimated time: 30 minutes

Objective

In the following exercise you will learn how to use the new Core Data Services (CDS) tools in ABAP in Eclipse. CDS is an extension of the ABAP Dictionary that
allows you to define semantically rich data models in the database and to use these data models in your ABAP programs. CDS is a central part of enabling Code
Pushdown in ABAP applications.

You will learn to define a new CDS view in a DDL source and to consume the CDS view in the SAP List Viewer with Integrated Data Access (ALV with IDA). Using
ALV with IDA it is possible to display views and tables that contain very large quantities of data in the UI. You will also learn about some of the CDS enhanced view-
building capabilities such as associations and annotations.

You can find more information about CDS and ALV with IDA in the SAP Help Portal (help.sap.com) and the SAP Community Network (scn.sap.com).

Exercise Description

• Create a CDS View


• Use the CDS View in ALV with IDA

57
Create a CDS View

Step/Comments Screenshot
1. In the context menu of your
Local Objects $TMP package select New and
then click Other ABAP Repository Object.

58
Step/Comments Screenshot
2. Enter ddl in the text field and
click Data Definition.

3. Click .

59
4. Check that $TMP is filled in
the Package:
* box.

5. Enter
Z_INVOICE_ITEMS_NN in the
Name: * box. Replace NN with
your user number.

Confirm your entry by pressing


the Tab key.

6. Enter Invoice items in the


Description: * box.

7. Click Next .

8. Click Next .

60
Step/Comments Screenshot
9. Select the Define View
template by clicking Define
View

10. Click Finish .

61
11. Enter
ZINVOICEITEMS_NN for the
SQL view name. Replace NN
with your user number.

The SQL view name is


the internal/technical name of the
view which will be created in the
database. Z_Invoice_Items_Nn is
the name of the CDS view which
provides enhanced view-building
capabilities in ABAP. You should
always use the CDS view name in
your ABAP applications.

Enter the CDS view


sepm_sddl_so_invoice_item as
the data source for your view. Use
the code completion to get
suggestions for the data source.

12. Enter sepm_sddl_so_inv


and use the keyboard shortcut
CTRL+SPACE to trigger the
code completion.

13. Double-click on

62
Step/Comments Screenshot

Use code completion to help you


add the fields to the select list. For
example, ent.er gross and use
the keyboard shortcut
CTRL+SPACE. Click on the field
gross_amount.

14. Add the fields


gross_amount and
currency_code to the select
list of the CDS view. The fields
must be separated by a
comma.
sepm_sddl_so_invoice_item.gr
oss_amount,
@Semantics.amount.currency
Code: 'CurrencyCode'
sepm_sddl_so_invoice_item.cu Make sure you include annotation @Semantics.amount.currencyCode
rrency_code

63
CDS associations model the
relationships between data
sources. You can use associations
and path expressions to access
fields in related data sources
without specifying JOIN
conditions.

15. Display the Element Info for


the data source
sepm_sddl_so_invoice_item.
Position the cursor on the data
source name in the FROM
clause and press F2.

16. Scroll down to see the


related data sources which are
accessible via associations.
Click on the hyperlink
sepm_sddl_so_invoice_head
er to see details about the
target data source of the
association header.

17. Close the Element Info.


Press ESC.

64
Step/Comments Screenshot

Use the associations in path


expressions to add fields of related
data sources to the select list of
Z_Invoice_Items. Don't forget to
separate the fields with a comma.

18. Use the association header


to add the payment_status
from the invoice header to the
select list.
sepm_sddl_so_invoice_item.he
ader.payment_status

19. Use the associations


header and buyer in a path
expression to add the
company_name of the
business partner to the select
list.
sepm_sddl_so_invoice_item.he
ader.buyer.company_name,

20. Implement a case


statement to set the code of the
payment status to readable
text.
case
sepm_sddl_so_invoice_item.he
ader.payment_status
when 'P' then 'Paid'
else 'Open'
end as payment_status

65
21. Save the DDL source. Click
Save (Ctrl+S) .

22. Activate the DDL Source.


Click Activate (Ctrl+F3) .

66
Step/Comments Screenshot
23. Open the Data Preview for
your CDS view. Press F8.

67
The invoice items are displayed in
the Data Preview.

68
Use the CDS View in ALV with IDA

Step/Comments Screenshot
1. In the context menu of the
program
Z_INVOICE_ITEMS_EURO<N
N> click Duplicate....

2. Give the duplicated program


a name. Enter
Z_INVOICE_ITEMS_CDS_NN
in the field Name: *. Replace
NN with your user number.

3. Click Finish .

69
Replace the implementation of the
run method. Create an ALV with
IDA for your CDS View
Z_Invoice_Items_Nn (Nn
represents your user number) and
display the ALV with IDA in
fullscreen.
DATA(alv_display) =

cl_salv_gui_table_ida=>create_for
_cds_view(
'Z_INVOICE_ITEMS_NN' ).
alv_display->fullscreen( )->display(
).

4. Click Save (Ctrl+S) .

5. Click Activate (Ctrl+F3) .

6. Execute the program. Press


F8.

70
Step/Comments Screenshot

The invoice items are displayed in


ALV with IDA.

In the next steps we will filter the


results to only display items
with currency code EUR.

7. Click .

71
8. Select ISO Currency Code.
Add the column to the Filter
criteria. Click .

72
Step/Comments Screenshot
9. Set the filter values. Click
.

73
10. Enter EUR for the ISO
Currency Code filter criteria.

11. Click .

74
The filtered invoice items are
displayed in ALV with IDA.

Notice that the label for the


PAYMENT_STATUS column is
missing. We will fix this in the next
steps.

12. Close the application. Click


.

75
Step/Comments Screenshot
13. Click the [FXX]
Z_INVOICE_ITEMS_NN
tab to
open the DDL editor.

14. Insert the annotation


@EndUserText.label:
'Status' before the case
statement of the
field PAYMENT_STATUS.

Tip: Use code completion to


insert the annotation. Enter
@End and use the keyboard
shortcut CTRL+SPACE to
trigger the code completion.

15. Click Save (Ctrl+S) .

16. Click Activate


(Ctrl+F3) .

17. Click the [FXX]


Z_INVOICE_ITMES_CDS_<N
N>
tab.

76
18. Press F8 to execute the
program.

77
Step/Comments Screenshot

The PAYMENT_STATUS column


is displayed with the label 'Status'.

You have completed the exercise!

You are now able to:


• Create a CDS view in ABAP in Eclipse
• Use a CDS view in ALV with IDA

78
www.sap.com/contactsap
© 2021 SAP SE or an SAP affiliate company. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.

The information contained herein may be changed without prior notice. Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors. National product
specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable for errors or
omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if
any. Nothing herein should be construed as constituting an additional warranty.

In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This
document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are all subject to change and may be changed by
SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-
looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, and
they should not be relied upon in making purchasing decisions.

SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. All other product
and service names mentioned are the trademarks of their respective companies. See www.sap.com/trademark for additional trademark information and notices.

. All other product and service names mentioned are the trademarks of their respective companies. See http://www.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and notices.

You might also like