Dynpros, Module Pools and Transactions
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
Before Fiori apps existed, the screens in which people worked with SAP were drawn with a tool and driven by ABAP code. Such a screen is called a dynpro, short for dynamic program, because what happens next depends on what the user does: types a value, presses a button, chooses a menu entry. A dynpro has two halves. One half is the layout, the boxes, labels and buttons you see. The other half is a short script, the flow logic, that the runtime runs just before the screen is shown and again after the user acts, and that calls pieces of ABAP code, the dialog modules, to prepare the display and to react. A program built from such screens and modules is called a module pool, and it is started by a transaction code that you type into SAP GUI. A newcomer meets dynpros in older custom programs and in many standard transactions that still run on them. After reading this page you can read the flow logic and the dialog modules of such a program, follow the data between screen and program, move between screens, build a small input screen with a button and a menu, and explain table controls, tabstrips and subscreens. The page is written against Standard ABAP release 8.16, for classic ABAP only. Dynpros are shown in SAP GUI and cannot be created in ABAP Cloud (release 9.20, 2608), which means they do not exist in the Public Edition of SAP S/4HANA Cloud or in the ABAP environment of SAP BTP. There, user interfaces are Fiori apps built on the RESTful Application Programming Model. SAP’s own ABAP cheat sheet calls classic dynpros outdated for new application programs, so read this page to maintain and understand existing ones.
Every listing on this page needs an SAP system with SAP GUI. A dynpro is stored in the repository of the system, drawn in the Screen Painter and shown by SAP GUI, and the local ABAP playground used on other pages has none of these. The listings are therefore labelled "requires an SAP system; not run here", and they have been checked statement by statement against the keyword documentation, not executed.
Before you read
-
Program Types and Structure: what a module pool is among the program types, and what a processing block is.
-
Classic Reports and Event Blocks: events and the order in which the runtime calls the blocks of a program.
-
Selection Screens and Variants: the generated special dynpro that asks a report for its input.
-
Messages: message types
E,WandS, which dialog modules use for input checks. -
Classic Tools: SE80 and SE11: opening a tool with a transaction code and browsing the objects of a program.
Key terms
-
Dynpro: a classic screen, made of a screen layout and flow logic, that always belongs to one ABAP program.
-
Module pool: a program of the type module pool, which holds the dialog modules and the dynpros of a dialog application and is started by a transaction code.
-
Flow logic: the script of a dynpro that calls dialog modules at the events PBO and PAI.
-
PBO (Process Before Output): the event that runs before the screen is shown, used to prepare the display.
-
PAI (Process After Input): the event that runs after a user action, used to read and check the input.
-
Dialog module: a block of ABAP code between
MODULEandENDMODULEthat the flow logic calls. -
OK field: the dynpro field that receives the function code of the user action.
-
Function code: a name of up to 20 characters that identifies a button, a menu entry or a key and tells the program what the user chose.
-
GUI status: the menu bar, toolbars and function keys that belong to a screen, created in the Menu Painter.
-
Dialog transaction: a transaction code that starts a module pool with its first dynpro.
-
Table control: a screen element that shows and edits the lines of an internal table.
-
Subscreen: a dynpro that is shown inside an area of another dynpro, for example on a tab page.
What a dynpro is made of
A dynpro is a repository object, which means it is stored in the system next to programs and tables, and it is always
a component of an ABAP program: of a function group, of an executable program (a report) or of a module pool. It is
identified by the name of its program and a four-digit dynpro number such as 0100. The dynpros of one program may call
each other freely, and they all work with the global data of that program.
| Part | What it holds |
|---|---|
Attributes |
The kind of screen: normal (fills the SAP GUI window), modal dialog box (a pop-up) or subscreen (a part of another
dynpro). Also the next dynpro, the one that is shown when this one is finished. A next dynpro of |
Screen layout |
The screen elements: input and output fields, text fields, checkboxes, radio buttons, pushbuttons, dropdown lists, subscreen areas, table controls, tabstrips and custom controls. Each element has static properties such as length, input allowed or required. Every element that carries data is a dynpro field and has a name. |
Element list |
The same elements as a table, including the OK field, a field of 20 characters that has no place on the screen and receives the function code. |
Flow logic |
The script with the event blocks |
Selection screens and classic lists are also dynpros, but they are generated from ABAP statements and you never edit them in the Screen Painter. This page is about the general dynpros that you do draw.
Three tools build the parts, each opened with its own transaction code. The Screen Painter (transaction SE51)
edits the layout, the element list, the attributes and the flow logic. The Menu Painter (transaction SE41) creates
the GUI status and the GUI title. The Object Navigator (transaction SE80) shows all of them under the program and is
the usual place to create a module pool with its screens. In transaction SE93, a transaction code is linked to the
program and its first screen. The pages of the keyword documentation name these tools, and you can follow the same
steps in ADT only for the ABAP source; the screens and the menu are still drawn in SAP GUI.
The module pool
A module pool is a program of the type module pool, called type M in the program attributes. It has no START-OF-SELECTION
and cannot be started with SUBMIT; it is started through a transaction code, and its code is made of dialog modules.
By convention the main program is split with INCLUDE programs, which the creation dialog of SE80 offers: one for the
global data, one for the PBO modules, one for the PAI modules and one for the other subroutines. The split only
organises the source text, and the examples below show it as one source for brevity.
PROGRAM zexp_claim_dialog.
" Global data declaration part; the screens read and write these data objects.
TABLES zexp_claim.
" Dialog modules for PBO and PAI come here, one MODULE ... ENDMODULE block each.
Requires an SAP system; not run here. The statement PROGRAM names the main program and corresponds to REPORT for
executable programs.
The PBO and PAI cycle
The central idea is a loop between the runtime on the application server and the SAP GUI on the user’s computer. The runtime runs the PBO block, sends the screen to the GUI and then waits. While the user types, no work process of the application server is held. When the user presses a button or Enter, the GUI sends the entries back, the PAI block runs, and the next screen is chosen. The loop then starts again with the PBO of that screen.
The PAI of the current screen and the PBO of the next screen run one after the other in the same work process, without a wait between them. Only while the screen is displayed and waiting for input is the work process free for other users.
Flow logic and dialog modules
The flow logic is written in the Flow Logic tab of the Screen Painter. Its blocks are introduced by keywords, and the
statements inside them are not ABAP. The one you use most is MODULE, which calls a dialog module of the program.
PROCESS BEFORE OUTPUT.
MODULE status_0100.
PROCESS AFTER INPUT.
MODULE exit_0100 AT EXIT-COMMAND.
FIELD zexp_claim-total_amount MODULE check_amount_0100.
MODULE user_command_0100.
Requires an SAP system; not run here. This is the flow logic of the screen 0100 that is built in the example below.
A dialog module is an ABAP processing block that stands in the program between MODULE and ENDMODULE. Four rules explain
most mistakes.
-
A module has no parameter list and no local data. It reads and writes the global data of the program, and a
DATAstatement inside it declares a global variable. If you need local data, call a method or a subroutine from the module. -
The addition decides where a module can be called. A module declared with
OUTPUTcan be called only at PBO. A module declared withINPUT, or with no addition, can be called at PAI and in the help events. -
A module is not tied to one screen, so the same module can be called from several. Name modules after the job and the screen, such as
status_0100, to keep this readable. -
If the called module does not exist, the runtime raises an exception that cannot be caught, and the program ends with a short dump. The same happens when a dynpro that you call does not exist.
Do not confuse the flow logic statement MODULE mod. (a call) with the ABAP statement MODULE mod OUTPUT. (a definition,
closed by ENDMODULE). They look alike and are different statements in different places.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'T100'.
ENDMODULE.
MODULE user_command_0100 INPUT.
" Evaluate the function code here, see the next sections.
ENDMODULE.
Requires an SAP system; not run here: the GUI status MAIN and the title T100 have to exist in the Menu Painter.
How data travels between screen and program
The screen and the program do not call each other with parameters. They exchange data through names. Every element on
the screen that carries a value is a dynpro field, and the data object with the same name in the global declaration part
of the program is its counterpart. When you name an input field ZEXP_CLAIM-TOTAL_AMOUNT in the Screen Painter and declare
TABLES zexp_claim in the program, the two are linked without any further statement.
-
At the end of PBO, the content of the data objects is copied into the dynpro fields and shown. A field that the PBO did not touch shows what the program variable still holds from the previous round.
-
At the start of PAI, before the first module is called, the content of all dynpro fields is copied back into the data objects of the same name. Only the fields that you list with a
FIELDstatement are transported later, when that statement is reached, which is the basis of the next section.
A dynpro field takes its data type from the ABAP Dictionary or from the program. When the field is named after a
component of a Dictionary structure, as above, the screen takes over the field label, the F1 help, the F4 input help and
the foreign-key check of the Dictionary. The statement TABLES zexp_claim creates the matching work area for it. It is
allowed in programs, forbidden inside classes, and not usable with a CDS entity. With a field declared by DATA, the
screen has only the type and the length.
The OK field and function codes
A pushbutton, a menu entry, a toolbar icon and a function key each carry a function code, a name of up to 20 characters
such as SAVE. When the user uses one of them, the function code is passed to the OK field and PAI starts. The OK field
is a dynpro field with no screen element: it is the last line of the element list, and you must give it a name, for
example ok_code, and declare a data object of that name in the program. The system field sy-ucomm receives the
same value, but it is recommended to work with your own OK field, because you control it.
Two habits avoid old bugs. Copy the OK field into an auxiliary variable at the start of the PAI module and clear the OK field at once; otherwise, a function code that stays in the field can trigger the same action again in the next round. And use the same OK field name in every screen of the program, so that one declaration and one module serve all screens.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'SAVE'.
" store the entries
WHEN 'BACK' OR 'CANC' OR 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE.
Requires an SAP system; not run here. The function codes SAVE, BACK, CANC and EXIT are defined in the GUI status
and in the pushbutton attributes, see below.
Input checks: FIELD and CHAIN
Before any of your modules runs at PAI, the runtime makes the automatic checks defined in the screen layout. A required field must be filled, and a field with a type from the Dictionary must hold a valid value of that type. If something is wrong, the message appears in the status bar, the affected field is ready for input again and PAI stops there until the user corrects it.
For rules of your own, link a module to a field. FIELD f MODULE m. calls m when the field f has been transported,
and a message of type E or W inside the module makes exactly that field ready for input again and lets the user
correct it. To check several related fields together, put them in a processing chain. A message in a module inside a
chain makes every field of the chain ready for input again. Chains cannot be nested, and a condition such as ON CHAIN-INPUT looks at the fields listed before the module call inside
the chain.
PROCESS AFTER INPUT.
FIELD zexp_claim-claim_id MODULE check_id_0100.
CHAIN.
FIELD zexp_claim-total_amount.
FIELD zexp_claim-currency_code.
MODULE check_amount_0100 ON CHAIN-INPUT.
ENDCHAIN.
Requires an SAP system; not run here. The module check_amount_0100 is called when at least one field of the chain
holds a value other than its initial value; ON CHAIN-REQUEST would call it only when the user changed one of them.
The conditions of the MODULE statement in more detail are as follows.
| Flow logic | The module is called |
|---|---|
|
Always, after |
|
Only if |
|
Only if the user entered something in |
|
If at least one field of the chain holds a value other than initial. |
|
If the user changed at least one field of the chain. |
|
Before the automatic checks, when the function code has the function type |
The exit command solves a practical problem. The automatic checks make a user fix every wrong entry before anything
else can happen, so even Cancel would be refused on a half-filled screen. A function code with the function type E (set
in the Menu Painter or in the attributes of the element) skips these checks and calls the module
MODULE m AT EXIT-COMMAND. End that module with a LEAVE statement. If it does not, the normal PAI processing, with its
checks, goes on afterwards.
FIELD and MODULE can also be used in the events PROCESS ON HELP-REQUEST (F1) and PROCESS ON VALUE-REQUEST (F4), to
program your own field help or input help. They transport no data there. The obsolete additions VALUES and SELECT of
FIELD, which do a value check in the flow logic itself, should be replaced by a module with an E message.
Screen sequence: moving between dynpros
Each dynpro has a next dynpro. When PAI ends, the runtime shows that screen. The chain of screens is a dynpro sequence,
and it ends when the next dynpro is 0. The statements below steer the sequence from the program.
| Statement | Effect |
|---|---|
|
Sets the next dynpro for this round and does not leave the current one. |
|
Leaves the current dynpro now and shows the next dynpro, the static one or the one set with |
|
A short form of |
|
Starts a new dynpro sequence nested in the current one, beginning with the screen |
|
The same, but all screens of the called sequence are shown in a modal dialog box (a pop-up). |
Source: ABAP Keyword Documentation: LEAVE SCREEN; ABAP Keyword Documentation: SET SCREEN; ABAP Keyword Documentation: CALL SCREEN
Two limits are documented. A sequence started by a transaction code can nest up to 50 other sequences with CALL SCREEN,
and a pop-up opens a new popup level, of which at most 9 exist. CALL SCREEN is for general dynpros; for a selection
screen use CALL SELECTION-SCREEN. When a program is left with LEAVE TO SCREEN 0 from the first screen of the
transaction, the whole program ends. LEAVE PROGRAM ends it at once from anywhere.
CASE save_ok.
WHEN 'DETAIL'.
CALL SCREEN 0200 STARTING AT 10 5 ENDING AT 70 15. " pop-up, then back here
WHEN 'BACK'.
LEAVE TO SCREEN 0. " ends the sequence of 0100
ENDCASE.
Requires an SAP system; not run here; the screen 0200 of the type modal dialog box has to exist.
GUI status and title
The menu bar, the standard toolbar with its icons, the application toolbar with its buttons and the function keys are not part of the screen. They are grouped in a GUI status, made in the Menu Painter (SE41), and the program chooses it at run time. The window caption is a GUI title, made in the same tool. Because the two are separate objects, one layout can stay as it is while the status and the title change, for example to switch off the Save button once the claim is stored.
-
SET PF-STATUS 'MAIN'.activates the status for the next screens, from the next time a screen is sent, until the nextSET PF-STATUSor the end of the program. Set it in PBO at the latest. The name of the active status stays insy-pfkey. -
SET PF-STATUS 'MAIN' EXCLUDING fcode.deactivates the listed function codes.fcodeis a character-like value or an internal table of such values, andGET PF-STATUSreturns the codes that are currently inactive. -
SET PF-STATUS 'MAIN' OF PROGRAM prog.uses a status of another program. -
If no status is set, an empty status is shown in which only the predefined system functions work, and only the Enter key raises PAI. If a status is set that does not exist, the result is the same empty status. That is the typical reason why "nothing happens" when a new screen shows no buttons.
-
SET TITLEBAR 'T100'.sets the title, andSET TITLEBAR 'T100' WITH text1 text2.fills the placeholders&1to&9of the title. The name of the active title is insy-title.
The same function codes of the status arrive in the OK field. For the selection screen, SET PF-STATUS is no longer
recommended.
The SCREEN structure: changing elements at run time
The static properties of the elements are set in the Screen Painter, but they can be changed for one display, in PBO. The loop
LOOP AT SCREEN runs over every element of the current dynpro that has a dynpro field. Its work area has the type
SCREEN, a structure of the Dictionary, and MODIFY SCREEN FROM wa writes the changed properties of the current element
back. It is only allowed in the loop, and it only makes sense in PBO: the properties are set back to the static ones at the
start of every PBO, so a MODIFY SCREEN in PAI has no effect on the next display. The component name must stay as it is.
| Component | Meaning |
|---|---|
|
The name of the element, up to 132 characters. |
|
Up to four modification groups of three characters each, assigned in the Screen Painter. Elements with the same group id can be changed together. |
|
|
|
|
|
|
|
|
|
The visible length of the field. |
|
|
|
|
|
Set to |
Source: ABAP Keyword Documentation: dynpro - The Structure SCREEN; ABAP Keyword Documentation: MODIFY SCREEN
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'T100'.
" Show the total as output only once the claim has been stored.
LOOP AT SCREEN INTO DATA(screen).
IF screen-name = 'ZEXP_CLAIM-TOTAL_AMOUNT' AND zexp_claim-status = 'S'.
screen-input = 0.
MODIFY SCREEN FROM screen.
ENDIF.
ENDLOOP.
ENDMODULE.
Requires an SAP system; not run here. The statuses are example values of the running claim example: N for a new claim
and S for a stored one.
Example: a claim entry dialog
The module pool below belongs to the expense claims example of this section. It shows one screen, 0100, with two input fields
for the claim number and the total, a Save pushbutton and the standard Back and Cancel functions. It uses the table
ZEXP_CLAIM of DDIC Tables and Structures. The screen needs
these parts, created in SAP GUI, because source text alone cannot define them.
| Object | Setting |
|---|---|
Program |
Type module pool ( |
Dynpro |
Type normal, next dynpro |
GUI status |
Function codes |
GUI title |
The text "Expense claim". |
Transaction |
Dialog transaction, program |
Flow logic of the dynpro 0100:
PROCESS BEFORE OUTPUT.
MODULE status_0100.
PROCESS AFTER INPUT.
MODULE exit_0100 AT EXIT-COMMAND.
FIELD zexp_claim-total_amount MODULE check_amount_0100.
MODULE user_command_0100.
Main program:
PROGRAM zexp_claim_dialog.
TABLES zexp_claim.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'T100'.
ENDMODULE.
MODULE exit_0100 INPUT.
LEAVE TO SCREEN 0.
ENDMODULE.
MODULE check_amount_0100 INPUT.
IF zexp_claim-total_amount <= 0.
" An E message makes only the field of the FIELD statement ready for input again.
MESSAGE 'Enter an amount above zero' TYPE 'E'.
ENDIF.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'SAVE'.
zexp_claim-status = 'N'.
INSERT zexp_claim FROM @zexp_claim.
IF sy-subrc = 0.
MESSAGE 'Claim saved' TYPE 'S'.
ELSE.
MESSAGE 'Claim number already exists' TYPE 'S' DISPLAY LIKE 'E'.
ENDIF.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE.
Requires an SAP system; not run here: it needs the Screen Painter objects of the table above, the Dictionary table
ZEXP_CLAIM and a dialog transaction. The message texts are literals only to keep the example short; a real program uses a
message class. A real program also fills the key fields that the table requires, such as the employee number, which this
sketch leaves out.
Follow one round. The user starts ZEXPC, which shows 0100. PBO sets the status and the title. The user types a claim
number and an amount and presses Save. The values are copied into zexp_claim, the function code SAVE into ok_code, and PAI
runs: the exit module is skipped (SAVE has no function type E), check_amount_0100 runs because the field total_amount
was transported, and then user_command_0100 stores the line. Since the next dynpro is 0100, the screen is shown
again after its PBO, with the status message in the status bar. BACK leaves with LEAVE TO SCREEN 0 and the transaction ends.
Table controls and step loops
A table control shows several lines of an internal table in a grid on the screen, so that the user can scroll, select lines and edit values. It is drawn in the Screen Painter (a wizard helps) and needs three things in the program and the flow logic.
-
A declaration in the program:
CONTROLS tc TYPE TABLEVIEW USING SCREEN 0100.creates a structure of the nametcwith the typecxtab_controlfrom the type poolCXTAB. Its components hold the properties of the control: the number of fixed columns,linesfor the scroll bar,top_line, the line selection mode, and incolsone line for each column with theSCREENproperties of that column. The componentcurrent_lineis read-only. -
In the flow logic, a loop for each table control, both in PBO and in PAI:
LOOP WITH CONTROL tc.…ENDLOOP.The loop runs once for every line that is displayed. Inside it you can placeMODULE,FIELDandCHAIN. Loops cannot be nested. In the loop,sy-steplis the number of the current line in the visible part andsy-loopcthe number of lines displayed. -
The data of the lines. The simple form, without
AT itab, copies the fields of the displayed line into the data objects of the same name for each pass (here the screen fields are namedGS_ITEM-...), and your module moves them between those and the internal table.
* In the program:
CONTROLS tc_items TYPE TABLEVIEW USING SCREEN 0100.
DATA: gt_items TYPE STANDARD TABLE OF zexp_claim_item,
gs_item TYPE zexp_claim_item.
MODULE fill_tc OUTPUT.
tc_items-lines = lines( gt_items ).
ENDMODULE.
MODULE read_line OUTPUT.
READ TABLE gt_items INTO gs_item INDEX tc_items-current_line.
ENDMODULE.
MODULE write_line INPUT.
MODIFY gt_items FROM gs_item INDEX tc_items-current_line.
ENDMODULE.
PROCESS BEFORE OUTPUT.
MODULE fill_tc.
LOOP WITH CONTROL tc_items.
MODULE read_line.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP WITH CONTROL tc_items.
MODULE write_line.
ENDLOOP.
Requires an SAP system; not run here. The table type ZEXP_CLAIM_ITEM is an invented example name for a table of expense
lines. In the program, READ TABLE and MODIFY with an index are the classic form; you can also use the loop with
AT itab of the flow logic, which moves the lines for you.
Source: ABAP Keyword Documentation: CONTROLS, TYPE TABLEVIEW; ABAP Keyword Documentation: dynpro - LOOP, WITH CONTROL
REFRESH CONTROL tc FROM SCREEN 0100. sets the properties of the control back to the values of its definition.
The older form is the step loop: a group of fields repeated on the screen, processed with a LOOP in the flow logic that has no
WITH CONTROL addition. It is obsolete. Older books and old programs still show step loops as the normal way to display
tables, so you can recognise them when maintaining code, but a new screen uses a table control and, in modern programs, an
ALV grid in a custom container (the Control Framework and GUI Controls page of this section covers it).
Tabstrips and subscreens
A subscreen is a dynpro of the type subscreen, drawn to fit in a subscreen area of another dynpro. It has its own flow logic and its own dialog modules, and it has no OK field and no GUI status. The main dynpro shows it in a subscreen area and calls its flow logic.
A tabstrip is a row of tabs that selects one of several subscreens. Make it in the Screen Painter; each tab title has a function code, and every tab page has one subscreen area, usually shared. In the program:
-
Declare
CONTROLS tabstr TYPE TABSTRIP.The structuretabstrhas one component that you need:activetab. -
Set
tabstr-activetabto the function code of the tab to show. The first tab is active when you set nothing. -
Provide the program name and the number of the subscreen that belongs to the tab, for example in two variables
proganddynnr. -
In the flow logic, call the subscreen in PBO with
CALL SUBSCREEN area INCLUDING prog dynnr., and in PAI withCALL SUBSCREEN area., so that both its PBO and its PAI run.
CONTROLS tabs TYPE TABSTRIP.
DATA: prog TYPE sy-repid,
dynnr TYPE sy-dynnr.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
prog = sy-repid.
IF tabs-activetab IS INITIAL.
tabs-activetab = 'TAB_DATA'.
ENDIF.
dynnr = COND #( WHEN tabs-activetab = 'TAB_DATA' THEN '0110' ELSE '0120' ).
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
IF save_ok = 'TAB_DATA' OR save_ok = 'TAB_NOTES'.
tabs-activetab = save_ok.
ENDIF.
ENDMODULE.
PROCESS BEFORE OUTPUT.
MODULE status_0100.
CALL SUBSCREEN sub_area INCLUDING prog dynnr.
PROCESS AFTER INPUT.
CALL SUBSCREEN sub_area.
MODULE user_command_0100.
Requires an SAP system; not run here. The tab titles have the function codes TAB_DATA and TAB_NOTES, the subscreens are 0110 and
0120, and the subscreen area is named SUB_AREA. Choosing a tab title raises PAI with its function code, and the program switches the page.
Dialog transactions
A module pool is started from outside through a transaction code, which you define in transaction SE93. The type that starts a
screen is the dialog transaction (called "Program and screen" in the creation dialog): it names the program and the initial
dynpro. The user types the code in the command field, or starts it from a menu, a role or a button of a Fiori launchpad
tile that wraps it. Other types of transaction code start a report, a class method, or a variant of another transaction.
For authorizations, the system checks the user before the start, and a transaction code can carry an authorization object
of its own. A program still has to do its own AUTHORITY-CHECK for the data it handles; the page
Calling Programs and Memory shows how transaction
authorization and CALL TRANSACTION work.
In a program, CALL TRANSACTION 'ZEXPC'. starts the transaction in a new internal session and continues after the statement
when it ends. LEAVE TO TRANSACTION 'ZEXPC'. ends the current program and starts the transaction in its place. An unknown
code raises an exception that cannot be caught. The addition AND SKIP FIRST SCREEN skips the initial screen when the
transaction can fill it from SPA/GPA parameters (the SAP memory of the user).
Common errors
| Symptom | Usual cause |
|---|---|
A field stays empty in the program |
The name of the dynpro field and of the global data object differ, even by one letter, or the data object is declared only locally. |
A button does nothing |
The function code in the element or the GUI status differs from the one in the |
The same action runs twice |
The OK field was not copied and cleared, so the function code stays in it. |
Short dump when a screen is called |
The called dynpro or dialog module does not exist in the main program. The exception cannot be caught. |
Cancel is refused with "fill in all required entry fields" |
The Cancel function does not have the function type |
A |
It runs in PAI, outside the loop |
Summary
-
A dynpro is a classic screen with a layout and flow logic. It belongs to one program, is drawn in the Screen Painter and exists only in classic ABAP, not in ABAP Cloud.
-
PBO prepares the display and PAI processes the input. Both call dialog modules, which share the global data of the program and have no parameters.
-
Data moves by name between the dynpro fields and the global data objects.
FIELDandCHAINcontrol when and what is checked, and anEmessage makes the field or the chain ready for input again. -
The OK field receives the function code of the user action; copy it, clear it and evaluate it with
CASE. -
SET SCREEN,LEAVE TO SCREEN,CALL SCREENand the static next dynpro control the sequence of screens, and a next dynpro of0ends it.SET PF-STATUSandSET TITLEBARgive each screen its menu and caption. -
LOOP AT SCREENwithMODIFY SCREENchanges elements for one display; table controls, tabstrips and subscreens add tables and tab pages. A dialog transaction starts a module pool from SE93.