Você está na página 1de 36

IBM Global Business Services

Step-by-Step Instructions for Making a GUI

Step-by-Step Instructions for Making


a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Objectives
The participants will be able to:
Use SET PF-STATUS syntax and be able to create a GUI Status.
Assign Function Codes to Function Keys.
Add an Icon to a Function Code.
Create Pushbuttons on the Application Toolbar.
Use The SY-PFKEY System Field.

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Coding Example
Using SET PF-STATUS and Creating a GUI Status
DATA:WA_LFA1 TYPE LFA1.
SELECT *

CHECK
SY-SUBRC

START-OF-SELECTION.
SELECT * FROM LFA1 INTO WA_LFA1.
WRITE: / WA_LFA1-LIFNR, 30 WA_LFA1-NAME1.
ENDSELECT.
SET PF-STATUS TEST1.

A New
ABAP
Reserved Word

SYNTAX: SET PF-STATUS <status name>.

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Double Clicking GUI Status Name


REPORT YGUI1-XX.

SELECT *

DATA: WA_LFA1 TYPE LFA1.

CHECK
SY-SUBRC
Double-click on the
word TEST1.

START-OF-SELECTION.
SELECT * FROM LFA1 INTO WA_LFA1.
WRITE: / WA_LFA1-LIFNR, 30 WA_LFA1-NAME1.
ENDSELECT.
SET PF-STATUS TEST1.

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Letting the System Create the GUI Status for You

Choose YES

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Entering Administrative Information

Enter Some
Descriptive text
Choose Normal
Screen as Status
Type

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Menu Painter Initial Display


You will create that
will appear on the
Menu Bar of your
GUI status by using
these white text
boxes
You create the
buttons that will
appear on the
Application Toolbar
of your GUI status by
using these white
text boxes

Function Key
assignments
for all buttons
are shown
here

Use the Drop-down button to get the Function Code

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Expanding Menu Painter Display

Application Toolbar
in the Menu Painter

Standard Toolbar in
the Menu Painter
Standard Toolbar
of your program
Application Toolbar
of your program

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Assigning Function Codes to Function Keys


1st.
Click once here. This is where we
will define our first function code.

2nd.
To create a function code with an
icon associated to it, double-click
on the function code, then choose
an icon.

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Adding an Icon to a Function Code

Choose any icon.

10

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Function Code Attributes

11

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Creating Pushbuttons on the Application Toolbar

Type the function codes (RUNX


and RUNY) of your buttons into
the next available white text
boxes on the application toolbar.
Click SAVE to see the icons
appear below the white boxes.

12

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Adding a Menu

Select the first available white


text box for the menu bar, now
populated with <List> and type
Test Menu. Double-click on
this menu title to open it up (see
next slide).

13

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Adding a Menu Path

TIP: If you wish to create a menu item with a


breakout (submenu), leave the entry in the Func.
column blank, and type a menu item name in the
Name column. Then type a function code in the
breakout menu which appears.

Type RUNX and


RUNY here.

14

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Automatic Recognition of Function Codes


The GUI must be
activated

15

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Demonstration
Creation of a GUI status with pushbuttons on application toolbar and customized
menu.

16

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Practice
Creation of a GUI status with pushbuttons on application toolbar and customized
menu.

17

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Using AT USER-COMMAND to Detect Function Codes

AT USER-COMMAND.
CASE SY-UCOMM.
WHEN RUNX.
WINDOW STARTING AT 10 4
ENDING AT 77 12.
WRITE: / The user chose X.
WHEN RUNY.
WINDOW STARTING AT 10 4
ENDING AT 77 12.
WRITE: / The user chose Y.
ENDCASE.

18

Step-by-Step Instructions for Making a GUI |

Enter this code for the AT


USER-COMMAND event.

Dec-2008

IBM Corporation 2013

IBM Global Business Services

GUI Status for Detail Lists

Do you notice the problem with this GUI


Status?

19

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Problem with Detail List GUI Status

Problem:
How does the user exit this window?
There should be a button on the bottom of this window
that allows the user to go back.
For now just use the control menu box to
close this window.

20

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Using a Different GUI Status Type for Dialog Boxes

NEW AND IMPROVED: TEST2


Dialog box GUI Statuses automatically contain a
red cancel button.

21

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Demonstration
Creation of Dialog boxes with Exit button.

22

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Practice
Creation of Dialog boxes with Exit button.

23

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

A Report that Uses more than One GUI Status - Code


AT USER-COMMAND.
CASE SY-UCOMM.
WHEN RUNX.
SET PF-STATUS TEST2.
WINDOW STARTING AT 10 4
ENDING AT 77 12.
WRITE: / The user chose X.
WHEN RUNY.
WINDOW STARTING AT 10 4
ENDING AT 77 12.
WRITE: / The user chose Y.
ENDCASE.
Add this line of code. Then double-click
on the word TEST2.

24

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

A Report that Uses More than One GUI Status - Administrative

Add some descriptive text,


then choose Dialog box as
the Status Type.

25

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

A Report that Uses More than One GUI Status - Menu Painter

Notice that Dialog Box statuses do


not have menus or standard toolbars.

26

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Function Codes Automatically Recognized by ABAP


Function Code

Functionality

Associated
function key

BACK

Back

F3

RW

Cancel

F12

%EX

End

F15

P--

Scroll to beginning

F21

P-

Scroll back one page

F22

P+

Scroll forward one


page

F23

P++

Scroll to end

F24

27

Step-by-Step Instructions for Making a GUI |

Dec-2008

Button on
Toolbar

IBM Corporation 2013

IBM Global Business Services

Coding Example : A Report that Uses More Than One GUI


Status
AT USER-COMMAND.
Add this line of code.
CASE SY-UCOMM.
WHEN RUNX.
SET PF-STATUS TEST2.
WINDOW STARTING AT 10 4
ENDING AT 77 12.
WRITE: / The user chose X.
WHEN RUNY.
SET PF-STATUS TEST3.
WINDOW STARTING AT 10 4
ENDING AT 77 12.
WRITE: / The user chose Y.
ENDCASE.

28

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

The SY-PFKEY System Field


Which status is currently being used?

A New
ABAP
System Field

SY-PFKEY = TEST1
SY-PFKEY = TEST3

SYSTEM FIELD: SY-PFKEY

29

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Demonstration
Use of more than one GUI Status in a program.

30

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Practice
Use of more than one GUI Status in a program.

31

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Coding Example: Adding a GUI Title


AT USER-COMMAND.
CASE SY-UCOMM.
WHEN RUNX.
SET PF-STATUS TEST2.
SET TITLEBAR TB2.
WINDOW STARTING AT 10 4
ENDING AT 77 12.
WRITE: / The user chose X.
WHEN RUNY.
SET PF-STATUS TEST3.
WINDOW STARTING AT 10 4
ENDING AT 77 12.
WRITE: / The user chose Y.
ENDCASE.

A New
ABAP
Reserved Word

SYNTAX: SET TITLEBAR <titlebar name>.

32

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Adding A GUI Title - Administration

First
Choose Yes.
Second
Type in the text that you
want to appear on the titlebar
of your GUI Status. Use
ampersands (&) if you want to use
variables. Then choose Save.

33

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Graphical User Interface


Programs GUI

Status 1

Status 2

RUNX
RUNY
RUNZ

RUNX

Function Codes
for Entire GUI
RUNA
RUNB
RUNC
RUNX
RUNY
RUNZ

RUNA

Status 3

Status 4

RUNC

RUNB

RUNY

34

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Summary
GUI status name can be up to 20 characters and must be in Capital letters.
SY-PFKEY contains the name of current GUI status.
Dialog Box status does not have Menu or a Standard Toolbar.
GUI Title names can be up to 20 characters and must be in Capital letters.
Whenever we create a new window or dialog box, the exit button from the control
menu must be used. Options to exit must be provided to the user.
A program can have any number of GUI statuses defined.
Function Codes can be defined with a maximum four characters long.

35

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

IBM Global Business Services

Questions
What are the naming restrictions for a PF status ?
What are the naming restrictions for a GUI title ?
What is the difference between a Normal Screen and a Dialog Box status ?
What is the problem if the no buttons or Function codes are not included from the
control menu in a dialog box ?
How many GUI status can be defined for a program ?
Can we pass parameters to GUI title ?

36

Step-by-Step Instructions for Making a GUI |

Dec-2008

IBM Corporation 2013

Você também pode gostar