Interactive Reporting
Interactive Reporting
Graphical User Interfaces for Lists
ABAP Training Interactive Reporting 2
Objectives
Interactive reporting
What are interactive lists
Event control
At line-selection
SY-LSIND
AT pf<nn>
At user-command
Non-interactive Reporting
ABAP Training Interactive Reporting 4
Interactive Reporting
Secondary
List
Report
Interactive
List
Transaction
ABAP Training Interactive Reporting 5
Interactive
User selectively retrieves and presents data
REPORT ZSAPTEST.
*Basic List
START-OF-SELECTION. *Secondary Lists
GET … AT LINE-SELECTION.
END-OF-SELECTION. AT USER-COMMAND.
TOP-OF-PAGE. AT PF<nn>.
GET <dbtable>
Secondary Lists
Basic
List
REPORT ZSAPTEST. SY-LSIND = 0
To create different page headers for each secondary list you must
FOOTER
REPORT RSBBB06D.
GET SFLIGHT .
WRITE : SFLIGHT-CARRID, 16 SFLIGHT-CONNID, - - - -.
HIDE SFLIGHT-CARRID , SFLIGHT-CONNID, SFLIGHT-FLDATE. - - -.
END-OF-SELECTION.
CLEAR SFLIGHT-CARRID.
AT LINE-SELECTION.
CHECK NOT SFLIGHT-CARRID IS INITIAL. - - - -
CLEAR SFLIGHT-CARRID.
ABAP Training Interactive Reporting 13
REPORT ZSAPTEST.
GET SPFLI.
WRITE: / SPFLI-CARRID, SPFLI-CONNID
SPFLI-CITYFROM, SPFLI-CITYTO.
HIDE: SPFLI-CARRID, SPFLI-CONNID.
X HIDE Area
CARRID CONNID CITYFROM CITYTO CARRID CONNID
AA 0016 New York Denver AA 0016
LH 0400 Frankfurt New York LH 0400
LH 0357 Rome Frankfurt LH 0357
: :
ABAP Training Interactive Reporting 14
AT Events Processing
At line-selection
Processed when user double clicks on a valid line
At user-command
Processed when user
AT pf<nn>
Processed when user presses a function key with code pf<nn> (in
AT LINE-SELECTION
AT LINE-SELECTION AT LINE-SELECTION.
determine what action to CASE SY-LSIND.
take by checking the current WHEN ‘1’.
list level in the report
Select * from Sflight
code the appropriate action
Where Carrid …
WHEN ‘2’.
Select * from Sbook
Where…
ENDCASE.
ABAP Training Interactive Reporting 16
AT USER-COMMAND
AT USER-COMMAND AT USER-COMMAND.
determine what action to CASE SY-UCOMM.
take by checking the current WHEN ‘SORT’.
function code value stored in
Perform Sort_List.
SY-UCOMM
code the appropriate action WHEN ‘DELE’.
Perform Del_Record.
ENDCASE.
ABAP Training Interactive Reporting 17
SY-CUCOL level
Cursor position (column) SY-LISEL
SY-CPAGE Contents of the selected line
MESSAGE E027
Table T100
START-OF-SELECTION.
SELECT * FROM SPFLI WHERE CARRID = P_CARRID.
---.
ENDSELECT.
ABAP Training Interactive Reporting 22
Summary
You can use the interactive reporting functionality to provide the user
with additional clearly structured information in secondary lists or
windows.
To generate secondary lists or windows, various special events are
available that can be triggered by activating a function key or via mouse
click.
Besides the basic list, up to twenty secondary lists may exist. The
system field SY-LSIND contains the index of the list that is being
generated by the report.
To save data for the secondary list, use the statement HIDE. The system
stores field names and field contents per line. When an interactive event
is triggered, the values stored in the HIDE area are placed back into
original fields.
Page headings for secondary lists are defined in connection with the
event TOP-OF-PAGE DURING LINE-SELECTION.
ABAP Training Interactive Reporting 23
Conclusion
Interactive reporting
Non-static view of data for the user
Conclusion
Interactive lists
To save data for the secondary list use HIDE
(SY-LISEL)
At an interactive event the values stored in HIDE area
Objectives
To introduce the
The purpose and function of GUI’s for lists
At user-command
Interactive reports
Basic list provides coarse grained information
At user-command
AT pf<nn>
cursor position
Get cursor ...
ABAP Training Interactive Reporting 29
the report
ABAP Training Interactive Reporting 30
Screen title
titlebar of the window in which the list is displayed
Menu bar
Opens pull down menus
Application toolbar
Program functions assigned to pushbuttons
Standard toolbar
Scroll bars
Vertical & horizontal provided by the system
Elements of a GUI Status
Standard Application
Menu Bar Toolbar Title Bar
Toolbar
ABAP Training Interactive Reporting 32
Menu painter
Tool used to define status elements
Dialog box
Does not have a menu bar and only a few pushbuttons
List status
Used for lists
The display standards pushbutton telle the menu painter to create the
SAP standards for the menu bar. This includes menus for list, edit, go to
as well as system and help. (The system and help menus are part of
every SAP screen. They will not appear on the surface of the menu
painter tool but will appear on the menu bar in your program.)
ABAP Training Interactive Reporting 37
Application toolbar
Up to 20 pushbutton icons
Up to 48 function keys
Include in function key menu so user can see the definition when
they click the alternate mouse button
Defining Menu Bar Attributes
Menu Bar
Standards
Menu Bar
Function Codes
Menu Items
Defining the Standard Toolbar
Create Application Toolbar Item
ABAP Training Interactive Reporting 41
Assigning a Status
Assigning a Status
SET TITLEBAR <titlename>.
Assigning a Status
START-OF-SELECTION.
SET PF-STATUS ‘BASE’.
SET TITLEBAR ‘BAS’.
In the program editor double click on either of the above code lines to
go to
menu painter
text elements maintenance
ABAP Training Interactive Reporting 44
Event AT USER-COMMAND
Popup Windows
WINDOW STARTING AT c1 r1
[ENDING AT c2 r2]
Popup Windows
REPORT ZSAPTEST.
WINDOW STARTING AT 10 15
ENDING AT 77 22.
WRITE: / ...
10 77
X
Page Heading 1
15
22
ABAP Training Interactive Reporting 47
Get Cursor
Get cursor field FNAME [value FVALUE]
Get Cursor ….
Data: fred(20) value ‘Fred Flintsone’,
Barney(20) value ‘barney rubble’,
fname(10), fvalue(20).
Write: /10 fred, 40 barney.
At line-selection.
Get cursor field fname value fvalue.
If sy-subrc = 0.
Write: / ‘cursor on ‘, fname,
‘Which holds ‘, fvalue.
Else.
Write: / ‘cursor not on a field’.
endif.
ABAP Training Interactive Reporting 50
note that
GET CURSOR FIELD FNAME.
SORT ITAB BY FNAME.
Conclusion
single list
Displaying lists in popup windows