This document discusses interactive reporting in ABAP. It introduces basic concepts of interactive reporting such as allowing drill-down from a primary list to display additional details related to a selected line. It examines the AT LINE-SELECTION event statement which is used to trigger code execution when a line is selected. The HIDE command is also introduced, which stores field values from the selected line that can then be accessed after a line is selected. Techniques for ensuring valid line selection such as using a CHECK statement are also covered.
Interactive Reporting: Overview Explain concept of “drill-down” or “double-click” using example above.
Interactive Reporting: Overview This lecture will focus on the drill-down methods to produce secondary lists. Example of a transaction - from previous slide, drill-down indicates 12 seats available - press a function key or pushbutton to make a booking.
Events LOAD-OF-PROGRAM is the first event block is all APAB programs. This event block allows you to set default values that can only be determined at run-time (see example) report lecture7a. parameters: pa_date like sy-datum default sy-datum. load-of-program. pa_date = sy-datum - 7. start-of-selection. write: / pa_date. START-OF-SELECTION event is the first event block for creating a list. It is triggered as soon as the program leaves the selection screen. It is often used to identify the main body of the program. It is the default event where a program does not have any event statements. END-OF-SELECTION event is triggered when the last database record is read. It is often used to identify the actions to be taken after the database records have been read and processed. How would this be applied to the 1st assignment? >> EOS event would contain code to print the sales totals/system date/time. GET event triggered when logical db makes data available from specified table. TOP-OF-PAGE event triggered when first write issued/new page started. INTERACTIVE EVENTS AT LINE-SELECTION event triggered when user double-clicks on a list line. >> used in this lecture AT PFxx event is triggered when user presses a preprogrammed function key. AT USER COMMAND event is triggered when user presses a preprogrammed function key or pushbutton on the toolbar. TOP-OF-PAGE DURING LINE-SELECTION event is triggered when first write issued/new page started in the secondary list.
Using the AT LINE-SELECTION event Besides the basic list, up to 20 secondary lists may exist. Sy-lsind is a system variable containing the index of the list currently created. While creating a BASIC LIST, sy-lsind equals 0. Each time an interactive list occurs, the system, automatically increases SY-LSIND by 1. Explain how the code works – refer to on-line program example. How does the user get back to the basic list? >> Press <BACK> green arrow on toolbar What would happen if the Start-of-Selection and At Line-Selection blocks were switched? >> Nothing, Event statements are markers in your program indication what instructions to follow when a certain event is triggered.
The system field SY-LSIND contains the index of the list that your program has just created. The system increases the value in this field by one at the beginning an interactive event. You can differentiate processing for different list levels by querying the contents of this field, for example, with a CASE statement. In the above example, no third details list is generated: If the AT LINE-SELECTION event is triggered in detail list two, then the value of SY-LSIND is set to three, but no WRITE statement is performed because the value three is not taken into account in the CASE statement. This means no details list is generated. Instead, the system sets SY-LSIND back to two, and detail list two is displayed.
Review a program that uses both basic lists and detail lists: The basic list in your program should contain flight data such as carrier ID flight number, departure city and airport, as well as departure and arrival times. This data can be found in the database table SPFLI . The user should be able to access information about any particular flight by double-clicking on a line with a carrier ID and flight number. Flight date and occupancy should be displayed. This data can be found in the database table SFLIGHT . You must use the SPFLI key fields in this detail list in order to read the appropriate data in SFLIGHT . The following slides demonstrate this concept and how it is done.
Using the AT LINE-SELECTION event How was LH 0402 transferred to the secondary list? >> By use of the HIDE statement What is text-001? >> Text element Advantage >> Cannot be shared among programs but can be used to store text which might be reused a lot within your program.
The HIDE command The hide command must come immediately after the Write statement Why? Since the HIDE store information for each output line. You can hide db field not being used/printed in the basic list but will be used/printed in the secondary list.
Using the AT LINE-SELECTION event What would be stored in spfli-deptime? Deptime for last line in basic list.
Valid line selection Why is there a CLEAR SPFLI-CARRID on the last line of the AT LINE-SELECTION event code? >> To prevent user if he/she double-clicks on the secondary list, re-displaying the secondary list again. See textbook for detail explanation.