Lecture 10 Reporting – Interactive (B) BCO5647 Applications Programming Techniques (ABAP)
Nov 07, 2014
Lecture 10Reporting – Interactive (B)
BCO5647 Applications Programming Techniques (ABAP)
2BCO5647
Readings & Objectives
Readings
Keller & Keller Chapter 7Section 7.3.6 & 7.3.7
Objectives
This lecture will
Introduce the WINDOW Statement and its application in interactivereporting
Introduce the concept of user interfaces and their customisation
Examine the GUI status and how it is defined using the MENU PAINTER in the ABAP Development Workbench
Introduce the AT USER COMMAND and examine how it is used ininteractive reports
Examine how titles are defined for interactive reports
3BCO5647
The Window Statement
You can display a secondary list in a window (modal dialog box) instead of the full screen by using the window statement.
4BCO5647
The Windows Statement
Example
report ylec700.
start-of-selection.
write ‘Double-click line for
demonstration of windows’.
at line-selection.
if sy-lsind = 1.
window starting at 5 3
ending at 40 10.
write ‘Double-click line for a second window’.
elseif sy-lsind = 2.
window starting at 45 10
ending at 60 12.
write ‘Second window’.
endif.
5BCO5647
User Interfaces
A user interface consists of the following: A title bar containing the title of the screen. A menu bar with drop-down menus. A standard toolbar containing icons for those functions most often used. A application toolbar containing icons and pushbuttons for functions used on the current
screen. Function key settings, which can be displayed by clicking your right mouse button.
These objects can be customised in ABAP by using: SET TITLEBAR <n> to set a title SET PF-STATUS <n> to customise the menu bar, toolbars and/or function key settings
6BCO5647
Using a GUI Status
You can define a GUI Status to add menu entries, toolbar buttons and/or function key settings.
Each menu function, push button, or function key has an associatedfunction code.
When you create a status, you can define menu entries, toolbar buttons and/or function key settings and then LINK them to FUNCTION CODES you define.
When the user presses a function key, menu item or toolbar button, the event AT USER COMMAND occurs and the associated function code is stored in the system variable SY-UCOMM.
7BCO5647
Using A GUI Status
Simple Example:
report lec701.start-of-selection. set pf-status ‘TEST’. write: / ‘Basic List’.
at user-command. case sy-ucomm.
when ‘TST1’.
write ‘Test List 1’.
when ‘TST2’.
write ‘Test List 2’.
endcase.
8BCO5647
Defining a Status
To define the status (GUI status) of a user interface you use the MENU PAINTER. The Menu Painter is one of the tools of the ABAP Development Workbench.
There are three ways to create a status: from the object list in the Object Navigator; From the Menu Painter; or by forward navigation from the ABAP Editor. (recommended)
9BCO5647
Defining a Status
report lec701.start-of-selection.set pf-status ‘TEST’. write: / ‘Basic List’.at user-command. case sy-ucomm.
when ‘TST1’.
write ‘Test List 1’.
when ‘TST2’.
write ‘Test List 2’.
endcase.
For the above program, define a status TEST in the Menu Painter and:
Define the function code TST1 as a pushbutton labeled “Test1”.
Assign function code TST1 to function key F5
Define the function code TST2 as a pushbutton labeled “Test2”.
Assign function code TST2 to function key F6
10BCO5647
Defining a Status – Menu Painter
Define the function code TST1 as a pushbutton labeled “Test1”.Define the function code TST2 as a pushbutton labeled “Test2”.
Assign function code TST1 to function key F5Assign function code TST2 to function key F6
11BCO5647
Defining a Status
After ACTIVATING and saving the status then executing the program, the basic list appears as:
The user can trigger the AT USER-COMMAND event either by:
Pressing Function keys F5 or F6.
Clicking the “Test 1” or “Test 2” pushbuttons.
12BCO5647
Applying a Status
Using SET PF-STATUS, you can display different user interfaces for different list levels to provide the user with different functions.
CARR BOOK FLIG
STATUS: CARRIER STATUS: BOOKING STATUS: FLIGHT
STATUS: BOOKING2 STATUS: FLIGHT2
13BCO5647
Applying a Status
Sample Program
report ylec702.
end-of-selection.
set pf-status ‘BASE’.
at user-command.
case sy-ucomm.
when ‘BOOK’.
set pf-status ‘BOOKING’.
when ‘FLI2’.
set pf-status ‘FLIGHT2’.
endcase.
top-of-page during line-selection.
case sy-pfkey.
when ‘BOOKING’.
14BCO5647
Defining Titles for Interactive Reports
To set a title for basic or secondary lists, use:
SET TITLEBAR <title> [WITH g1…g9]
There are three ways to create a Title: from the object list in the Objet Navigator; from the Menu Painter; or by forward navigation from the ABAP Editor. (recommended)
15BCO5647
Defining Titles for Interactive Reports
You can specify up to 9 placeholders &1…&9 in a title.
The placeholders are replaced at runtime by the field names after the WITH option.
Example:
report ylec703.start-of-selection.write ‘Click me!’ hotspot color 5 inverse on.at line-selection. set titlebar ‘TST’ with sy-lsind. write ‘Click again’ hotspot color 5 inverse on.
This program sets a new title for each secondary list.