Académique Documents
Professionnel Documents
Culture Documents
Topics to cover
Introduction
Overview on Screens
Menu Painter
Titlebar
ABAP program for Module Pools - overview
Screen Control with ABAP
Advanced Module Pool Components
Interactive Report
Online Programs
Menu
Screen
Topics to cover
Introduction
Overview on Screens
Menu Painter
Titlebar
ABAP program for Module Pools - overview
Screen Control with ABAP
Advanced Module Pool Components
Module Pool Programming
Screen
User interface, contains various fields to interact with.
Creating Screens
Screens are created by
Screen Painter( Tcode :
SE51).
A screen always belongs
to a program.
Screen Components
Screen Attributes
Screen Layout
Attributes of a Screen
Short Description Enter a short text
for the screen..
Screen type: There are three types of
screens basically:Normal screen : occupies a whole
GUI window.
Attributes of a Screencontinued
Next screen : Enter the screen
number for the next screen in
navigation. If it is zero or blank , the
screen is the last in the screen
sequence . Can be changed at runtime.
Attributes of Screencontinued
Screen group : Four-character ID,
placed in the system field SY-DYNGR
while the screen is being processed.
Allows to assign several screens to a
common screen group , for example, to
modify all of the screens in the group in
a uniform way. Screen groups are stored
in table TFAWT.
Screen Elements
Text field
I/O field
Listbox
Pushbutton
Text Fields
Pushbutton
Triggers the PAI event of the screen flow logic when clicked by
the user. There is a function code attached to each pushbutton,
which is passed to the ABAP program.
Screen Elementscontinued
Box
Radiobutton
Checkbox
Box
CheckBox
Radiobutton
Only one field among more than one related fields can be
selected
Screen Elementscontinued
Tabstrip Control
Subscreen
Table Control
Subscreens
Table Controls
Tabstrip
controls
Screen Elementscontinued
Custom Control
Custom
Control
Status Icons
Program attributes
Display attributes.
When you use table controls, tabstrip controls, or other
controls, there are some special sets of attributes:
Table control attributes
Tabstrip control attributes
Dictionary Attributes
Format :
Data type.
Program Attributes
Input field : Defines an element as an input
field. If the output field attribute is not set, the
data in this element is processed during the
transaction, but not displayed.
Output field : Defines an element as an
output field. Choose this attribute for text
templates that the program can use to display
output. You cannot input data in these
elements unless the input field attribute has
also been set
Output field only : Puts the field input
disabled.
Module Pool Programming
Program Attributescontinued
Required field : The field with this attribute
on is mandatory for an entry .
Right-justified : Right justifies numerical
fields in an element.
Program Attributescontinued
Poss Entr. Button : Specifies whether a
possible entries pushbutton should appear
beside the element.
Program Attributescontinued
Program Attributescontinued
PossEntry : Relevant for Dropdown
listbox. There are two possible entries:
Space : System provides standard help from
domain fixed values,value table,check
table,search help etc. If the input/output field is
linked to a PROCESS ON VALUE REQUEST
module, this takes priority over the automatic
process described above.
Display Attributes
Fixed font : Displays input/output fields
and text fields in a non proportional) font.
To use Fixed font for output templates, you
must also have defined the element as an
output only field.
Bright : Highlights an element.
Invisible : Set this attribute if you want the
element to be invisible.
Display Attributescontinued
As label left/right : Used for input
disabled fields. If this attribute is set, the
text field is linked to the screen element on
its left/right in the same line. At runtime,
the text field appears as a label for that
screen element, that is, it appears to the
left/right of the screen element.
Double-Click sensitive : Makes a screen
element double-click sensitive (hotspot).
You can only set this attribute for text
fields and input/output fields.
If you set this attribute, double-clicking
the element at runtime triggers an action.
Module Pool Programming
All input/output fields have a name linking them to a screen field. The
data type of the screen field determines the input format. The ABAP
program must contain identically-named data objects that correspond to
the screen fields, otherwise data may be lost.
DATA
OKCODE(4).
PBO
Dialog Step
Dialog modules are called from the screen
flow logic (screen command MODULE). A
dialog module is written in an ABAP program
for each state (PBO, PAI; POH,POV) of any
of the screens belonging to it. The PAI
modules of a screen together with the PBO
modules of the subsequent screen form a
dialog step. The interaction between the flow
logic and the screen is controlled by a dialog
processor.
Topics to cover
Introduction
Overview on Screens
Menu Painter
Titlebar
ABAP program for Module Pools - overview
Screen Control with ABAP
Advanced Module Pool Components
Module Pool Programming
Menu Painter
Menu Painter
Menu Painter
Menu Painter
Menubar
Application
Toolbar
Function Key
Assignments
IF SY-DYNNR = 9000.
SET PF-STATUS FIRST.
SET TITLEBAR ONE.
Screen 9001
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
ELSE.
SET PF-STATUS SECOND.
SET TITLEBAR TWO.
ENDIF.
ENDMODULE.
current
SY-DYNNR = screen
number
Screen Type
Normal
Online Status
Screen Type
Dialog Box
TABLES YMOVIE.
DATA
OKCODE(4).
Exit
Edit
Loop
Academy Awards
Year
1994
ENDMODULE.
Category
PIC
ENDMODULE.
Function Types
Function Code
Type
Type E
Type S
Type P
Type T
Choose YES
Application Toolbar
in the Menu Painter
Standard Toolbar in
the Menu Painter
Standard Toolbar
of your program
Application Toolbar
of your program
2nd.
1st.
Click once here. This is where we will
define our first function code.
Adding a Menu
Topics to cover
Introduction
Overview on Screens
Menu Painter
Title Painter
ABAP program for Module Pools - overview
Screen Control with ABAP
Advanced Module Pool Components
Title of a Program
Sets the title of a program in
the titlebar.
Topics to cover
Introduction
Overview on Screens
Menu Painter
Title Painter
ABAP program for Module Pools - overview
Screen Control with ABAP
Advanced Module Pool Components
Top Include
ABAP
PBO Modules
PAI Modules
Subroutines
Module Pool Programming
** SCREEN 9001 **
PROCESS BEFORE OUTPUT.
PROCESS AFTER INPUT.
MODULE UPDATE.
ABAP PROCESSOR
** INCLUDE MZAVGO01
MODULE CLEAR OUTPUT.
...
ENDMODULE.
** INCLUDE MZAVGI01
MODULE CHECK INPUT.
...
ENDMODULE.
MODULE SELECT INPUT.
...
ENDMODULE.
MODULE UPDATE INPUT.
...
ENDMODULE.
phone
215-387-3232
DATA name(10).
Identical
Names
city
DATA num(12).
DATA city(20).
Philadelphia
Philadelphia
PAI
Module Pool Programming
Aaron
PBO module
PAI module
Topics to cover
Introduction
Overview on Screens
Menu Painter
Title Painter
ABAP program for Module Pools - overview
Screen Control with ABAP
Advanced Module Pool Components
Automatic Checks
Values in all
input/output
templates are
checked for
Values in
input/output
templates painted
from the ABAP
Dictionary are
checked for
Proper Format ?
Valid Value ?
Enter
MODULE ONE.
MODULE TWO.
NO
Automatic
Screen Field
Checks OK?
Module ONE
executed.
YES
Module
TWO
executed.
Go to PBO of
next screen
Enter
If a required field is not
entered, the system will
display the error message:
Required entry not made.
Enter
Enter
If the value entered does not exist in the foreign key (check)
table, the system will display the error message: Entry <x>
does not exist (please check your entry).
Enter
If a valid value is not
entered, the system will
display the error message:
Please enter a valid value.
User-Defined Checks
Method #1
Method #2
Method #3
MESSAGE E001.
ENDIF.
ENDMODULE.
Enter
This Flow Logic SELECT statement will retrieve one record. If no record matches,
an error message is issued. The Flow Logic FIELD statement will leave the
YMOVIE-AAYEAR screen field open for input if this error message is issued.
Enter
Module Pool Programming
Enter
This Flow Logic CHAIN and ENDCHAIN group the FIELD statements and the
MODULE statement together. The Flow Logic FIELD statements will leave both
the YMOVIE-AAYEAR and YMOVIE-CATEGORY screen fields open for input if
an error or warning message is issued in the SELECT_LISTING module.
Enter
Module Pool Programming
AT EXIT-COMMAND
Timing of AT EXIT-COMMAND
Type E
Function Code
SCREEN
NO
Module END
executed.
Automatic
Screen Field
Checks
OK?
YES
Module CHECK
executed.
Go to PBO of
next screen
AT EXIT-COMMAND Example
F1 Field Help
If the user chooses the F1 key ,
a help text appears for the field
in which the cursor is currently
positioned.
Data element documentation of a
Dictionary field automatically
comes in the screen .To change
that or to add documentation to
that , choose the screen field and
then do as is directed by this
diagram.
Continued
Enter the documentation in the
SAPScript opened. Save and
activate it.
When the user presses F4 on field <f1> , the module <MOD1> is called
.In the module, U call some relevant function modules that provides the
list of values .
POPUP_WITH_TABLE_DISPLAY
Declare any internal table and
populate it with values which you
want to display on F4 help.
Pass it to this function module.It
returns the index of the row of the
internal table record selected.
Use it to get the selected
information in your screen field.
F4IF_INT_TABLE_VALUE_REQUEST
Declare any internal table and populate it
with values which you want to display on
F4 help.
Pass values to interface parameters as
follows:-
Value_org = S
Value_tab = Internal table containing
records.
Also,populate DYNPROG and DYNPR
with current program name and screen
number.
Dropdown Listbox
Basically an I/O field in which the user can
choose value from a list , but cant enter
anything . Input help button cannot be used
for it .
To convert an I/O field in a screen to listbox,
set the value L or LISTBOX for the
Dropdown field in its attribute window in
the Screen Painter.
1.
2.
3.
4.
Example
Method #1
PBO Module
Method #2
Parameter IDs
Method #3
Hold Data
PBO Module
Screen 9000
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
PBO Module
Execute
transaction
Parameter IDs
AAYEAR Data Element
Parameter ID Memory
Parameter
ID YYR
YYR = <value>
YCT = <value>
CATEGORY Data Element
Paramete
r
ID YCT
This memory is
user and logon
specific
SET/GET
PARAMETER ID
ABAP Statement
OR
SPA/GPA
Field Attributes
ENDMODULE.
SET
GET
YYR = 1994
YCT = PIC
ENDMODULE.
Parameter ID Memory
Notice the
parameter
ID name
Hold Data
System > User profile > Hold data
menu path
Screen Attributes
Short Description
Screen Type
Hold Data
If the user selects the System > User profile > Hold data menu path on a
screen and the screen has been set up for Hold data in the screen
attributes, the values on the screen will be saved by the system for the
next time the user comes to the screen during the current logon.
<f> : Variable name on which the name of the current cursor field is
received
<off> : Cursor position within the screen element .
<lin> : Line number of the table to the variable if the cursor is positioned
in a table control( If not in a table control, <lin> is set to zero)
<val> : Contents of the screen field in display format, with all of its
formatting characters, as a string to the variable <val>.
Cursor Position
YMOVIE-NOTES
** PBO Module **
OR
New Cursor
Position
** PAI Modules **
Screen 9000
LEAVE SCREEN.
...
MODULE INITIALIZE.
ENDMODULE.
MODULE TWO INPUT.
...
ENDMODULE.
MODULE ONE.
MODULE TWO.
Next Screen
attribute is 9000.
Screen 9000
PROCESS AFTER INPUT.
ENDMODULE.
FIELD YMOVIE-AAYEAR
VALUES (BETWEEN 1927 AND 1996).
CHAIN.
When SET SCREEN is encountered,
FIELD: YMOVIE-AAYEAR,
the system temporarily ignores the
YMOVIE-CATEGORY.
value in the Next Screen attribute
MODULE SELECT_LISTING.
and uses the value specified
ENDCHAIN.
instead. The current screens PAI
processing is not terminated.
Next Screen
attribute is 9000.
Screen 9000
PROCESS AFTER INPUT.
ENDMODULE.
FIELD YMOVIE-AAYEAR
VALUES (BETWEEN 1927 AND 1996).
CHAIN.
When LEAVE TO SCREEN is
FIELD: YMOVIE-AAYEAR,
encountered, the system
YMOVIE-CATEGORY.
terminates the current screens
MODULE SELECT_LISTING.
PAI event and immediately goes
ENDCHAIN.
to the PBO event of the screen
specified in the statement.
Update
Academy Awards
Titlebar
Year
Category
Screen 9002 is a
Modal dialog box
type screen with a
dialog box type
GUI status.
Dean
Winner
Notes
Critic
Exit
Enter Name
Screen 9002
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
ENDMODULE.
Significance of SCREEN
SCREEN can be viewed as an internal table, with one record corresponding to
each screen elements in the screen. Different fields of SCREEN describes
various attributes of the screen fields. Some of the significant fields are
described below:Field Name
Significance
Name
Group1,2,3 and
4
Required
Input
Output
Invisible
Intensified
Active
Table Control
Table Control is a screen control for editing and displaying tabular data.
Table controls can be created in a program from two ways:From Data Dictionary
From Internal Table
Topics to cover
Introduction
Overview on Screens
Menu Painter
Title Painter
ABAP program for Module Pools - overview
Screen Control with ABAP
Advanced Module Pool Components
Create a module pool program. Use the structure of the database table to
be used using the TABLES addition. Also, use an internal table of similar
structure to handle the records in the table control.
2.
Create a table control in the screen from the database table( take it from
Dictionary, and not from the program).
3.
PBO
PAI
2.
3.
Program will search for that string in the Description field for all records and
will stop at the first search. The record where the search ends becomes the
first line in the table control.
To-do:1.
In the PAI module, search for the function code of Search pushbutton.
2.
3.
Loop through the internal table to find the search criteria in the second field
for all the records.
4.
Stop on first match and make it the first record of the table control.
Cols is an internal table with total records = total fields in the internal table.
Each field of cols describe the attribute of the fields in the table control.
Subscreens
Main Screen
Subscreen
Steps to follow
1.
2.
3.
Create a Subscreen
Create one subscreen in the same
or different program.
Tabstrip Control
Screen object consisting of two or
more pages.
Each tab page consists of a tab title
and a page area. If the area
occupied by the tabstrip control is
too narrow to display all of the tab
titles, a scrollbar appears, allowing
you to reach the titles that are not
displayed.
There is also a pushbutton that
allows you to display a list of all
tab titles.
Module Pool Programming
At the SAPGui
In the first case, each tab page has its own subscreen. In the second, there
is a single subscreen area that is shared by all tab pages.
Paging in SAPGUI :Separate subscreen areas are assigned to separate tab pages and function
codes of the tab titles are defined with type P(local GUI function) . In
screen flow logic , the subscreens are called in the PBO event. All the tab
pages reside locally at SAPGUI . PAI event is not triggered when the
user selects a tab page . All the input checks for all the subscreens are
performed at same time .
Module Pool Programming
Set function
type = P for
paging in
local Gui
9002-Screen and
PBO
9003-Screen and
PBO
Status Icon