Lecture 9 Reporting – Interactive (A) BCO5647 Applications Programming Techniques (ABAP)
Readings & Objectives <ul><li>Readings </li></ul><ul><li>Keller & Keller   Chapter 7 Section 7.3.6 & 7.3.7    </li></ul><u...
Interactive Reporting: Overview <ul><li>A simple list can have an interactive or “drill-down” capability added where more ...
Interactive Reporting: Overview <ul><li>Interactive reporting allows you to create secondary lists and windows. To display...
Events <ul><li>ABAP is an event-driven programming language. </li></ul><ul><li>Event statements are markers in your progra...
Using the AT LINE-SELECTION event <ul><li>Simple Example: report lec701a. start-of-selection.   write: / ‘basic list’.   w...
Using the AT LINE-SELECTION event
Example: Interactive Report
Using the AT LINE-SELECTION event
The HIDE area <ul><li>The  Hide  statement allows you to store the field contents for a particular list line in a special ...
Using the AT LINE-SELECTION event <ul><li>As soon as the user selects a line by double-clicking, the system passes the val...
Valid Line Selection <ul><li>In the example above, one field (spfli-carrid) whose contents is stored in the Hide area is s...
Upcoming SlideShare
Loading in …5
×

Lecture09 abap on line

1,393 views
1,311 views

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,393
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
172
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • 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? &gt;&gt; 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. &gt;&gt; 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? &gt;&gt; Press &lt;BACK&gt; green arrow on toolbar What would happen if the Start-of-Selection and At Line-Selection blocks were switched? &gt;&gt; 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? &gt;&gt; By use of the HIDE statement What is text-001? &gt;&gt; Text element Advantage &gt;&gt; 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? &gt;&gt; To prevent user if he/she double-clicks on the secondary list, re-displaying the secondary list again. See textbook for detail explanation.
  • Lecture09 abap on line

    1. 1. Lecture 9 Reporting – Interactive (A) BCO5647 Applications Programming Techniques (ABAP)
    2. 2. Readings & Objectives <ul><li>Readings </li></ul><ul><li>Keller & Keller Chapter 7 Section 7.3.6 & 7.3.7 </li></ul><ul><li>Objectives This lecture will </li></ul><ul><li>Introduce basic concepts of interactive reporting </li></ul><ul><li>Introduce interactive event statements </li></ul><ul><li>Examine AT LINE-SELECTION event statement in reference to interactive reports </li></ul><ul><li>Introduce the HIDE command and examine how it is used in interactive reports </li></ul><ul><li>Examine techniques to ensure valid line selection in interactive reports </li></ul>
    3. 3. Interactive Reporting: Overview <ul><li>A simple list can have an interactive or “drill-down” capability added where more detail can be displayed related to a line on the original list. </li></ul><ul><li>LH 0012 BERLIN NEW YORK </li></ul><ul><li>LH 0023 LONDON BERLIN </li></ul><ul><li>Flights Dates Available </li></ul><ul><li>for LH 0023 </li></ul><ul><li>29.10.2006 </li></ul><ul><li>12.11.2006 </li></ul><ul><li>11.12.2006 </li></ul><ul><li>12 SEATS AVAILABLE </li></ul><ul><li>for LH 0023 on 12.11.2006 </li></ul>Drill-Down Drill-Down
    4. 4. Interactive Reporting: Overview <ul><li>Interactive reporting allows you to create secondary lists and windows. To display these on the screen you use function keys, pushbuttons and double-clicks. </li></ul><ul><li>Using function keys the user can also branch to a transaction or another report program. </li></ul>
    5. 5. Events <ul><li>ABAP is an event-driven programming language. </li></ul><ul><li>Event statements are markers in your program code that define when the code associated with an event should run. </li></ul>New Event statement LOAD-OF-PROGRAM
    6. 6. Using the AT LINE-SELECTION event <ul><li>Simple Example: report lec701a. start-of-selection. write: / ‘basic list’. write: / sy-lsind. at line-selection. write: / ‘secondary list after double-click’. write: / sy-lsind color 4. </li></ul>
    7. 7. Using the AT LINE-SELECTION event
    8. 8. Example: Interactive Report
    9. 9. Using the AT LINE-SELECTION event
    10. 10. The HIDE area <ul><li>The Hide statement allows you to store the field contents for a particular list line in a special memory area. </li></ul><ul><li>For each field in the Hide statement, the system stores the field name and value. </li></ul>
    11. 11. Using the AT LINE-SELECTION event <ul><li>As soon as the user selects a line by double-clicking, the system passes the values stored for this line in the HIDE area back into the original fields. </li></ul>
    12. 12. Valid Line Selection <ul><li>In the example above, one field (spfli-carrid) whose contents is stored in the Hide area is set to the initial value. </li></ul><ul><li>When the user selects an invalid line, the system cannot find a corresponding value in the Hide area. </li></ul><ul><li>When the CHECK statement produces a negative result, the system leaves the current processing block without producing a secondary list. </li></ul>

    ×