Saturday, March 4, 2017

Summary of Dialog Programming Techniques

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:
When you create functions, you define a function code and a name. When a user chooses a function, the system stores the function code in the SY-UCOMM field. The code tells the system which function a user has chosen.
You can also assign a type to your functions. Function types can, for example, tell the system when or how to carry out a function.

' ' Normal


'E' Exit 
This type is for forcable EXIT from the screen. It will triggers an "at exit-command" module in the Process After Input (PAI) processing block (MODULE <xxx> AT EXIT-COMMAND). When the user selects an E type function, the system enters the "at exit-command" module before carrying out any input checks.

'T' Transaction 
When the user chooses a function with this type, the system leaves the current program (without performing any checks) and calls the new transaction.

'P' Tabst. Control


'S' System:
Triggers system functions used internally in SAP standard applications. You must not use type S when creating your own functions.

'H' Help function
Function types 'S and 'H' are reserved for internal use by SAP.

Text type:
• Static (used on menu + app button if no icon assigned)
• 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. 

No comments:

Post a Comment

SAP giới thiệu mã hỗ trợ AI trong ngôn ngữ ABAP riêng của mình

SAP đã ra mắt một loạt tính năng mã hỗ trợ AI trong môi trường phát triển ứng dụng dựa trên đám mây của mình, đồng thời tham gia vào danh sá...