Dialog Programming (1)
-
Upload
viveksharma13 -
Category
Documents
-
view
228 -
download
0
Transcript of Dialog Programming (1)
-
7/30/2019 Dialog Programming (1)
1/67
2010 Wipro Ltd - Confidential
DIALOG PROGRAMMING
-
7/30/2019 Dialog Programming (1)
2/67
2010 Wi ro Ltd - Confidential2
2010 Wipro Ltd - Confidential2
Introduction Why do we need Dialog programming
Differences between report & Dialog programming
Structure of a Dialog program
Main components in Dialog programming
Events
Screen painter in ABAP/4
Menu painter in ABAP/4
Interaction between screen painter and ABAP/4 modules
How communication is maintained in ABAP/4 modules How to create simple dialog program
Contents
-
7/30/2019 Dialog Programming (1)
3/67
2010 Wi ro Ltd - Confidential3
2010 Wipro Ltd - Confidential3
DIALOG PROGRAMMING Dialog program is an ABAP development which consists of many screens
which when linked together make up an application which allows the user to
perform a specific functionality
These screens are referred too as dynpros (DYnamic PROgrams) and are
made up of the actual user screen and its associated flow logic which are all
stored within an SAP module pool.
In dialog programming we use the Screen Painter to create screens and
program the sequence in which they appear. We write an ABAP/4 program
(ABAP/4 module pool) for our screens. This is a collection of dialog
modules which are called by the flow logic of our screens. We use dialog
programs for both reading and changing database tables.
Introduction
-
7/30/2019 Dialog Programming (1)
4/67
2010 Wi ro Ltd - Confidential4
2010 Wipro Ltd - Confidential4
A dialog program provides:
a user-friendly user interface
format and consistency checks for the data entered by the user
easy correction of input errors
access to data by storing it in the database.
Why Dialog Programming
-
7/30/2019 Dialog Programming (1)
5/67
2010 Wi ro Ltd - Confidential5
2010 Wipro Ltd - Confidential5
Reports and Dialog Programming
-
7/30/2019 Dialog Programming (1)
6/67
2010 Wi ro Ltd - Confidential6
2010 Wipro Ltd - Confidential6
Reports and Dialog Programming
-
7/30/2019 Dialog Programming (1)
7/67 2010 Wipro Ltd - Confidential7
Components of the dialog program
-
7/30/2019 Dialog Programming (1)
8/67
2010 Wi ro Ltd - Confidential8 2010 Wipro Ltd - Confidential8
Components Of Dialog Programming
-
7/30/2019 Dialog Programming (1)
9/67
2010 Wi ro Ltd - Confidential9 2010 Wipro Ltd - Confidential9
A dialog program consists of the following basic components:
Screens (dynpros)
Each dialog in an SAP system is controlled by dynpros. A dynpro (DynamicProgram) consists of a screen and its flow logic and controls exactly onedialog step.
Flow logic:
Calls of the ABAP/4 modules for a screen. The flow logic determines whichprocessing takes place before displaying the screen (PBO-Process BeforeOutput) and after receiving the entries the user made on the screen (PAI-Process After Input).
Basic Components of a Dialog Program
-
7/30/2019 Dialog Programming (1)
10/67
2010 Wi ro Ltd - Confidential10 2010 Wipro Ltd - Confidential10
Screen layout: Positions of the texts, fields, pushbuttons, and so on for ascreen
Screen attributes: Number of the screen, number of the subsequent
screen, and Screen type
Field attributes: Definition of the attributes of the individual fields on a
screen
You use the Screen Painter and the Menu Painter to create and design
screen templates and screen programs.
You define the processing logic in an ABAP/4 program (module pool).
Data structures are defined in the ABAP/4 Dictionary. You can access these
structures from the ABAP/4 program and when defining screen fields.
Basic Components of a screen
-
7/30/2019 Dialog Programming (1)
11/67
2010 Wi ro Ltd - Confidential11 2010 Wipro Ltd - Confidential11
Structure Of A Dialog Programming
-
7/30/2019 Dialog Programming (1)
12/67 2010 Wipro Ltd - Confidential12
Events
-
7/30/2019 Dialog Programming (1)
13/67 2010 Wi ro Ltd - Confidential
13 2010 Wipro Ltd - Confidential13
PBO (Process Before Output) :A processing event which is called before the screen is displayed. Its tasks
include the initialization of the screen fields and supply default data values
for the screen.
PAI (Process After Input) :
A processing event taking place after you leave a screen. Its tasks are to
process the input data or initiate the update of the database.
POH (Process On Help Request) :
A processing event taking place when user requests field help (F1) .
Process On Help-Request
...
Field Module .
...
Events
-
7/30/2019 Dialog Programming (1)
14/67 2010 Wi ro Ltd - Confidential
14 2010 Wipro Ltd - Confidential14
After the PROCESS ON HELP-REQUEST statement, you can only use theMODULE statement together with the FIELD statement. When the user
chooses F1 for a field , the system calls the module belonging to
the FIELD statement. If there is more than one FIELD statement for the
same field , only the first is executed.
HELP_OBJECT_SHOW_FOR_FIELD :This function module displays the
data element documentation for components of any structure or database
table from the ABAP Dictionary. You pass the name of the component and
structure or table to the import parameters FIELD and TABLE.
HELP_OBJECT_SHOW: Use this function module to display any SAPscript document. You must pass the document class (for example, TX for
general texts, DE for data element documentation) and the name of the
document to the import parameters DOKCLASS and DOKNAME.
Events
-
7/30/2019 Dialog Programming (1)
15/67 2010 Wi ro Ltd - Confidential
15 2010 Wipro Ltd - Confidential15
POV (Process On Value Request) :A processing event takes place when user request F4 help.
Process On Value Request.
...
Field Module .
...
F4IF_FIELD_VALUE_REQUEST: Calls the input help of the ABAP
Dictionary dynamically. We can pass the component names of a structure or
database table of the ABAP Dictionary to the function module in the import
parameters TABNAME and FIELDNAME. The function module starts the
ABAP dictionary input help for this component. All of the relevant screen
fields are read. If we specify the import parameters DYNPPROG, DYNPNR,and DYNPROFIELD, the users selection is returned to the corresponding
field on the screen. If we specify the table parameter RETURN_TAB, the
selection is returned into the table instead.
Events
-
7/30/2019 Dialog Programming (1)
16/67 2010 Wi ro Ltd - Confidential16 2010 Wipro Ltd - Confidential16
F4IF_INT_TABLE_VALUE_REQUEST: This function module displays avalue list that we created in an ABAP program. The value list is passed to
the function module as the table parameter VALUE_TAB. If you specify the
import parameters DYNPPROG, DYNPNR, and DYNPROFIELD, the users
selection is returned to the corresponding field on the screen. If we specify
the table parameter RETURN_TAB, the selection is returned into the table
instead.
Events
-
7/30/2019 Dialog Programming (1)
17/67 2010 Wi ro Ltd - Confidential17 2010 Wipro Ltd - Confidential17
Transaction Flow
-
7/30/2019 Dialog Programming (1)
18/67 2010 Wi ro Ltd - Confidential18 2010 Wipro Ltd - Confidential18
There are two ways of starting a sequence of screens.
1) Using a Transaction Code
2) From ABAP program
Starting a Screen Sequence
-
7/30/2019 Dialog Programming (1)
19/67 2010 Wi ro Ltd - Confidential19 2010 Wipro Ltd - Confidential19
Using a Transaction Code
When you use a transaction code to start a screen sequence, the
corresponding ABAP program is automatically loaded as well. The processinglogic of the program is controlled by the screen flow logic. On reaching the
end of the screen sequence (next screen 0), the entire program terminates,
and control returns to the point from which the transaction was called.
-
7/30/2019 Dialog Programming (1)
20/67 2010 Wi ro Ltd - Confidential20 2010 Wipro Ltd - Confidential20
From an ABAP Program
You can start a screen sequence from an ABAP program using the
CALL SCREEN statement.
At the end of the screen sequence (next screen 0), the program continuesprocessing directly after the CALL SCREEN statement. Starting a sequence
from an ABAP program allows you to insert a sequence of screens into the
existing program flow.
-
7/30/2019 Dialog Programming (1)
21/67 2010 Wi ro Ltd - Confidential21 2010 Wipro Ltd - Confidential21
-
7/30/2019 Dialog Programming (1)
22/67 2010 Wi ro Ltd - Confidential22 2010 Wipro Ltd - Confidential22
-
7/30/2019 Dialog Programming (1)
23/67 2010 Wipro Ltd - Confidential23
Screen objects
-
7/30/2019 Dialog Programming (1)
24/67 2010 Wi ro Ltd - Confidential24 2010 Wipro Ltd - Confidential24
Screen objects
-
7/30/2019 Dialog Programming (1)
25/67 2010 Wi ro Ltd - Confidential
25 2010 Wipro Ltd - Confidential25
-
7/30/2019 Dialog Programming (1)
26/67 2010 Wi ro Ltd - Confidential
26 2010 Wipro Ltd - Confidential26
-
7/30/2019 Dialog Programming (1)
27/67 2010 Wi ro Ltd - Confidential
27 2010 Wipro Ltd - Confidential27
When a screen is processed, the system table SCREEN contains an
entry for each screen object that has been created in the Screen Painter
for that screen.The SCREEN table is initialized in the PBO of each screen. It is filled with
the screen objects belonging to that screen.
You can handle the system table SCREEN like any other internal table,
although you do not have to declare it in your program. It is maintained
internally by the system, and updated each time a new screen is
displayed.
-
7/30/2019 Dialog Programming (1)
28/67 2010 Wi ro Ltd - Confidential
28 2010 Wipro Ltd - Confidential28
-
7/30/2019 Dialog Programming (1)
29/67 2010 Wi ro Ltd - Confidential
29 2010 Wipro Ltd - Confidential29
Modifying Attributes Dynamically: Example
Display/Change
A
B
Display/Change
A
B
Output field Input/Output field
-
7/30/2019 Dialog Programming (1)
30/67 2010 Wi ro Ltd - Confidential
30 2010 Wipro Ltd - Confidential30
-
7/30/2019 Dialog Programming (1)
31/67
2010 Wi ro Ltd - Confidential31 2010 Wipro Ltd - Confidential31
You can set a static sequence of screens by entering a screen number inthe Next screen attribute of the relevant screens.
You can also set the screen sequence dynamically in one of the following
ways:
Using SET SCREEN. This temporarily overrides the Next screen attribute.
CALL SCREEN. This inserts one or more screens into the sequence. When
that sequence finishes, processing resumes with the statement following the
CALL SCREEN statement.
The next screen is processed either when the current screen processing
ends, or when you terminate it using the LEAVE SCREEN statement.
To specify the next screen and leave the current screen in a single step, use
the LEAVE TO SCREEN statement
Dynamic next screen
-
7/30/2019 Dialog Programming (1)
32/67
2010 Wi ro Ltd - Confidential32 2010 Wipro Ltd - Confidential32
Sample Transaction
-
7/30/2019 Dialog Programming (1)
33/67
2010 Wipro Ltd - Confidential33
CREATING A SIMPLE TRANSACTION
-
7/30/2019 Dialog Programming (1)
34/67
2010 Wi ro Ltd - Confidential34
CREATING A SIMPLE TRANSACTION
Go to SE80 select package and right click to create program .
-
7/30/2019 Dialog Programming (1)
35/67
2010 Wi ro Ltd - Confidential35
Give program name like SAPMZSAMPLEPRG
-
7/30/2019 Dialog Programming (1)
36/67
2010 Wi ro Ltd - Confidential36 2010 Wipro Ltd - Confidential36
TOP include Creation
TOPINCLUDE will be created with name MZSAMPLEPRGTOP.
-
7/30/2019 Dialog Programming (1)
37/67
2010 Wi ro Ltd - Confidential37 2010 Wipro Ltd - Confidential37
Saving Program
Give the title and select the program attributes as TYPE : M Status :
S. save it in the package.
-
7/30/2019 Dialog Programming (1)
38/67
2010 Wi ro Ltd - Confidential38 2010 Wipro Ltd - Confidential38
Main program view
The main program screen will appear like this, with TOP include andPBO,PAI includes commented at first.
O
-
7/30/2019 Dialog Programming (1)
39/67
2010 Wi ro Ltd - Confidential39 2010 Wipro Ltd - Confidential39
PBO,PAI Includes creation
To create PBO,PAI include for screen right click on program->create-> PBOmodule (OR) uncomment PBO,PAI include in main program and double click
to create.
C l f M i
-
7/30/2019 Dialog Programming (1)
40/67
2010 Wi ro Ltd - Confidential40 2010 Wipro Ltd - Confidential40
Complex structure of Main program
D fi i
-
7/30/2019 Dialog Programming (1)
41/67
2010 Wi ro Ltd - Confidential41 2010 Wipro Ltd - Confidential41
Defining screens
T t f T ti
-
7/30/2019 Dialog Programming (1)
42/67
2010 Wi ro Ltd - Confidential42 2010 Wipro Ltd - Confidential42
To create screen for Transaction
Right click on program to create screen
S ti i iti l
-
7/30/2019 Dialog Programming (1)
43/67
2010 Wi ro Ltd - Confidential43 2010 Wipro Ltd - Confidential43
Screen creation initial screen
Provide the screen number and proceed.
S Att ib t
-
7/30/2019 Dialog Programming (1)
44/67
2010 Wi ro Ltd - Confidential44 2010 Wipro Ltd - Confidential44
Screen Attributes
Provide the details and save it.
S Fl L i
-
7/30/2019 Dialog Programming (1)
45/67
2010 Wi ro Ltd - Confidential45 2010 Wipro Ltd - Confidential45
Screen Flow Logic
Screen will contain attributes, elements list, flow logic parts.
Flow logic part will as in below screen.
C ti PBO PAI M d l
-
7/30/2019 Dialog Programming (1)
46/67
2010 Wi ro Ltd - Confidential46 2010 Wipro Ltd - Confidential46
Creating PBO,PAI Modules
Uncomment PBO module (MODULE STATUS_9000) and double to create and
the appropriate subroutine. similarly for PAI module.
Some points about Screen
-
7/30/2019 Dialog Programming (1)
47/67
2010 Wi ro Ltd - Confidential47 2010 Wipro Ltd - Confidential47
Some points about Screenpainter
Screen Layout (Graphical Screen Painter) .
To design screens, you use the Screen Painter.
The interface of the graphical Screen Painter contains easy-to-use
functions for defining the various screen elements (e.g. input/output fields,
field texts, boxes, etc.). You choose each screen element and position it on
the screen using the mouse. This is WYSIWYG graphical design usingdrag-and-drop.
To delete screen elements, you select the element with the mouse and
then choose Delete.
To move screen elements, you use the mouse to drag the element to the
required position.
-
7/30/2019 Dialog Programming (1)
48/67
2010 Wi ro Ltd - Confidential48 2010 Wipro Ltd - Confidential48
Sample screen of Screen painter
Screen Layout
-
7/30/2019 Dialog Programming (1)
49/67
2010 Wi ro Ltd - Confidential49 2010 Wipro Ltd - Confidential49
Screen Layout
Click on lay out it will take to screen painter.
DICT/PROG fields initial screen
-
7/30/2019 Dialog Programming (1)
50/67
2010 Wi ro Ltd - Confidential50 2010 Wipro Ltd - Confidential50
DICT/PROG fields initial screen
Click on (F6) or get form dictionary\program then screen will be like this.
Dict/Program Fields selection view
-
7/30/2019 Dialog Programming (1)
51/67
2010 Wi ro Ltd - Confidential51 2010 Wipro Ltd - Confidential51
Dict/Program Fields selection view
Selecting Fields required on Screen
-
7/30/2019 Dialog Programming (1)
52/67
2010 Wi ro Ltd - Confidential52 2010 Wipro Ltd - Confidential52
Selecting Fields required on Screen
Provide table name and click on get from dictionary button. and select
required fields. and click on enter to place on screen.
Placing required fields on screen
-
7/30/2019 Dialog Programming (1)
53/67
2010 Wi ro Ltd - Confidential53 2010 Wipro Ltd - Confidential53
Placing required fields on screen
Cosmetic changes on screen
-
7/30/2019 Dialog Programming (1)
54/67
2010 Wi ro Ltd - Confidential54 2010 Wipro Ltd - Confidential54
Cosmetic changes on screen
Arrange some boxes around fields to look good and provide appropriate names tothem.
Screen Design
-
7/30/2019 Dialog Programming (1)
55/67
2010 Wi ro Ltd - Confidential55 2010 Wipro Ltd - Confidential55
Screen Design
Ok code Declaration in screen elements
-
7/30/2019 Dialog Programming (1)
56/67
2010 Wi ro Ltd - Confidential56 2010 Wipro Ltd - Confidential56
_list
In elements list declare ok as ok_code and in program ok_code like
sy-ucomm.
PBO initial code
-
7/30/2019 Dialog Programming (1)
57/67
2010 Wi ro Ltd - Confidential57 2010 Wipro Ltd - Confidential57
PBO initial code
In PBO Code SET PF-STATUS will be commented initially. uncomment SET pf-
status and give status name in caps (ZSAMPLE),double click to create.
Status Creation (Menu painter)
-
7/30/2019 Dialog Programming (1)
58/67
2010 Wi ro Ltd - Confidential58 2010 Wipro Ltd - Confidential58
Status Creation (Menu painter)
It will go to se41(menu painter), after filling The initial screen details select
function buttons required the screen will appear like this.
Menu painter Overview
-
7/30/2019 Dialog Programming (1)
59/67
2010 Wi ro Ltd - Confidential59 2010 Wipro Ltd - Confidential59
Menu painter Overview
Use of Menu Painter
You use the Menu Painter to define functions on a screen in a particularstatus and assign them to the appropriate menu bar, standard toolbar and
application toolbar.
You also define the title.
In general, you define a menu bar for each dialog program and assign it to
a status. For each status, you define which menu functions are to be
active/inactive.
All the statuses of a dialog program make up the user interface. If you add
a new status, you have to regenerate the interface.
You assign a status and a title to a screen in the appropriate PBO module
using the SET PF-STATUS and SET TITLEBAR statements respectively.
The status can be up to 8 characters long, while the title code shouldconsist of no more than 3 characters.
Setting PF-status For screen
-
7/30/2019 Dialog Programming (1)
60/67
2010 Wi ro Ltd - Confidential60 2010 Wipro Ltd - Confidential60
Setting PF-status For screen
Select the functions required on the screen and provide names.
PBO Module Code
-
7/30/2019 Dialog Programming (1)
61/67
2010 Wi ro Ltd - Confidential61 2010 Wipro Ltd - Confidential61
PBOModuleCode
Final PBO code will be like this. with code for selected functions on screen.
(PBO Include).
PAI Module Code
-
7/30/2019 Dialog Programming (1)
62/67
2010 Wi ro Ltd - Confidential62 2010 Wipro Ltd - Confidential62
PAI Module Code
In the PAI module write the code code for display button (PAI Include).
Transaction creation
-
7/30/2019 Dialog Programming (1)
63/67
2010 Wi ro Ltd - Confidential63 2010 Wipro Ltd - Confidential63
Transactioncreation
Create transaction to test the report.
Transaction creation initial screen
-
7/30/2019 Dialog Programming (1)
64/67
2010 Wi ro Ltd - Confidential64 2010 Wipro Ltd - Confidential64
Transaction creation initial screen
It will take to SE93 (transaction creation initial screen). give name as
ZSAMPLE ,provide short text &object type save it, activate it.
Test Transaction
-
7/30/2019 Dialog Programming (1)
65/67
2010 Wi ro Ltd - Confidential65 2010 Wipro Ltd - Confidential65
Test Transaction
Click on F8 to test the transaction on se93of transaction or give transactionname on command filed or on se80 right click on transaction->execute->directprocessing.
Provide the carrid and connid in the respective fields and click on display forresult.
Result
-
7/30/2019 Dialog Programming (1)
66/67
2010 Wi ro Ltd - Confidential66 2010 Wipro Ltd - Confidential66
Result
-
7/30/2019 Dialog Programming (1)
67/67
Thank You