+ All Categories
Home > Documents > Module 02_Online Programming Example

Module 02_Online Programming Example

Date post: 25-Dec-2015
Category:
Upload: bakkalibilal
View: 14 times
Download: 0 times
Share this document with a friend
Description:
Module 02_Online Programming Example
23
IBM Global Business Services © IBM Corporation 2013 Online Programming Example 1 Welcome Welcome
Transcript

IBM Global Business Services

© IBM Corporation 2013Online Programming Example1

WelcomeWelcome

© IBM Corporation 2013

(Optional client logo can

be placed here)

IBM Global Business Services

Course Title

Module 2: Module 2: Online Programming Example

IBM Global Business Services

© IBM Corporation 2013Online Programming Example3

Housekeeping

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

IBM Global Business Services

© IBM Corporation 2013Online Programming Example4

Module objectives

At the completion of the module, the participants should be able to: Create an Online program Use the object navigator Maintain the Screen attributes, Screen layout, Field attributes, Flow logic,

ABAP modules, and Global data Recognize screen to program data transport Execute an Online program

IBM Global Business Services

© IBM Corporation 2013Online Programming Example5

Module agenda

This module deals with the following topics: Creating an Online program Object Navigator Online Program Components Screen Attributes Screen Layout Field Attributes Flow Logic ABAP modules Global data Screen to Program Data Transport Executing an Online Program

IBM Global Business Services

© IBM Corporation 2013Online Programming Example6

Overview

In this module, we will create a simple Online program. This program will calculate a player’s scoring average.

IBM Global Business Services

© IBM Corporation 2013Online Programming Example7

Creating an Online program

Online program name must begin with ‘SAPM’

and then either a ‘Y’ or ‘Z’.

Go back to Repository Browser, not source

code.

‘With TOP INCL.’ should be checked.

Title

Type ‘MODULE’

Application

IBM Global Business Services

© IBM Corporation 2013Online Programming Example8

Object Navigator

Main Program

** SAPMY220_PLAYER_AVG **

INCLUDE MY220_PLAYER_AVGTOP.

Top Include

** MY220_PLAYER_AVGTOP - Include Program **

PROGRAM SAPMY220_PLAYER_AVG.

IBM Global Business Services

© IBM Corporation 2013Online Programming Example9

Online Program Components

Enter a screen number and click on the

‘Create’(F5) pushbutton.

In the Online program’s hierarchy list in the Object Navigator, double-click on the program name and then single click on the icon ‘other objects(shift+F5)’ application toolbar to create program components.

IBM Global Business Services

© IBM Corporation 2013Online Programming Example10

Screen Attributes

Screen Attributes

Screen Painter

Short Description Screen Type Next Screen

Required Required Optional

For each screen you create, you must maintain the Screen Attributes in the Screen Painter. There are two required fields in the Screen Attributes section.

IBM Global Business Services

© IBM Corporation 2013Online Programming Example11

Screen Layout

Fullscreen Editor

Player_Average

Total_Points ______

Total_Games ______Input / output templates are created with underscores.

Use an underscore to link words into one text field.

Screen Painter

Text fields are created with

character strings.

IBM Global Business Services

© IBM Corporation 2013Online Programming Example12

Field Attributes

Element List

Field name, not text Field format

Input and output turned ‘on’

Screen Painter

IBM Global Business Services

© IBM Corporation 2013Online Programming Example13

Flow Logic

Flow Logic

Screen Painter

PROCESS BEFORE OUTPUT.

MODULE INITIALIZE.

PROCESS AFTER INPUT.

MODULE CALCULATE.

Flow

Logic

Command

ABAP module to clear all fields before

screen is displayed.

ABAP module to calculate average

after user has entered values and clicked

‘Enter’.

Screen 9000Screen 9000

The Flow Logic refers to the code behind the screens and it is maintained in the Screen Painter. Each screen has its own Flow Logic which is divided into two main events, PBO and PAI.

IBM Global Business Services

© IBM Corporation 2013Online Programming Example14

ABAP modules

** SAPMYOP_PLAYER_AVG **

INCLUDE MYOP_PLAYER_AVGTOP.

INCLUDE MYOP_PLAYER_AVGO01.

INCLUDE MYOP_PLAYER_AVGI01.

Main Program PBO Module

** MYOP_PLAYER_AVGO01 - Include Program **

MODULE INITIALIZE OUTPUT.

CLEAR: POINTS, GAMES, AVERAGE

ENDMODULE.

PAI Module

** MYOP_PLAYER_AVGI01 - Include Program **

MODULE CALCULATE INPUT.

CHECK GAMES <> 0.

AVERAGE = POINTS / GAMES.

ENDMODULE.

The fields POINTS, GAMES, and AVERAGE need to be

defined as global data.

IBM Global Business Services

© IBM Corporation 2013Online Programming Example15

Global data

Top Include

** MYOP_PLAYER_AVGTOP - Include Program **

PROGRAM SAPMYOP_PLAYER_AVG.

DATA: POINTS TYPE I,

GAMES TYPE I,

AVERAGE TYPE P

DECIMALS 2.

Main Program

** SAPMYOP_PLAYER_AVG **

INCLUDE MYOP_PLAYER_AVGTOP.

INCLUDE MYOP_PLAYER_AVGO01.

INCLUDE MYOP_PLAYER_AVGI01.

It is important that these program fields are named the same as the

screen fields so that automatic data transport will occur between the Screen Work Area and Program

Work Area.

IBM Global Business Services

© IBM Corporation 2013Online Programming Example16

Screen to Program Data Transport

When the PAI event is triggered, values are transported from the Screen Work Area to the program fields with the same names before any PAI modules are executed.

IBM Global Business Services

© IBM Corporation 2013Online Programming Example17

Executing an Online Program

Transaction Code

Transaction Text Program Name Initial Screen

Required Required Required

To execute an Online program, you must create a transaction code. You cannot use the ‘F8’ key or ‘Program > Execute’ menu path to execute an Online program.

SAPMY220_PLAYER_AVG 9000

IBM Global Business Services

© IBM Corporation 2013Online Programming Example18

Demonstration / Practice

For creation of an Online program to display a player’s scoring average: Two screens are required to be created for this program. The first screen takes the total points and the number of games as input. The scoring average is output in the next screen.

IBM Global Business Services

© IBM Corporation 2013Online Programming Example19

Summary of the lesson learnt so far

Let us summarize what we have learnt so far:When you create an Online program, its name must begin with ‘SAPM’ and then either a ‘Y’ or ‘Z’. The last characters in the program ‘SAPMzaaa...’ can be letters or numbers.The program type is ‘M’ for module pool. This type ‘M’ will automatically be defaulted for you if your program name begins with ‘SAPM’.In the Object Navigator, you can double-click the Online program name to see the program’s hierarchy of sub-objects (components). From this hierarchy list, you can create all the components of the Online program by double-clicking on the ‘Program object types’ branch.For each screen you create, you must maintain the Screen Attributes in the Screen Painter.You maintain the physical layout of a screen in the Fullscreen Editor of the Screen Painter.Use the Element List tab for the screen to name the screen fields.

IBM Global Business Services

© IBM Corporation 2013Online Programming Example20

Summary of the lesson learnt so far (continued)

The Flow Logic refers to the code behind the screens and it is maintained in the Screen Painter.

The PBO and PAI modules contain the main processing logic of the Online program and are ‘called’ from within the Flow Logic of the screens with the MODULE command.

The global data for an Online program is declared in the Top Include program. When the PAI event is triggered, values are transported from the screen work

area to the program fields with the same names before any PAI modules are executed.

To execute an Online program, you must create a transaction code. You cannot use the ‘F8’ key or ‘Program -> Execute’ menu path to execute an online program.

IBM Global Business Services

© IBM Corporation 2013Online Programming Example21

Answer a few questions

PROCESS BEFORE OUTPUT.

MODULE CALCULATE.

PROCESS AFTER INPUT.

Screen 9001

PROCESS BEFORE OUTPUT.

MODULE INITIALISE.

PROCESS AFTER INPUT.

MODULE CALCULATE.

Screen 9000

We could have calculated the player’s average in the PBO of screen 9001. Why is it better to do the calculation in the PAI of screen 9000 instead of the

PBO of screen 9001?

IBM Global Business Services

© IBM Corporation 2013Online Programming Example22

Module summary

Now that we have completed this module, we should be able to: Create an Online program Use the object navigator Maintain the Screen attributes, Screen layout, Field attributes, Flow logic,

ABAP modules and Global data Recognize screen to program data transport Execute an Online program

IBM Global Business Services

© IBM Corporation 2013Online Programming Example23

Thank You


Recommended