Professional Documents
Culture Documents
17 Kaavian Dialog Programming
17 Kaavian Dialog Programming
02-Sep-09
Kaavian Systems
Transactions
A Transaction is a program that conducts a
dialog with the User
In a typical dialog, the system displays the screen
on which the user
information.
As per the user input or request, transaction is
used to
- Branch to the next Screen
- Display an output
- Change/Update the database
02-Sep-09
Kaavian Systems
Central Components of a
Program
ABAP/4 Screen
Dictionary Painter
ABAP/4
Editor
Menu
Painter
Runtime environment
Online processor
02-Sep-09
ABAP/4 Processor
Kaavian Systems
Components
Structure of the Dialog Programming
Screen Painter
Menu Painter
Input Checks
Error Handling
Flow Logic
Screen Modification
Table Control
Tab strip
02-Sep-09
Kaavian Systems
Dictionary Structure
Global Data
PBO Modules
PAI Modules
Subroutines
Screens
GUI Status
Transaction Code
02-Sep-09
Kaavian Systems
Screen Attributes
Screen Elements
Screen Fields
02-Sep-09
Kaavian Systems
Screen Attributes
Program (type M)
Screen Number :
A four-digit number, unique within the ABAP
program, that identifies
the screen within the program.
Screen Type:
A normal screen occupies a whole GUI window.
Modal dialog boxes only cover a part of a GUI window. A
subscreen is a screen that you can display in a subscreen
area on a different screen in the same ABAP program.
Next Screen :
Specifies the next screen.
Hold Data :
Kaavian
Systems
If the user
calls
the screen more than once
during a terminal session, he or she can retain changed data
02-Sep-09
Screen Elements
Text Fields:
Input/Output Fields:
Radio Buttons:
Check boxes:
Kaavian Systems
Screen Elements
Pushbuttons:
Subscreen:
Status Icons:
Ok_Code Field
02-Sep-09
Kaavian Systems
Screen Fields
Screen fields are fields in the working memory
of a screen. Their contents are passed to
identically-named fields in the ABAP program in
the PAI event, and filled from the same
identically-named fields in the program in the
PBO event. The screen fields are linked with the
input/output fields.
02-Sep-09
Kaavian Systems
10
02-Sep-09
11
Leaving Screen
Syntax:
02-Sep-09
Kaavian Systems
12
Kaavian Systems
13
02-Sep-09
On Input
On Request
Kaavian Systems
14
processing
chain.
The
processing
chains
are
performed as follows:
CHAIN.
FIELD: <f1>, <f 2>,...
MODULE <mod1> ON CHAIN-INPUT|CHAINREQUEST.
FIELD: <g1>, <g 2>,...
MODULE <mod2> ON CHAIN-INPUT|CHAINREQUEST.
...
ENDCHAIN.
02-Sep-09
Kaavian Systems
15
Modules
02-Sep-09
Kaavian Systems
16
Menu Painter
02-Sep-09
Kaavian Systems
17
Input Checks
Field format Check :
This format limits the kind of input that is
valid.
For ex. , a DATS field (Date field) is an 8 char
string in YYYYMMDD format. All char must be
numbers . For the given value entered, the system
checks that the day value is valid.
Required Check :
In the screen painter you can set a fields
required Input Attribute . The system requires the
user to enter the input before entering PAI
Processing.
18
Field list
Field name Format
DATE
.
.
.
DATE
AMOUNT
Date
02-Sep-09
31.11.1993
DEC
Date
3A9Y
Amount 11.13.1996
Amount 12A3
E: Invalid date
19
Required Field
Screen
Painter
Field list
02-Sep-09
Kaavian Systems
20
P1
Check table
KEY
A
B
C
.
.
.
Screen
Painter
Field list
P1
Field
Foreign key
FIELD1 X
Check
Field1C
02-Sep-09
Kaavian Systems
21
ABAP/4
MODULE <module> INPUT.
.
.
.
MESSAGE E ... .
ENDMODULE.
E...Message
02-Sep-09
Kaavian Systems
22
MODULE
MODULE CHECK_SCOUR
CHECK_SCOUR INPUT.
INPUT.
Screen
Painter
ABAP/4
SELECT
SELECT SINGLE
SINGLE ** FROM
FROM SCOUR
SCOUR
WHERE
WHERE AREA
AREA =
= SCOUR-AREA
SCOUR-AREA
AND
AND COURSE
COURSE =
= SCOUR-COURSE.
SCOUR-COURSE.
IF
IF SY-SUBRC
SY-SUBRC NE
NE 0.
0.
MESSAGE
MESSAGE E123
E123 WITH
WITH 'SCOUR'.
'SCOUR'.
ENDIF.
ENDIF.
ENDMODULE.
ENDMODULE.
02-Sep-09
Kaavian Systems
23
ABAP/4
MODULE <module> INPUT.
.
.
.
MESSAGE E ... .
ENDMODULE.
1
..
.
E... Message
1 Ready for Input
02-Sep-09
Kaavian Systems
24
MODULE
MODULE CHECK_SCOUR
CHECK_SCOUR INPUT.
INPUT.
Screen
Painter
ABAP/4
SELECT
SELECT SINGLE
SINGLE ** FROM
FROM SCOUR
SCOUR
WHERE
WHERE AREA
AREA =
= SCOUR-AREA
SCOUR-AREA
AND
AND COURSE
COURSE =
= SCOUR-COURSE.
SCOUR-COURSE.
IF
IF SY-SUBRC
SY-SUBRC NE
NE 0.
0.
MESSAGE
MESSAGE E123
E123 WITH
WITH 'SCOUR,COURSE.
'SCOUR,COURSE.
ENDIF.
ENDIF.
ENDMODULE.
ENDMODULE.
02-Sep-09
Kaavian Systems
25
Error Handling
Error (E)
screen
Success (S)
screen
02-Sep-09
Kaavian Systems
26
Screen
Painter
ABAP/4
PROGRAM B220MAIN MESSAGE-ID <id>.
.
.
.
MODULE CHECK INPUT.
.
.
.
IF SY-SUBRC ...
MESSAGE <qnnn>
WITH <value 1>..<value 4>.
ENDIF.
ENDMODULE.
02-Sep-09
Kaavian Systems
27
Display
Change
A
B
A
B
Output template
02-Sep-09
Input/output
template
Kaavian Systems
28
02-Sep-09
SCREEN-REQUIRED
Input field
SCREEN-INPUT
Output field
SCREEN-OUTPUT
Highlighted
SCREEN-INTENSIFIED
Invisible
SCREEN-INVISIBLE
SCREEN-LENGTH
Kaavian Systems
29
PROCESS
BEFORE OUTPUT.
..
.
MODULE
MODIFY_SCREEN.
..
.
Screen
Painter
ABAP/4
MODULE
MODIFY_SCREEN OUTPUT.
..
.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'GR1'.
SCREEN-INPUT = 1.
ENDIF.
IF SCREEN-NAME = 'TAB-FELD'.
SCREEN-ACTIVE= 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
02-Sep-09
Kaavian Systems
30
Subscreens
Subscreens allows to expand the content of a screen
dynamically at runtime.
For example,
Screen exits, which are part of the enhancement
concept, use
the subscreen technique.
Some complex screen elements, like tabstrip
controls, also use
them.
Prerequisite to use a subscreen:
02-Sep-09
31
Screen Tables
A screen table is a repeated series of table rows
in a screen. Each entry contains one or more fields,
and all rows have the same field structure.
Table controls and step loops are types of screen
tables you can add to a screen in the Screen
Painter.
These are the two mechanisms offered by ABAP/4
for displaying and using table data in a screen.
02-Sep-09
Kaavian Systems
32
Table Controls
02-Sep-09
Kaavian Systems
33
During the PBO event, data is read line by line from the
internal table into the control table in screen painter.
02-Sep-09
Kaavian Systems
34
At PAI.
Loop at <itab>.
Endloop.
Kaavian Systems
35
Tabstrip Controls
A tabstrip control is a screen object consisting of two
or more pages. Each tab page consists of a tab title
and a page area.
Tabstrip controls allow you to place a series
of screens belonging to an application on a
single screen
When you create a tabstrip control, you must:
Define the tab area on a screen and the tab
titles.
02-Sep-09
Assign a subscreenKaavian
area
to each tab title.
Systems
Program the screen flow logic.
36
Mechanism of Tabstrip
Before using a tabstrip control in theABAP program,
a control for each control in the declaration part of the
program using the following statement must be
created:
CONTROLS <ctrl> TYPE TABSTRIP.
Before the screen is displayed, the control is used to
set the tab page that is currently active. To do this,
assign the function code of the corresponding tab title
to the component ACTIVETAB:
<ctrl>-ACTIVETAB = <fcode>.
In the PAI event, ACTIVETAB contains the function
code of the last active tab title on the screen
02-Sep-09
Kaavian Systems
37
Leaving to a Transaction
To branch to another transaction and end the
current
one,
use
the
LEAVE
TO
TRANSACTION
statement:
Syntax :
LEAVE TO TRANSACTION '<TRAN>'.
Once the new transaction starts, the user can
not return to the previous transaction by pressing the
Exit icon. Any data the user did not save in the
previous transaction is lost.
02-Sep-09
Kaavian Systems
38
Calling a Transaction
Syntax:
CALL TRANSACTION '<TRAN>'.
02-Sep-09
Kaavian Systems
39
Syntax:
CALL TRANSACTION '<TRAN>' AND SKIP FIRST
SCREEN.
The
initial
screen
is
processed
but
not
Kaavian Systems
40
There are
parameters:
two
ways
to
use
SPA/GPA
by using
PARAMETER
the
SET PARAMETER
statements
or
GET
Syntax:
SET PARAMETER ID 'RID'
<FIELD NAME1>.
KaavianFIELD
Systems
GET PARAMETER ID 'RID' FIELD <FIELD
02-Sep-09
41
and
PROCESS
ON
VALUE-REQUEST
(POV)
events.
Syntax:
PROCESS ON HELP-REQUEST.
FIELD <field> MODULE <module>.
PROCESS ON VALUE-REQUEST.
FIELD <field> MODULE <module> .
02-Sep-09
Kaavian Systems
42
Creating Screens
We can create a screen using
Transaction SE51
Kaavian Systems
43
02-Sep-09
Kaavian Systems
44
02-Sep-09
Kaavian Systems
45
02-Sep-09
Kaavian Systems
46
Kaavian Systems
47
02-Sep-09
Kaavian Systems
48
Title Bar
The title Bar of the window that you will use to
display.
02-Sep-09
Kaavian Systems
49
Code
In the PAI of the flow logic we can use the
conditional statement
Kaavian Systems
50
Kaavian Systems
51
Modules
In this module we can even write the code to
Retrieve the Data, Branching to Different Screen
and also use function codes.
02-Sep-09
Kaavian Systems
52
02-Sep-09
Kaavian Systems
53
POV
In the Process on value request (POV) of the flow
logic we can use the search help for a particular
field
02-Sep-09
Kaavian Systems
54
Example
We will design the screen with a text object and the
table control object
02-Sep-09
Kaavian Systems
55
Reference
The
learning
material
contained
in
this
PowerPoint
Presentation is prepared with the help of http://help.sap.com/
and sap press book. All rights reserved by SAP AG.
Unless otherwise specifically stated, this learning material is
intended for the sole purpose of class room session, internal use
and for knowledge transfer to the Consultants.
However, for detailed information on this learning material,
http://help.sap.com / sap press book may be referred.
Kaavian is not liable for any legal liability or responsibility for
the accuracy, completeness or usefulness of any information
disclosed in these learning materials.
No portion of the learning materials
shall be modified,
reproduced or transmitted in any form by any means, whether
by electronic, photocopier or otherwise without the written
permission of Kaavian. In no event shall Kaavian be liable for
any damage whatsoever resulting in any action arising in
connection with the use of learning material.
02-Sep-09
Kaavian Systems
56
THANK YOU
02-Sep-09
Kaavian Systems