09_Interactive Reporting Exercises
09_Interactive Reporting Exercises
0
Exercises: Interactive Reporting SAP Development ABAP Training
The following exercises are designed to help you understand interactive reporting using ABAP.
The solutions for the programs can be found in package “YABAP47TRG”. Written
solutions can be found in your ABAP manuals.
Before you begin the Interactive Reporting exercises, you must create a new Package and
a new Change Request, so your work is stored as it might be on a client project.
To do this, find the sheet used for your first Package and Change Request Exercise and use this
if you need it to help you through the abbreviated instructions below:
Create a new Package, by going to the Repository Browser (transaction SE80), and typing
YIRXXC in the package field (where XX is the last two digits of your logon id). Click on the
display pushbutton, and create the new Package, calling it something like ‘Interactive Reporting
Package for <your name>’.
NOTE: When you hit the save button, do not use your previous Change Request. Instead,
when the Change Request Query Screen appears, click on the Create Request pushbutton,
enter a short description, such as ‘Interactive Reporting Change Request for <your name>’, and
save.
Use the green arrow to go back to your new Package, and ensure that all you programs in the
Interactive Reporting section of the course are stored in this Package.
Dec-2008
Page 1
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Chapter 3, Exercise 1
Create an interactive report that initially shows a list of vendor information. Specifically, it should
list the vendor’s ID number (LFA1-LIFNR), the vendor’s name
(LFA1-NAME1), and finally the vendor’s city (LFA1-ORT01). You can use a SELECT statement
or a logical database.
Also make sure that you maintain text elements for the column headings (column headings
should read VENDOR ID, VENDOR NAME, CITY), and the list header (list header should read:
INITIAL LIST OF VENDORS (SY-LSIND = 0)). Do not use the TOP-OF-PAGE event.
Write code that reacts when the use presses the F5 key. This code will create a window that
contains the text “THIS WINDOW WILL EVENTUALLY CONTAIN INVOICES FOR THE
SELECTED VENDOR”. In following lessons we will refer to this window as window A.
Write code that reacts when the use presses the F6 key. This code will create a window that
contains the text “THIS WINDOW WILL EVENTUALLY CONTAIN INVOICES FOR THE
SELECTED VENDOR IN DESCENDING ORDER.”. In following lessons we will refer to this
window as window B.
Write code that reacts when the use presses the F7 key. This code will create a window that
contains the text “THIS WINDOW WILL EVENTUALLY CONTAIN INVOICES FOR THE
SELECTED VENDOR IN ASCENDING ORDER.”. In following lessons we will refer to this
window as window C.
Write code that reacts when the use presses the F8 key. This code will create a window that
contains the text “THIS WINDOW WILL EVENTUALLY CONTAIN A TOTAL OF THE INVOICES
FOR THE SELECTED VENDOR.”. In following lessons we will refer to this window as window
D.
Dec-2008
Page 2
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Chapter 3, Exercise 1
Sample Output
Dec-2008
Page 3
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Chapter 3, Exercise 2
In the following exercises you will often see instructions telling you to make a copy of the program
that you created in the previous exercise. You should keep in mind that you may or you may
not have to replace significant parts of the code. You will need to decide.
Copy your last program and rename it YIRxx03_2. In this version of the program you should
maintain the column headings with the TOP-OF-PAGE event. Use the TOP-OF-PAGE event to
write the column headings using the correct spacing. Delete the column headers that are
maintained in the text elements.
Currently, the report creates the appearance of many unorganized windows. In this exercise, all
you have to do is change your code so that window A is maintained at SY-LSIND level 1, and
window B,C, and D are maintained at SY-LSIND level 2. You do not have to populate the lists for
the windows...yet.
Dec-2008
Page 4
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Chapter 5, Exercise 1
Program name YIRxx05_1
Copy program YIRxx03_2and rename it YIRxx05_1. This version of the program must use
several GUI Statuses to accomplish the same functionality as its predecessor.
The initial screen will use the GUI Status BASE. BASE should have a button and menu that will
open window A. You must create the GUI Status BASE.
Window A will use the GUI Status INVOICES. INVOICES should have buttons on it that will open
either window B, C or D. ( i.e. sort ascending ,descending, or totaled ). You must create the GUI
Status INVOICES.
Window B will use the GUI Status SORTDE. SORTDE should have a button on it that will open
window C, so the user can alternate between descending and ascending. You must create the
GUI Status SORTDE.
Window C will use the GUI Status SORTAS. SORTAS should have a button on it that will open
window B, so the user can alternate between ascending and descending. You must create the
GUI Status SORTAS.
Window D will use the GUI Status TOTAL. You must create the GUI Status TOTAL.
Dec-2008
Page 5
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Change the TOP-OF-PAGE DURING LINE-SELECTION event so that in addition to writing SY-
LSIND at the top of each window, it also writes a sentence at the top each of the windows (A, B,
C, and D) that describes the function of the window. For example, at the top of window A there
should be a sentence like “INVOICES FOR THE SELECTED VENDOR”. You will need to use
either IF or CASE logic with the SY-PFKEY system field. Remember the SY-PFKEY system field
contains the name of the GUI Status which is currently being used.
Chapter 5, Exercise 1
Sample Output
Dec-2008
Page 6
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Chapter 7, Exercise 1
Copy program YIRxx05_1 and rename it YIRxx07_1. Use the HIDE method, and the AT LINE-
SELECTION event to populate window A with the document reference numbers
( BSIK-BELNR ) as well as the amount in local currency ( BSIK-DMBTR ) for the selected
vendor. If no invoices exist for the selected vendor, notify the user with an appropriate message.
Because you are going to code the AT LINE-SELECTION event, make sure the PICK function
code is assigned to the F2 key on the BASE GUI status.
Make sure that your code is capable of dealing with the possibility of the user selecting an invalid
line. In other words, selecting an invalid line (e.g. the list header) should not produce a new detail
list.
Also remove the text 'THIS WINDOW WILL EVENTUALLY CONTAIN INVOICES FOR THE
SELECTED VENDOR.’. from window A.
By manipulating internal tables, add the sorting functionality for windows B and C. Also remove
the text 'THIS WINDOW WILL EVENTUALLY CONTAIN INVOICES FOR THE SELECTED
VENDOR IN DESCENDING ORDER.' from window B, and the text 'THIS WINDOW WILL
EVENTUALLY CONTAIN INVOICES FOR THE SELECTED VENDOR IN ASCENDING
ORDER.' from window C.
Use an aggregating SELECT statement to add totaling functionality for window D. When you’re
done, window D should contain the words “ THE TOTAL FOR INVOICES:” , and an amount that
is equal to the sum of the DMBTR field for the selected vendor. Also remove the text 'THIS
WINDOW WILL EVENTUALLY CONTAIN A TOTAL OF THE INVOICES FOR THE SELECTED
VENDOR.' from window D.
A good test vendor (i.e one that has invoices) is 1000 C.E.B. BERLIN. It is located in the last
quarter (1/4) of the list.
Dec-2008
Page 7
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Chapter 7, Exercise 2
Write the following interactive report using AT PF events (no GUI status) and the logical
database KDF. Make sure the user cannot select an invalid line to produce a list. When testing
your report, you may wish to limit your vendor selections to VEND000 - VEND020.
1) The basic list should contain vendor information with column headings in the format specified
below (with column header and each vendor’s information on two lines):
LFA1-NAME1 LFA1-LIFNR
LFA1-ORT01 Country description
Obviously, you will need to obtain most of the vendor address information from LFA1. Locate the
table which contains the country description and print out this information (rather than the country
key field in LFA1). Maintain 2-line column headings through the TOP-OF-PAGE event. (See
sample output).
Important: The user should be able to select either one of the lines for a vendor and
invoke either of the AT PF events to create the windows described below.
2) Detail List #1: This list should be created when AT PF14 is invoked, and should be
maintained at list level 1. The following fields from LFBK should be output in this format:
If no bank records exist for the selected vendor, output a message to the screen. Maintain
column headings through the TOP-OF-PAGE DURING LINE-SELECTION event.
Important: The user should be able to select any bank data line or a “no records exist”
line and invoke AT PF16 to go to Detail List #2.
3) Detail List #2: This list should be created when AT PF16 is invoked, and should also be
maintained at list level 1. The following fields from BSIK should be output in this format:
Amount
Vend. No. Document No. Doc. Date Posting Date in local currency
If no documents exist for the selected vendor, output a message to the screen. Maintain column
headings through the TOP-OF-PAGE DURING LINE-SELECTION event. Important: The user
should be able to select document data line or a “no records exist” line and invoke AT
PF14 to go to Detail List #1.
Dec-2008
Page 8
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Dec-2008
Page 9
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Dec-2008
Page 10
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Dec-2008
Page 11
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Chapter 8, Exercise 1
You are to write a program that creates a basic list of vendor information. This list should include
the following:
LFA1-LIFNR
LFA1-NAME1
LFA1-ORT01
LFA1-LAND1
At the beginning of each line in the list, there must be a field that can be used as a flag to
designate that line for further processing. This field should take the form of a check box.
After pressing a pushbutton (with an appropriate icon), an address list for the lines checked must
be printed (Hint: Look at the help on NEW-PAGE and specifically the additions PRINT ON /
PRINT OFF). You have the option of storing the address listing in a spool file instead of printing
it. Where is this controlled from? The spool file may then be printed at a later date using
System Own spool request then Spool request Display. When printed, the list must
include the following fields:
LFA1-LIFNR
LFA1-ANRED
LFA1-NAME1
LFA1-STRAS
LFA1-PSTLZ
LFA1-ORT01
In the basic list, mark those vendors for which an address has been printed with an ‘*’ in a
position immediate next to the check box. For those fields marked with an ‘*’, input should no
longer be allowed and the check box should no longer be checked.
Dec-2008
Page 12
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Sample Output
Dec-2008
Page 13
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
The above list is not the detail list for your interactive report. This list is in the spool requests
(“System > Own spool requests THEN Spool request > Display” menu paths).
Dec-2008
Page 14
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Dec-2008
Page 15
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Chapter 9, Exercise 1
Create a basic listing of vendors. The listing should include the following fields:
LFA1- LIFNR
LFA1- NAME1
LFA1- ORT01
After positioning the cursor on a line and pressing a function key, double-clicking, or selecting a
menu item, bank data for the selected vendor is to be displayed in a window. If bank data does
not exist, the window is still displayed with a message to the effect that no data exists.
If bank data is found the following data should be displayed in the window:
In addition to the bank information, the selected line is to be re-printed in the window. Based on
the location of the line selected in the basic listing, the window should be positioned accordingly
so as to leave the selected line visible in the basic list.
Create and maintain the GUI interfaces and titles. For the basic listing, choose status type LIST
STATUS and for the bank data (window), choose LIST IN THE DIALOG BOX.
Dec-2008
Page 16
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Sample Output
Dec-2008
Page 17
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Dec-2008
Page 18
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Chapter 9, Exercise 2
Create a company driven vendor listing. For each vendor and company, output the following
fields:
LFA1-LIFNR
LFA1-NAME1
LFB1-BUKRS
After positioning the cursor on a line and pressing a function key, pressing a pushbutton (with
icon), or selecting a menu option, the documents that exist for that vendor under the current
company code are to be displayed in a window, positioned on the right hand side of the screen.
For each document, the following fields should appear in the window:
Be sure to create a column heading on the vendor listing within the window.
Create and maintain the GUI interfaces and titles. For the vendor basic listing, choose status
type LIST STATUS and for the document data (window), choose LIST IN THE DIALOG BOX.
Dec-2008
Page 19
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Sample Output
Dec-2008
Page 20
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Dec-2008
Page 21
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Chapter 9, Exercise 3
You are to create a basic listing of vendor information which includes the following fields:
LFA1-LIFNR
LFA1-NAME1
LFA1-ORT01
The user is to be allowed to double-click on a field and display a dialog box with additional
information on that field. The fields on the basic listing eligible for this function and the additional
data is as follows:
In addition to displaying the additional data, the dialog box should contain the line selected. If the
selection is invalid, and information message should appear (message 810 from message class
(ID) ZZ).
Dec-2008
Page 22
ECC 6.0
Exercises: Interactive Reporting SAP Development ABAP Training
Sample Output
Dec-2008
Page 23