ABAP Dialog Programming Techniques - BC410

Naming convention for Module pool objects
SAPMV45A -Program
MV45AF01 -Form include
MV45AO01 -PBO include
MV45AI01 -PAI include
MV45ATOP -Data declaration

SAPZNAME -User defined Program
ZNAMEF01 -User defined Form include
... Types of screen

•	List
•	Selection
•	Dialog
•	Normal
	•	Subscreen (Half screen)
	•	Modal dialog box (Choice screen -YES, NO,CANCEL)
	•	Selection screen
	•	Class screen (4.6)



Basic Screen Processing
Leave to screen 0. (Exits back to first screen)

Call screen 100. (Calls screen 100)

Set screen 100. (Reassigns next screen value)
Leave screen. (Leaves to next screen).

Leave program. (Leaves Program)

Dialog GUI Components
Menu Bar
Standard Toolbar
Application Toolbar
Key Settings

GUI Status program declaration
SET PF-STATUS <ZSTATUS>.
SET TITLEBAR <NNN>. i.e. 100

SET pf-status 'STATUS' EXCLUDING
Exclude multiple function codes. Itab would look like this:
Data: Begin of itab occurs 0.
Fcode like sy-ucomm.
Data: End of itab.

SET pf-status SPACE. "To deactivate previous status and activate default list

SET pf-status 'STATUS' WITH …...

Types of GUI Status
• Online status
• Dialog
• Contex

Function Codes
Function Type:
' ' Normal
'E' Exit
'S' System
'T' Transaction
'P' Tabst. Control
'H' Help request

Text type:
• Static (used on menu + app button if no icon assined.
• Dynamic

Static function texts:
• Function text |_____|
• Icon name |_____| - Used on app button
• Icon text |_____| - Used on app button
• Info. text |_____| - Used when user holds cursor over button.
• Fastpath |_____|

Key Assignments.
• Reserved function keys
• Recommended function keys
• Freely assigned function keys

Application tool bar
• App toolbar can have up to 35 push buttons
• Functions on app toolbar must be assigned to and Fkey.
• If you use the fixed posistion attribute (pad lock icon) inactive function are grey out rather than removed.

Menu
• A menu can contain up to 15 entries
• Menus can be up to 3 levels.
• The menubar can contain up tp 8 different menus (including 2 standard ones, system and help)

Activate or Deactivate functions
• Active/inactive button
• SET pf-status 'STATUS' EXCLUDING <fcode> <itab>

Set defaults GUI Status values
To provide appropriate default function codes, depending on type of status/screen goto the following menu path within the gui staus creation screen.

Extras -> Adjust template
• List status
• Selection screen
• List viewer
• Tree status
• Template status (copy status)
Program |_____________|
Status |_____________|

Get field clicked on

GET CURSOR 	FIELD fieldname
		[LINE] fieldname or structure(store rep line)

Modify List line
Modify CURRENT LINE FIELD VALUE FROM <field>
Or
Modify CURRENT LINE LINE VALUE FROM <field>


SCREEN -NAME
SCREEN -GROUP1
SCREEN -GROUP2
SCREEN -GROUP3
SCREEN -GROUP4
SCREEN -REQUIRED
SCREEN -INPUT
SCREEN -OUTPUT
SCREEN -INTENSIFIED
SCREEN -INVISIBLE
SCREEN -LENGTH
SCREEN -ACTIVE
SCREEN -DISPLAY_3D
SCREEN -VALUE_HELP
SCREEN -REQUEST
SCREEN -VALUES_IN_COMBO
SCREEN -COLOR
ABAP code to modify Screen fields

Loop at screen.
	If screen-name EQ 'SFLIGHT-CONNID'
Or	If screen-group
 	                    ETC.
                  Screen-input = ' '.
                  Modify screen.
               Endif.
Endloop

Insert ICONS
Place Status ICON field on screen (i.e. icon1)

Use CALL FUNCTION 'ICON_CREATE' from within PBO to assign ICON to 'Status ICON field' on screen.

Declare DATA statement for each icon.
(i.e DATA: icon1 LIKE ICONS-TEXT)

Leaving screen
Set Screen 200. "Sets next screen value
Leave screen. "Leaves to next screen value
Leave to screen 200 "Leaves to screen 200
Leave to screen 0 "Returns to point where screen was called

CURSOR Position
Can be set in a number of ways:
• Within the ABAP(PBO): SET CURSOR field 'SFLIGHT-CONNID'.
• Within screen attributes (Settings)

Screen numbers
• Numbers greater than 9000 are reserved for SAP customers
• Numbers 1000 through 1010 are reserved for maintenance screen of ABAP dictionary tables and the standard selection screen report.

TABLES Statement
If you create screen fields based on DATABASE table fields (I.e. EKKO-EBELN) remember the TABLES: statement. This creates a WA with the same name and structure as the DB table.

BUT……………
TABLES: makes and interface between the Program(ABAP) and the screen:

TABLES: SFLIGHT Does NOT work the same as DATA: SFLIGHT TYPE SFLIGHT

Note: The TABLES: statement will populate the screen fields the DATA: statement will not.

TABLES: VBAK, "Creates WA based on VBAK
*VBAK. "Creates second WA based on VBAK

CALL Screen
CALL SCREEN 100
STARTING AT
ENDING AT

Get / SET PArameter ID
Get Parameter "Get value stored in Parameter ID
Set Parameter "Store entered value in Parameter ID

Flow Logic
FIELD SPFLI-CARRID MODULE validate_carrid.
"If the module 'validate_carrid' produces and Error message, it returns to screen making field SPFLI-CARRID ready for INPUT. Without this all fields would be output only.

CHAIN.
FIELD: SPFLI-CARRID,
SPFLI-CONNID. MODULE 'validate_carrid_connid'.
ENDCHAIN.
"Returns to screen making multiple field ready for INPUT.

FIELD SPFLI-CARRID MODULE validate_carrid ON INPUT
"Has the contents of the field changed from its initial value.

CHAIN.
FIELD: SPFLI-CARRID,
SPFLI-CONNID.
MODULE 'validate_carrid_connid' ON CHAIN-INPUT
ENDCHAIN.
"Has the contents of any of the fields changed from its initial value.

ON REQUEST and ON CHAIN-REQUEST
"Similar to ON INPUT but checksif contents of field has changed since the last time the screen was displayed.





















Related Articles

Insert image onto SAP screen
Insert image onto SAP screen
Creating your first ABAP dialog screen program in SAP
SAP ABAP dynpro programs, dialog screen programs with input fields, buttons, OO ALV grids etc..
SAP ABAP dynpro programs, dialog screen programs with input fields, buttons, OO ALV grids etc..
SAP dialog screen / dynpro Exit Command
Dialog programming, dynpro screen field validation
SAP Graphics Development - Example code and information on various areas of graphics development
Grouping SAP dynpro screen radiobuttons
Add a dropdown list to a SAP dynpro screen using the Listbox option
Implementing a subscreen to an ABAP dynpro screen with SAP
F4 help functionality for a dynpro screen field using the PROCESS ON VALUE-REQUEST statement