0% found this document useful (0 votes)
29 views25 pages

Contents:: Screen Objects

delta sap 7

Uploaded by

Monica Paez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views25 pages

Contents:: Screen Objects

delta sap 7

Uploaded by

Monica Paez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 25

0

Screen Objects

Contents:
 Subscreens on the Selection Screen
 Tabstrips on the Selection Screen
 Context Menu

 SAP AG 1999

© SAP AG D446AW 7-1


0.2
Screen Objects: Objectives

At the conclusion of this unit, you will be able to:

 Declare and CALL multiple Selection Screens


 Define subscreens on a Selection Screen
 Define and process a Tabstrip Control
 Use tabstrips on a Selection Screen
 Define and Process a Context Menu

 SAP AG 1999

© SAP AG D446AW 7-2


0.3
Screen Objects: Overview

Good Bye
Enhancements
and Modifications
1 12 1 Course Overview

BAPIs
1
New Concepts
0
9 1

2 3
News in ABAP
ABAP Objects Workbench

ABAP Language

4
Graphical Query
8

Tools
7 5
Screen Objects 6 Logical Databases
ABAP Dictionary

 SAP AG 1999

© SAP AG D446AW 7-3


0.4
Screen Element: Tabstrip Control

An easy way to present


information that
belongs together logically

From To Info

Country DE
 Displays various components
City Berlin
of an application on a single
Airport TXL screen and allows the user
Time 10:10:00 to navigate between the
components
 Container for other screen
objects

 SAP AG 1999

 Tabstrip controls provide you with an easy, user-friendly way of displaying different components of
an application on a single screen and allowing the user to navigate between them. Their intuitive
design makes navigation much easier for end users.
 Tabstrip controls are a useful way of simplifying complex applications. You can use tabstrip
controls wherever you have different components of an application that form a logical unit. For
example, you might have a set of header data which remains constant, while underneath it, you want
to display various other sets of data.
 You should not use tabstrip controls if
You need to change the screen environment (menus, pushbuttons, header data, and so on) while
processing the application components. The screen surrounding the tabstrip must remain
constant.
The components must be processed in a certain order. Tabstrips are designed to allow users to
navigate freely between components.
The components are processed dynamically, that is, if user input on one tab page leads to other
tab pages suddenly appearing.
 Tabstrip controls are compatible with batch input processing.

© SAP AG D446AW 7-4


0.5
Tab Page: Technical View

Pushbutton
Pushbutton
Text
Text

+
Text
Subscreen
= area
CONTENTS

+
Contents
=
Subscreen
screen

 SAP AG 1999

 A tab page consists of a tab title, a subscreen area, and a subscreen.


 From a technical point of view, the system handles tab titles like pushbuttons.
 The contents of tab pages are displayed using the subscreen technique. You assign a subscreen area
to each tab page, for which you can then call a subscreen.

© SAP AG D446AW 7-5


0.6
Tabstrip Control on the Selection Screen

Subscreen I Subscreen II Subscreen III

User-friendly design for


Connection Flight Booking large selection screens

Airline LH Logical field groupings

Flight No. 0400 0402

 SAP AG 1999

 You can now create tabstrip controls on selection screens. They allow you to create logical groups
of fields, and make large selection screens more user-friendly.

 The following requirements must be met if you are to use selection screens with tabstrip controls in
your R/3 System:

 GUI version 4.0 or higher

 Frontend: Motif, Windows 95, MacOs, NT 3.51 or higher.

 For a selection screen with tabstrips, you must define:

 A subscreen area on the selection screen to accommodate the tabstrip control

 The individual tab titles

 Selection screens as subscreens for the individual tab pages

© SAP AG D446AW 7-6


0.7
Selection Screens as Subscreens

TABLES: SPFLI. ABAP

SELECTION-SCREEN BEGIN OF SCREEN 101 AS


AS SUBSCREEN
SUBSCREEN.
SELECT-OPTIONS: s_carr FOR spfli-carrid,
s_conn FOR spfli-connid.
SELECTION-SCREEN END OF SCREEN 101.

SELECTION-SCREEN BEGIN OF SCREEN 102 AS SUBSCREEN


SUBSCREEN.
SELECT-OPTIONS: ...
PARAMETERS: ...
SELECTION-SCREEN END OF SCREEN 102.

SELECTION-SCREEN BEGIN OF SCREEN 103 AS


AS SUBSCREEN
SUBSCREEN.
PARAMETERS: ...
SELECT-OPTIONS: ...
SELECTION-SCREEN END OF SCREEN 103.

Subscreen 101 Subscreen 102 Subscreen 103

 SAP AG 1999

 Since it is possible to define selection screens as subscreens, you can include selection fields that you
create in this way in any other screens. Selection screens as subscreens are processed similarly to
other screens.

 You define a selection screen as a subscreen as follows:


SELECTION-SCREEN BEGIN OF SCREEN <scrn> AS SUBSCREEN
[NESTING LEVEL <m>] [NO INTERVALS].
...
SELECTION-SCREEN END OF SCREEN <scrn>.
Optional additions: [NESTING LEVEL <m>]. Each box around a tabstrip control increases the
NESTING LEVEL by one.
[NO INTERVALS]. This option hides the HIGH fields for any selection
criteria defined using SELECT-OPTIONS on the screen.

© SAP AG D446AW 7-7


0.8
Defining A Tabstrip Control on the Selection
Screen
ABAP
SELECTION-SCREEN BEGIN OF SCREEN 101 AS SUBSCREEN.
...
SELECTION-SCREEN END OF SCREEN 101.
SELECTION-SCREEN BEGIN OF SCREEN 102 AS SUBSCREEN.
...
SELECTION-SCREEN END OF SCREEN 102.

SELECTION-SCREEN
SELECTION-SCREEN BEGIN
BEGIN OF
OF TABBED
TABBED BLOCK
BLOCK blockname
blockname FOR
FOR nn LINES.
LINES.
SELECTION-SCREEN
SELECTION-SCREEN TAB
TAB (length
( length)
(length)) tabname1
tabname1 USER-COMMAND
USER-COMMAND ucomm1
ucomm1 DEFAULT
DEFAULT SCREEN
SCREEN 101.
SELECTION-SCREEN
SELECTION-SCREEN TAB
TAB (length
( length)
(length)) tabname2
tabname2 USER-COMMAND
USER-COMMAND ucomm2
ucomm2 DEFAULT
DEFAULT SCREEN
SCREEN 102.
SELECTION-SCREEN
SELECTION-SCREEN END
END OF
OF BLOCK
BLOCK blockname.
blockname.
blockname .

INITIALIZATION.
INITIALIZATION.
tabname1= =TEXT-001.
tabname1 TEXT-001. "TEXT-001DE:
"TEXT-001 EN:Verbindung
Connection
tabname2==TEXT-002.
tabname2 TEXT-002. "TEXT-002 DE:
"TEXT-002 EN:Flug
Flight

.
Connection Flight

Airline
Flight No.

 SAP AG 1999

 You define a subscreen area for a tabstrip control on a selection screen as follows: SELECTION-
SCREEN BEGIN OF TABBED BLOCK <blockname> FOR <n> LINES.
SELECTION-SCREEN END OF BLOCK <blockname>.
The size of the subscreen area in lines is defined by <n>.

 The system automatically generates a CONTROLS statement (CONTROLS:


TABSTRIP_BLOCKNAME TYPE TABSTRIP.) You must not write your own CONTROLS
statement. If you try to do so, a syntax error results.

 You define the individual tab pages as follows:


SELECTION-SCREEN TAB (length) <name> USER-COMMAND <ucomm> [DEFAULT
[PROGRAM <prog>/SCREEN <dynnr>]].
Optional additions: [DEFAULT [PROGRAM <prog>/SCREEN <dynnr>]].
Assign the selection screen to a tab page. If you use the DEFAULT addition, you must also use the
SCREEN addition. The PROGRAM addition is optional. You only need it if the screen comes from
another program.

 You can delay specifying the link between the tab title and the selection screen until runtime. You
can also change an existing assignment at runtime. To do this, fill the structure blockname. This is
created automatically for every tabstrip block. The structure has the same name as the tabstrip block,
and contains the fields PROG, DYNNR, and ACTIVETAB. For further information, refer to the online
documentation in appendix reference SUB-2.

© SAP AG D446AW 7-8


0.9
Interfaces

Contents:
 Creating interfaces using the Menu Painter
 Titles
 Menu bars
 Standard toolbars and
 Application toolbars

 SAP AG 1999

© SAP AG D446AW 7-9


0.10
Overview: Screen Objects

Flight master data Edit Goto System Help

GUI title
SET TITLEBAR <n>.

Menu bar GUI status


Help F1
Standard toolbar SET PF-STATUS <n>.
Choose F2
Back F3
Application toolbar
. Key settings
.
.

 SAP AG 1999

 All user interfaces include the following tools/objects:


 A title bar containing the title of the screen, selection screen, or list currently being displayed,
 A menu bar with expandable menus,
 Menus containing the executable functions for the current program. Menus can also contain
submenus. The menus 'System' and 'Help' can be found on every screen in R/3 and always contain
the same functions. Neither of these menus may be changed or hidden.
 A standard toolbar containing icons for those functions most often used. The R/3 standard toolbar
always contains the same icons with standard functions assigned to them. Those standard functions
that cannot be accessed from a particular interface are grayed out.
 Function key settings, which can be displayed by clicking on your right mouse button. Ideally, you
should be able to execute all menu functions by way of function keys as well.
 An application toolbar containing icons and pushbuttons for those functions most often used on the
current screen.
 Each program is created with an interface containing all of the objects listed above. Different views
of this interface (GUI statuses) are then created for a program's individual screens, selection screens,
and lists.

© SAP AG D446AW 7-10


0.11
Creating GUI Statuses for Lists

START-OF-SELECTION.

SET PF-STATUS 'LIST' Dou.


ble
Create object -Cli
ck

GUI status The status LIST does not exist.


Do you want to create the object?
Create Status
Yes No Cancel
Program xxxxx
Status LIST
Status attributes
Short text Status for flight list
Status type
Dialog status
Dialog box
Context menu

 SAP AG 1999

 You can create and maintain statuses in one of three different ways:
 By using the object list of the Object Navigator
 By using forward navigation in the ABAP Editor,
 By directly using the Menu Painter.
 When creating a status you can either create a new menu bar, application toolbar, and new key
settings yourself (top down), or use existing objects for your interface (bottom up), or a use
combination of both methods.
 Status names can have a maximum of 20 characters. (Letters must be upper-case).
 By choosing a status type, you determine whether a status refers to a normal screen or a dialog box.
According to what you have choosen, different types of functions are put at your disposal.
 Use the statement SET PF-STATUS '<NAME>' to set the status of the basic list by programming
it into one of the processing blocks that are processed before the basic list is sent.

© SAP AG D446AW 7-11


0.12
A d ju s tin g S ta tu s e s

A d ju s t s ta tu s te m p la te

In c lu d e t e m p la t e in
U s e r -O r ie n te d
S ta tu s B A S E
D e s ig n
S t a t u s t e m p la te .. .

L is t s ta tu s
S e le c tio n S c r e e n
...

M e n u b a rs L in e s e le c tio n lis t

L is t E d it G o to

A p p lic a tio n to o lb a r
K e y s e ttin g s L in e s e le c tio n lis t

 SAP AG 1999

 The 'Adjust template' function found in the Extras menu allows you to include standardized
function codes in your status. This function further allows you to include objects from a status of
your choice with the existing status. This allows you to choose norms for list statuses and selection
screens or use any other status you want from another ABAP program.

© SAP AG D446AW 7-12


0.13
Context Menus

Screen: Area of Encapsulation of a Context Menu


List Edit Goto Extras Envir. System Help

Screen area

Box Subscreen area Subscreen area

Box in the box


Area in the box

Elements that do not have their


own menu inherit the area menu

 SAP AG 1999

 Context menus (right mouse key, SHIFT F10) are shortcuts for functions that are frequently used.

 They can be used to display context-sensitive menus. The context is defined by the position (cursor
for SHIFT F10, mouse location for right mouse key) where the user called the context menu. If
needed, you can specify the context more precisely with the displayed contents. This permits the user
to select functions that are relevant for the current context using the context menu.

 You define whether a context menu should be offered when you create a screen object (screens,
input fields, table controls, boxes, ...). When the user selects a context menu on an object, an event
mechanism (as understood by ABAP objects) calls a certain subroutine in the application program.
The program is assigned a menu reference. The program uses this menu reference to build the
display menu. Menus defined with the Menu Painter and dynamic menus can be used here.
After the user executes a menu function, the application program regains control and can react to the
user input.

 Context menus are assigned to output fields. When you assign a context menu to a box, table control
or screen (normal or subscreen), all the subordinate output fields that do not have a context menu
inherit that one.

© SAP AG D446AW 7-13


0.14
Creating a Context Menu

Object
Object
Navigator
Navigator
<Program name>

Program object types


Fields Create
GUI status
BASE
BOOK
STATUS_100 Create Status

Program xxxxx

Status SUB130

Status attribute
Short text Table Control Subscreen
Status type
Dialog status
Dialog box
Context menu

 SAP AG 1999

 You can create a context menu from within the object list of the Object Navigator. Position the
cursor on GUI status and right-click. The Object Navigator automatically opens the Menu Painter.
 Of course you can also create a context menu directly in the Menu Painter.
 A context menu is a special GUI status. Assign it a name, a descriptive text and status type Context
menu.

© SAP AG D446AW 7-14


0.15
Creating a Context Menu: Assigning Functions

Context menu Context Menu for the Table Control Subscreen

Context menu

Code Text
Sort > SRTD Descending
SRTU Ascending
LIST Booking list

F4
Function list
M
M 11
M
M 11 M
M 11
BACK M
M 11 M
M 11
BACK
EXIT
EXIT ...
...
INFO
INFO DETL
DETL
 SAP AG 1999

 In a context menu you can link any function codes and function texts. In particular, you can take
advantage of your screen pushbuttons. The functions already provided in the interface can be used as
an F4 input help.
 The link technique ensures consistent context menus in large applications.
 You should observe the following rules when designing context menus.
 Do not use any functions that cannot be found elsewhere in the system (pushbuttons or interface).
 Avoid using more than two hierarchy levels in context menus.
 Do not use more than 10 entries, but map all the available pushbuttons.
 Use separators to structure the context menu optically.
 Place object-specific statements at the beginning of the menu.

© SAP AG D446AW 7-15


0.16
Linking Screen Objects

*-------------------------------
*** INCLUDE SAPBC410CONDF01
*-------------------------------
Screen Painter
...
Object Attributes
FORM on_ctmenu_rbgframe
Context Menu Form USING p_menu TYPE REF TO cl_ctmenu.
...
ON_CTMENU_ RBGFRAME ENDFORM.

...
Screen Attributes
FORM on_ctmenu_sub130
General Attributes USING p_menu TYPE REF TO cl_ctmenu.
...
Context Menu Form ENDFORM.
ON_CTMENU_ SUB130

ABAP
 SAP AG 1999

 Pressing the right mouse key triggers a callback routine in your program. You can create this
callback routine in your application program with forward navigation. It is named
ON_CTMENU_<name>. You define which callback routine is called in the Screen Painter.
 You can directly assign a callback routine to input/output fields, text fields and status icons.
Checkboxes, radio buttons and pushbuttons do not have their own callback routines. However, these
fields can inherit context menus from boxes or screens.
 If you assign a callback routine to a table control, it is triggered for all the fields of the table control
that do not have their own callback routine.
 The callback routine has the following form:

FORM ON_CTMENU_<name> USING p_menu TYPE REF TO cl_ctmenu.


<definition of the context menu>.
ENDFORM.
 The context menu is built with a method call for the instance of class cl_ctmenu that was passed.

© SAP AG D446AW 7-16


0.17
Using the Context Menu

Right mouse key

Flight Flight

FORM on_ctmenu_sub130
USING p_menu TYPE REF TO cl_ctmenu.

CALL METHOD cl_ctmenu=>load_gui_status


EXPORTING program = sy-cprog
status = 'SUB130'
menu = p_menu.

ENDFORM.
 SAP AG 1999
ABAP

 Clicking with the right mouse key on an output field triggers the corresponding callback routine.
 You can now use the static method load_gui_status of class cl_ctmenu to load a context
menu that was predefined in the Menu Painter. Using other methods of class cl_ctmenu (see next
slide) you can also completely rebuild the context menu or modify a loaded menu.
 If the user triggers a function in the context menu, the corresponding function code is placed in the
command field and triggered depending on function type PAI of the screen.

© SAP AG D446AW 7-17


0.18
Modifying Context Menus Dynamically

CALL METHOD <instance>-><name> EXPORTING ... .

Method Meaning
ADD_FUNCTION Add a function

ADD_SEPARATOR Add a separator

HIDE_FUNCTIONS Hide functions

SHOW_FUNCTIONS Show functions

DISABLE_FUNCTIONS Disable functions

ENABLE_FUNCTIONS Enable functions

 SAP AG 1999

 The class cl_ctmenu provides a number of other methods in addition to the static method
load_gui_status. You can use them to adjust the context menu at runtime (e.g. using the
values in data fields).
 The corresponding methods are called within the callback routine.
 You can find further information in the documentation for class cl_ctmenu in the Class Builder.

© SAP AG D446AW 7-18


0.19
Input Help

Airline Lufthansa
Lauda Air
Delta Airlines

Flight date 09.09.1999

Airline: LH
Connection number 0400

Flight date
F4
09/09/1999
10/10/1999
11/29/1999
12/02/1999
12/19/1999
12/21/1999

 SAP AG 1999

 You can help the user with input by using dropdown list boxes containing the possible entries.
 Input help (F4 help) is a standard function in the R/3 System. It allows the user to display a list of
possible entries for a screen field. If the field is ready for input, the user can place a value in it by
selecting it from the list.
 If a field has input help, the possible entries button appears on its right hand side. The button is
visible whenever the cursor is placed in the field. You can start the help either by clicking the button
or choosing F4.
 As well as the possible entries, the input help displays relevant additional information about the
entries. This is especially useful when the field requires a formal key.
 Since the input help is a standard function, it should have the same appearance and behavior
throughout the system. There are utilities in the ABAP Workbench that allow you to assign
standardized input help to a screen field.
 The precise description of the input help of a field usually arises from its semantics. Consequently,
input help is usually defined in the ABAP Dictionary.

© SAP AG D446AW 7-19


0.20
Dropdown List Boxes

Screen Painter ABAP Dictionary


Layout Editor
Structure: SDYN_CONN
Field name Input help
CARRID ... using check table

Object Attributes ...


Object name SDYN_CONN-CARRID
text
SCARR
Dropdown List box
CarrID Carrname
Program Attributes

Value list

 SAP AG 1999

 Dropdown list boxes allow the user to choose an entry from a pull-down list containing the possible
entries. The user cannot enter values freely, but must choose a value from the list.

 To create a dropdown list box for an input field, you must do the following in the Screen Painter:
 Set the Dropdown attribute to list box.
 Change the visLength attribute to the displayed length of the descriptive text.
 Set the Value list attribute to ' ' to use value help from the ABAP Dictionary.
 If required, set the function code for the selection. Like a menu entry, this function code triggers
the PAI, and you can interpret it using the OK_CODE field.
 Important: The visible length of the field determines the width of the field (including button) and
the selection list, and you must normally change it when you convert the field to a dropdown box.

 The values are filled automatically using the search help assigned to the ABAP Dictionary field. The
Dictionary field must have a search help (check table) with two columns or a table of fixed values.

© SAP AG D446AW 7-20


0.21
Using Search Helps

Search help
Internal behavior

Interface

Connection
in Dict.
Input screen
F4
Field 1 Search field Field 3 ...
Field 1 Table/structure

Search field

Field 3 Definitions in
Screen Painter
 SAP AG 1999

 A search help describes the process of an input help. In order for it to work, we need a mechanism
that assigns the search help to the field. This is called the search help connection.
 Connecting a search help to a field affects its behavior. It is therefore regarded as part of the field
definition.
 The semantic and technical attributes of a screen field (type, length, F1 help) are normally not
defined directly when you define the screen. Normally, you use a reference in the Screen Painter to
an existing field in the ABAP Dictionary. The screen field then inherits the attributes of the ABAP
Dictionary field.
The same principle applies when you define input help for a screen field. The link between the
search help and the search field is established using the ABAP Dictionary field, not the screen field.
 When you assign a search help, its interface parameters are asssigned to the screen fields that are
filled by the search help, or which pass information to it from the screen. The search field must be
assigned to an EXPORT parameter of the search help. You should also make the search field an
IMPORT parameter, so that the search help can take into account a search pattern already entered in
the field by the user.
 A field can have input help even if it does not have a search help - there are other mechanisms for F4
help (for example, fixed values for a domain).

© SAP AG D446AW 7-21


0.22
Screen Objects: Summary

You are now able to:


 Declare and CALL multiple Selection Screens
 Define subscreens on a Selection Screen
 Define and process a Tabstrip Control
 Use tabstrips on a Selection Screen
 Define and Process a Context Menu

 SAP AG 1999

© SAP AG D446AW 7-22


Exercises

Unit: Screen Objects


Theme: Creating and Using a Context Menu

 At the conclusion of these exercises, you will be able to:


 Use context menus in your programs.

 Make the functions for your table control available in a context menu.

 Create a GUI status with type context menu and use it for the output fields on screen 130.
 Copy the model template SAPD346AWT_TABLE_CONTROL3). You can use the
model solution SAPD346AWS_CONTEXTMENU for orientation.

 Create the GUI status sub130 with type context menu and the short description Table
control subscreen. Assign the following functions to the menu:

 Context  Function code:  Function text


menu SELE Select all
DSELE Deselect all
DELE Delete line
SRTU Sort ascending
SRTD Sort descending
 Separator
P- - First page
P- Previous page
P+ Next page
P+ + Last page

© SAP AG D446AW 7-23


 Assign function type ‘ ’ (space) to all of the functions. Deactivate the
function DELE.
 In the screen attributes of 130, declare that you want to use subroutine on_ctmenu_sub130
to create the context menu.
 Write the subroutine to create the context menu.
 Additional task:
Activate the DELE function at runtime if the user is in booking maintenance mode. Note
that you must pass the function code to the method in a table with type ui_functions.

Note: If you do not have development class D346AW available, use


template SAPBC410TABS_TABLE_CONTROL3 and model
solution SAPBC410CONS_CONTEXTMENU.

© SAP AG D446AW 7-24


Solution
Unit: Screen Objects
Theme: Creating and Using a Context Menu

Model solution: SAPD346AWS_CONTEXTMENU


Add the coding in bold type to your program, and create the subroutine.
----------------------------------------------------------------------------------------------------------------
Subroutine include

*&-----------------------------------------------------------------*
*& Form ON_CTMENU_SUB130
*&-----------------------------------------------------------------*
FORM on_ctmenu_sub130 USING p_menu TYPE REF TO cl_ctmenu.
data fcodes type ui_functions.
load of the context menu defined in the menu painter

CALL METHOD cl_ctmenu=>load_gui_status


EXPORTING program = sy-cprog
status = 'SUB130'
menu = p_menu.

activate DELE for deleting bookings in maintain booking mode


CHECK NOT maintain_bookings IS INITIAL.
append 'DELE' to fcodes.
CALL METHOD p_menu->enable_functions EXPORTING fcodes = fcodes.

ENDFORM. " ON_CTMENU_SUB130

© SAP AG D446AW 7-25

You might also like