13.8    Practice

Learning is all about putting theory into practice. The following practice examples should help you explore classical lists (list screens):

  1. An END-OF-PAGE event is triggered when the page is filled. For example, if you have set the line count as 10 (2), it means the total number of lines per page is ten, out of which two lines are reserved for the footer. Therefore, the system will trigger the END-OF-PAGE event after printing eight lines on the page. However, if the page isn’t filled, the END-OF-PAGE event isn’t triggered. For example, if you’ve set the line count as 10 (2) but only six lines are printed in the output, then END-OF-PAGE isn’t triggered.
    The code in
    Listing 13.13 doesn’t trigger the END-OF-PAGE event. For this practice example, modify the code (without printing extra lines) in such a way as to trigger the END-OF-PAGE event even if the page isn’t filled.
    REPORT ZDEMO_LIST LINE-COUNT 12(2).
    START-OF-SELECTION.
    DO 6 TIMES.
    WRITE : / 'Demo on end-of-page'.
    ENDDO.
    END-OF-SELECTION.
    WRITE 'END-OF-PAGE event is executed'.

    Listing 13.13    Code for Exercise 1

    Hints
    • Find out how many lines are printed and calculate the difference by checking a system field that gives the line count. Use the SKIP statement to print blank lines.
    • Explore the RESERVE keyword.
  2. Create a basic list and multiple detail lists. For example, when you double-click a line in the basic list, it should open a detail list (use the WRITE statement in the AT LINE-SELECTION event to print some dummy data). When you double-click a line in the detail list, it should open a new detail list. Double-clicking a line in this list should open further detail lists. For example, say you’ve opened five detail lists. When you click the Back button on the fifth detail list, it will take you to the fourth detail list. Clicking the Back button on the fourth detail list will take you to the third detail list and so on, until you reach the basic list.
    For this exercise, find out how you can reach the basic list directly when you click on any detail list in the system.
    Hint

    Explore the sy-lsind system field.

  3. Discover how to print icons on the list screen. We can print different icons to display the status of a record when displaying records in the output. Figure 13.12 shows a green light icon in the first column of the record to signify that the record is processed successfully. For this exercise, find out how to print icons as shown in Figure 13.12.
    Icon Displayed in Output

    Figure 13.12    Icon Displayed in Output

    HINT

    Explore all the additions for the WRITE statement.