module 05_utility topics

25
IBM Global Business Services © IBM Corporation 2013 Utility Topics 1 Welcome Welcome

Upload: bakkalibilal

Post on 18-Jan-2016

16 views

Category:

Documents


0 download

DESCRIPTION

Module 05_Utility Topics

TRANSCRIPT

Page 1: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics1

WelcomeWelcome

Page 2: Module 05_Utility Topics

© IBM Corporation 2013

(Optional client logo can

be placed here)

IBM Global Business Services

Course Title

Module 5: Module 5: Utility Topics

Page 3: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics3

Housekeeping

Breaks Washrooms Transportation / parking No pagers or cell phones Participation Parking lot issues Questions

Page 4: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics4

Module objectives

At the completion of the module, the participants should be able to: Understand Subscreen Understand Graphical User Interface Understand Message Types

Page 5: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics5

Module agenda

The topics dealt in this module are: Subscreen Area in ‘Main’ Screen ‘CALL SUBSCREEN’ in PBO ‘CALL SUBSCREEN’ in PAI Creating a Subscreen Subscreen restrictions Menu Painter Set GUI status / Title in PBO module Checking Function Code Triggered Using the OKCODE Function types MESSAGE statement User Messages Table Message types

Page 6: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics6

Subscreen Area in ‘Main’ Screen

This subscreen areamust be given a name

up to 10 characterslong (for example, ‘SUB1’)

Page 7: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics7

‘CALL SUBSCREEN’ in PBO

Customer 11

Name Tools International

Subscreen Area

SUB1

Bank Information

(Subscreen)

PROCESS BEFORE OUTPUT. ‘for main screen 9010’

* CALL SUBSCREEN <area> INCLUDING <program> <subscreen #>.

CALL SUBSCREEN SUB1 INCLUDING ‘SAPMZSUB’ SCREEN_NUM.

This SCREEN_NUM variable

contains the number of the

subscreen to display in the specified

subscreen area.

Address Information

(Subscreen)

Page 8: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics8

‘CALL SUBSCREEN’ in PAI

Customer 11

Name Tools International

Address Information

(Subscreen 9020)

PROCESS AFTER INPUT. “for main screen 9010

* CALL SUBSCREEN <area>.

CALL SUBSCREEN SUB1.

To invoke the PAI event of the

actual subscreen, the

CALL SUBSCREEN statement

must be used in

the PAI event of the ‘main’ screen.

Page 9: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics9

Creating a Subscreen

Screen Attributes

Screen Type = Subscreen

Address Information

(Subscreen 9020)Bank Information

(Subscreen 9030)

ScreenScreen PainterPainterScreenScreen PainterPainter

Page 10: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics10

Subscreen restrictions

Page 11: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics11

Graphical User Interface (GUI)-an overview

Academy Awards

Year

Category

1994

PIC

Exit Edit Loop

Academy Awards

Year

Winner Forrest Gump

Notes The Shawshank Redemption should have won.

Exit Update

Menu Painter

Using the Menu Painter, we can add pushbuttons to the application toolbar on both screens.

***Important Questions***

Where do you set the GUI status / title?

What type of GUI status is used?

How do you check the function code triggered?

What are the different function types?1994

PIC Category

Page 12: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics12

Menu Painter

Menu Painter

Create function codes with a 20-character (maximum) identifier

Function Key

Assignments

Standard

Toolbar

Application

ToolbarMenu bar

Page 13: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics13

Set GUI status / Title in PBO module

** MZA05O01 - PBO Modules **

MODULE INITIALIZE OUTPUT.

IF SY-DYNNR = 9000.

SET PF-STATUS ‘FIRST’.

SET TITLEBAR ‘ONE’.

ELSE.

SET PF-STATUS

‘SECOND’.

SET TITLEBAR ‘TWO’.

ENDIF.

ENDMODULE.

PROCESS BEFORE OUTPUT.

MODULE INITIALIZE.

Screen 9000

PROCESS BEFORE OUTPUT. MODULE INITIALIZE.

Screen 9001

SY-DYNNR =Currentscreennumber

Notice that the call to module ‘INITIALIZE’ in the PBO of each screen refers to the same ABAP

module.

Page 14: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics14

Checking Function Code Triggered

** MZA05TOP - Top Include **

PROGRAM SAPMZA05 MESSAGE-ID ZA.

TABLES YMOVIE.

DATA OKCODE(4).

To check the OK Code of an Online program, you must define this field in

both the screen (Field List) and the program work area (Top Include).

Remember that these fields must be given the same name.

Page 15: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics15

Using the OKCODE

** MZA05I01 - PAI Modules **

MODULE SELECT_LISTING INPUT.

IF OKCODE = ‘EDIT’.

* code to select record from YMOVIE

ENDIF.

ENDMODULE.

** MZA05O01 - PBO Modules ** MODULE INITIALIZE OUTPUT. * code to set GUI status/title CLEAR OKCODE.

ENDMODULE.Academy Awards

Year

Category

1994

PIC

Exit Edit Loop

We only want to select a record

from YMOVIE if the user has

invoked the ‘EDIT’ function code

(for example, clicked on the ‘Edit’

pushbutton).

You should ‘clear out’ the

OKCODE before a screen is

so an old value does not remain

if the user presses ‘Enter’.

Page 16: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics16

Function types

Function Code: Function codes of different types can be created

Type ‘ ’: Program Function

Type ‘E’: Exit

Command

Type ‘S’: System

Function

Type ‘T’: Start

Transaction

Type ‘P’: Local GUI Function

Page 17: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics17

Messages-an overview

Academy Awards

Year

Category

1910

PIC

Academy Awards

Year

Category

1910

PIC

Winner No record exists

Notes

Enter

Academy Awards

Year

Category

1910

PIC

E: No record exists

X

Instead of informing the user on the second screen that a record

does not exist, we want to issue a message on

the first screen.

Page 18: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics18

MESSAGE statement

** MZA02TOP - Top Include **

PROGRAM SAPMZA02 MESSAGE-ID ZA.

TABLES YMOVIE.

** MZA02TOP - Top Include **

PROGRAM SAPMZA02 MESSAGE-ID ZA.

TABLES YMOVIE.

** MZA02I01 - PAI Modules **

MODULE SELECT_LISTING INPUT.

* code to select record from YMOVIE

IF SY-SUBRC <> 0.

YMOVIE-WINNER = ‘No record exists’.

MESSAGE E001.

ENDIF.

ENDMODULE.

** MZA02I01 - PAI Modules **

MODULE SELECT_LISTING INPUT.

* code to select record from YMOVIE

IF SY-SUBRC <> 0.

YMOVIE-WINNER = ‘No record exists’.

MESSAGE E001.

ENDIF.

ENDMODULE.

t = message type

nnn = message number

--------------------------------------

var1 = message variable 1

var2 = message variable 2

var3 = message variable 3

var4 = message variable 4

MESSAGE <tnnn> [WITH <var1> <var2> <var3> <var4>].

The ‘MESSAGE’ statement is used to issue user messages.

MESSAGE statement in PAI module of first screen.

Message class (ID) must be specified on PROGRAM

statement in Top Include.

Page 19: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics19

User Messages Table

T100

User Messages

Language (key)

Message ID (key)

Message # (key)

Message Text

Logon language

Message ID specified on PROGRAM statement

Message # (nnn) specified in MESSAGE statement

The ‘MESSAGE’ statement accesses user messages stored in the ABAP Dictionary table T100.

Actual message displayed to the user with the MESSAGE statement

Page 20: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics20

Message types

S: success

I: information

A: abend

X: exit

W: warning

E: error

i

X

A particular message text can be any one of six message types.

The message type determines where the

message is displayed and what action the user can or

must take on the current screen.

Page 21: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics21

Summary of the lesson learnt so far

Let us summarize the lesson learnt so far:A subscreen is a screen that is displayed in a specified area of another screen (the ‘main’ screen). A subscreen cannot be displayed by itself.To include a subscreen in a predefined area on the ‘main’ screen, use the ‘CALL SUBSCREEN’ statement in the ‘main’ screen’s PBO event.If the subscreen contains any PAI code, use the ‘CALL SUBSCREEN’ statement in the PAI event of the ‘main’ screen.A subscreen is created just like any other screen of an Online program. The only difference is the screen type specified in the Screen Attributes section of the Screen Painter. The screen type for a subscreen is appropriately called ‘Subscreen’.A program’s GUI is created in the Menu Painter.Each program has a single GUI that contains the defined function codes.

Page 22: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics22

Summary of the lesson learnt so far (continued)

The ‘MESSAGE’ statement is used to issue user messages. The syntax of this statement is: MESSAGE <tnnn> [WITH <var1> <var2> <var3> <var4>].

A particular message text can be any one of six message types: S-success, I-information, A-abend, X-exit, W-warning, and E-error.

The SUCCESS message is displayed at the bottom of the next screen; therefore, the user cannot make any changes to the values on the current screen.

The INFORMATION message is displayed on the current screen in a dialog box.

The ABEND message is displayed on the current screen in a dialog box. After clicking the ‘Enter’ key on the dialog box, the transaction will be terminated.

Page 23: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics23

Answer a few questions

1. What is a sub-screen in the context of Online programming?2. Can the ‘CALL SUBSCREEN’ statement be used in the PBO event?3. What is the use of the Menu Painter?4. What is a Function Code?5. What are the different types of screen messages?6. What is the difference between the SUCCESS and the INFORMATION

message?

Page 24: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics24

Module summary

Now that we have completed the module, we should be able to: Understand Subscreen Understand Graphical User Interface Understand Message Types

Page 25: Module 05_Utility Topics

IBM Global Business Services

© IBM Corporation 2013Utility Topics25

Thank You