Вы находитесь на странице: 1из 23

ECC 6.

0
SAP Development ABAP Training

Exercises: Interactive Reporting

e following exercises are designed to help you understand interactive reporting using ABAP.
The solutions for the programs can be found in package YABAP47TRG.
solutions can be found in your ABAP manuals.

Written

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.
Write down the number of your change request here: ____________________________
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.

Page 1

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Chapter 3, Exercise 1
Program name YIRxx03_1
Create an interactive report that initially shows a list of vendor information. Specifically, it should
list the vendors ID number (LFA1-LIFNR), the vendors name
(LFA1-NAME1), and finally the vendors 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.

Page 2

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Chapter 3, Exercise 1
Sample Output

Page 3

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Chapter 3, Exercise 2
Program name YIRxx03_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.

SY-LSIND = 1

Initial list of
vendors

SY-LSIND = 1

Window A
Invoices

SY-LSIND =2

Window B
descending

Window C
ascending

Eventually, F5 will give


the user a list of invoices
for the selected vendor.
(window A )
Eventually, we will be able
Window D to the sort list of invoices
totaled in descending ( window B),
ascending ( window C )
order or totaled
( window D)

Use the TOP-OF-PAGE DURING LINE-SELECTION event to write the value of


SY-LSIND at the top of each of the windows ( A, B, C, and D ).

Page 4

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

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.

Create GUI Status


BASE

Initial list of
vendors
Window
A

Window
B
Create GUI Status SORTDE
for window B.

Create GUI Status INVOICES


for window A.

Window
C
Create GUI Status
SORTAS for window C.

Window
D
Create GUI Status TOTAL
for window D.

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.

Page 5

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Change the TOP-OF-PAGE DURING LINE-SELECTION event so that in addition to writing SYLSIND 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

Page 6

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Chapter 7, Exercise 1
Program name YIRxx07_1
Copy program YIRxx05_1 and rename it YIRxx07_1. Use the HIDE method, and the AT LINESELECTION 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 youre
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.

Page 7

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

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 vendors information on two lines):
Vendor Name
Vendor City

Vendor ID
Vendor Country

LFA1-NAME1
LFA1-ORT01

LFA1-LIFNR
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:
Vendor #

Bank Country

Bank Key

Account No.

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.

Page 8

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Basic List: Vendor Address Listing

Page 9

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Detail List #1: Vendor Bank Information

Page 10

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Detail List #2: Vendor Document Information

Chapter 8, Exercise 1
Program Name: YIRxx08_1

Page 11

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

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.

Page 12

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Sample Output

Page 13

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

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).

Page 14

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Page 15

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Chapter 9, Exercise 1
Program Name: YIRxx09_1
Create a basic listing of vendors. The listing should include the following fields:
LFA1- LIFNR
LFA1- NAME1
LFA1- ORT01
Be sure to include all appropriate column headers on the basic listing.
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:
BNKA-BANKA - Bank Name
LFBK-BANKL - Bank Number
LFBK-BANKN - Bank Account Number
LFBK-BANKS - Bank Country Code
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.

Page 16

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Sample Output

Page 17

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Page 18

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Chapter 9, Exercise 2
Program Name: YIRxx09_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:
BSIK-BELNR - Document number
BSIK-BUDAT - Posting date
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.

Page 19

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Sample Output

Page 20

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Page 21

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Chapter 9, Exercise 3
Program Name: YIRxx09_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:
Field Selected

Additional Data

Name
City

LFA1-NAME2, LFA1-SORTL
LFA1-PSTLZ, LFA1-LAND1

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).
You will need to create two GUI statuses.

Page 22

Dec-2008

ECC 6.0
SAP Development ABAP Training

Exercises: Interactive Reporting

Sample Output

Page 23

Dec-2008

Вам также может понравиться