2 interactive report
DESCRIPTION
2 Interactive ReportTRANSCRIPT
![Page 1: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/1.jpg)
ABAP Programming
Basics of Interactive Reporting
Selection Screens
![Page 2: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/2.jpg)
Interactive Reporting
![Page 3: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/3.jpg)
Non-Interactive Reporting
![Page 4: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/4.jpg)
Interactive Reporting
InteractiveList
SecondaryList
Report
Transaction
![Page 5: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/5.jpg)
Non-Interactive vs Interactive Lists Non-Interactive
static structure single, extensive and detailed list
user searches through the list to find the relevant parts
Interactive user selectively retrieves and presents data
select lines, enter commands from menus, function keys or pushbuttons, type input
detailed information presented in secondary lists
ability to call transactions or other reports
![Page 6: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/6.jpg)
Interactive Reports are Event Driven
REPORT ZSAPTEST.REPORT ZSAPTEST.*Basic ListSTART-OF-SELECTION.START-OF-SELECTION.
GET …GET …
END-OF-SELECTION.END-OF-SELECTION.
TOP-OF-PAGE.TOP-OF-PAGE.
END-OF-PAGE.END-OF-PAGE.
*Secondary Lists
AT LINE-SELECTION.AT LINE-SELECTION.
AT USER-COMMAND.AT USER-COMMAND.
AT PF<nn>.AT PF<nn>.
TOP-OF-PAGE DURING TOP-OF-PAGE DURING LINE-SELECTION.LINE-SELECTION.
![Page 7: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/7.jpg)
The Basic List output of the data created while processing
either START-OF-SELECTION GET <dbtable>
by default a basic list has a standard page header if TOP-OF-PAGE / END-OF-PAGE event occurs
system writes data to page header / page footer and then displays basic list data on the output screen
system field SY-LSIND = 0
![Page 8: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/8.jpg)
Secondary Lists basic list + up to 20 secondary lists
can exist in parallel on moving to (next) secondary list
current list added to memory area SY-LSIND incremented by one
using back or exit logically superior list is displayed again SY-LSIND decremented by one
no standard heading for secondary lists
![Page 9: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/9.jpg)
BasicList
SY-LSIND = 0
1. SecondaryList
SY-LSIND = 1
2. SecondaryList
SY-LSIND = 2
3. SecondaryList
SY-LSIND = 2
choosechoose
choosechoose
choosechoose
REPORT ZSAPTEST.
WRITE: / ‘Basic List’.
AT LINE-SELECTION. CASE SY-LSIND. WHEN ‘1’. :
WHEN ‘2’. :
WHEN ‘3’. SY-LSIND = SY-LSIND-1. :
![Page 10: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/10.jpg)
Page Headers for Secondary Lists On secondary lists
system does not display a standard page header
does not trigger the TOP-OF-PAGE event TOP-OF-PAGE DURING LINE-SELECTION
triggered for each secondary list to create different page headers for each
secondary list you must program a processing block for each value of SY-LSIND
![Page 11: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/11.jpg)
The HIDE StatementHIDE <f>
stores the contents of <f> in relation to the current output line in the HIDE area
not necessary for <f> to appear on current lineplace the HIDE statement immediately after the output statement for <f>
user selection of a line for which HIDE fields are available fills the variables in the program with the values stored
![Page 12: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/12.jpg)
X
CARRID CONNID CITYFROM CITYTO
AA 0016 New York DenverLH 0400 Frankfurt New YorkLH 0357 Rome Frankfurt :
CARRID CONNID
AA 0016LH 0400LH 0357 :
HIDE Area
REPORT ZSAPTEST.
GET SPFLI. WRITE: / SPFLI-CARRID, SPFLI-CONNID SPFLI-CITYFROM, SPFLI-CITYTO. HIDE: SPFLI-CARRID, SPFLI-CONNID.
![Page 13: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/13.jpg)
AT Events Processing
AT LINE-SELECTION processed when user double clicks on a valid
line AT USER-COMMAND
processed when user presses a function key in the list makes an entry in the command field
function code stored in system field SY-UCOMM AT PF<nn>
processed when user presses a function key with code PF<nn> (in the range 0 to 99)
![Page 14: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/14.jpg)
AT LINE-SELECTION
AT LINE-SELECTIONdetermine what action to take by checking the current list level in the reportcode the appropriate action
AT LINE-SELECTION. CASE SY-LSIND. WHEN ‘1’. Select * from Sflight Where Carrid … WHEN ‘2’. Select * from Sbook Where… ENDCASE.
![Page 15: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/15.jpg)
AT USER-COMMAND
AT USER-COMMANDdetermine what action to take by checking the current function code value stored in SY-UCOMMcode the appropriate action
AT USER-COMMAND. CASE SY-UCOMM. WHEN ‘SORT’. Perform Sort_List. WHEN ‘DELE’. Perform Del_Record. ENDCASE.
![Page 16: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/16.jpg)
System Fields & Interactive Reports
SY-CUROW cursor position
(line) SY-CUCOL
cursor position (column)
SY-CPAGE number of current
page
SY-LSIND index of the
displayed list level SY-LISEL
contents of the selected line
![Page 17: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/17.jpg)
Selection Screens
![Page 18: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/18.jpg)
Selection Screens Used to allow the user to control the
database selections of the report Allows interactive
assignment of values to variables with the PARAMETERS statement
determine selection criteria for database fields
single values, range of values, sets of values, ... with the SELECT-OPTIONS statement
![Page 19: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/19.jpg)
The parameters Keyword
PARAMETERS: P1 TYPE P, P2(6) TYPE C DEFAULT ‘ITB255’.
PARAMETERS <field> TYPE <type> [DEFAULT <value>].PARAMETERS <field> TYPE <type> [DEFAULT <value>].
P1
P2 ITB255
Selection Screen
X
![Page 20: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/20.jpg)
Basic Form of select-options
SELECT-OPTIONS <seltab> FOR <f>.
creates a selection table <seltab> which is attached to database column or internal table field <f>.
the name <seltab>, like variable names, can be up to 8 characters only<f> cannot be of type f (floating point)
![Page 21: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/21.jpg)
REPORT ZSAPTEST.REPORT ZSAPTEST.TABLES: SFLIGHT.TABLES: SFLIGHT.SELECT-OPTIONS: AIRLINE SELECT-OPTIONS: AIRLINE FOR SFLIGHT-CARRIDFOR SFLIGHT-CARRID,, CONN CONN FOR SFLIGHT-CONNIDFOR SFLIGHT-CONNID..
multiple selection screen
![Page 22: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/22.jpg)
Multiple Selection Screen
![Page 23: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/23.jpg)
Multiple Selection Screen
icon on the main screen takes the user to the multiple selection screen
allows creation of more complex selection criteria pushbutton saves an extended selection
the arrow icon on the main screen turns to green indicating that the selection criteria is more complex than shown in the To and From fields
pushbutton allows the user to enter selection criteria that can be excluded from the resulting set
![Page 24: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/24.jpg)
<seltab> <seltab> is an internal table with 4 fields
SIGN OPTION LOW HIGHSIGN OPTION LOW HIGH
I EQE NE LT GT LE GE BT NB CP NP
![Page 25: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/25.jpg)
<seltab> and Database Selections
If the <seltab> contains more than one line form the union of sets defined on the lines that
have SIGN = I subtract the union of sets defines on the lines that
have SIGN = E select the resulting set
If <seltab> contains only lines with SIGN = E select all data outside the set specified in these
lines
![Page 26: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/26.jpg)
Assigning Default Values to Selection Criteria
SELECT-OPTIONS <seltab> FOR <f> DEFAULT <g> [TO <h>] OPTION <op> SIGN <s>.
<g> and <h> may be literals (enclosed in single quotes)names of fields whose contents should be used as default values
<op> may be one ofEQ,NE,GE,LE,GT,LT,CP,NP for single selectionsBT,NB for interval selections
<s> may be either I or E
![Page 27: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/27.jpg)
REPORT ZSAPTEST.REPORT ZSAPTEST.TABLES: SFLIGHT.TABLES: SFLIGHT.SELECT-OPTIONS: AIRLINE FOR SFLIGHT-CARRIDSELECT-OPTIONS: AIRLINE FOR SFLIGHT-CARRID DEFAULT ‘AA’ TO ‘LH’DEFAULT ‘AA’ TO ‘LH’ OPTION NBOPTION NB SIGN I.SIGN I.
![Page 28: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/28.jpg)
Assigning Default Values to Selection Criteria
REPORT ZSAPTEST.TABLES: SPFLI, SFLIGHT, SBOOK.SELECT-OPTIONS:AIRLINE FOR SPFLI-CARRID,
CONN FOR SPFLI-CONNID.INITIALIZATION. MOVE ‘LH’ TO AIRLINE-LOW. MOVE ‘UA’ TO AIRLINE-HIGH. MOVE ‘I’ TO AIRLINE-SIGN. MOVE ‘BT’ TO AIRLINE-OPTION. APPEND AIRLINE. CLEAR AIRLINE. MOVE ‘0400’ TO CONN-LOW. MOVE ‘I’ TO CONN-SIGN. MOVE ‘EQ’ TO CONN-OPTION. APPEND CONN.
![Page 29: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/29.jpg)
![Page 30: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/30.jpg)
Running a Report With a Variant
Execute the report Click on the 'Get Variant' button of the selection
screen Select a variant from the next dialog box
![Page 31: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/31.jpg)
Running a Report With a Variant
System … Services … Reporting Click on select a variant from the next dialog box
![Page 32: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/32.jpg)
Running a Report With a Variant
SUBMIT <reportname> USING SELECTION-SET <variantname>
![Page 33: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/33.jpg)
Conclusion
Interactive Reporting non-static view of data for the user
user selectively retrieves and displays data additional clearly structured information can be
presented to the user in secondary lists or windows
up to 20 secondary lists may exist secondary lists generated by special events
AT LINE-SELECTION, AT USER-COMMAND, AT PF<nn>
SY-LSIND contains index of current list level
![Page 34: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/34.jpg)
Conclusion
Interactive Lists to save data for the secondary list use HIDE
system stores field names and field contents per line (SY-LISEL)
at an interactive event the values stored in HIDE area are placed back into the original fields
generally better performance through interactive lists
only lines relevant to the user are selected and displayed as they are required
![Page 35: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/35.jpg)
Conclusion
This lecture examined methods of providing the user with some measure of control over database selections via the provision of a selection screen
PARAMETERS statement defines a variable which can hold a single
value AS CHECKBOX
provides a yes/no type selection RADIOBUTTON GROUP
provides a one of the following type selection
![Page 36: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/36.jpg)
Conclusion SELECT-OPTIONS
defines an internal table which holds selection conditions
internal table has 4 attributes SIGN, OPTION, LOW, HIGH
rows of the internal table can be specified via the DEFAULT clause in the program (one row) via the INITIALIZATION event in the program (many rows) dynamically at runtime
![Page 37: 2 Interactive Report](https://reader035.vdocuments.site/reader035/viewer/2022062423/563dbad4550346aa9aa86ca4/html5/thumbnails/37.jpg)
Conclusion selection screen can be formatted with
lines, comments, frames selection text can be maintained
through the Text Attributes screen variants provide a method of storing
commonly used selection conditions reports can be executed with a variant
from the workbench or from a program