Chapter 02_Online Programming Example
Chapter 02_Online Programming Example
Objectives
Overview
In this chapter, we will create a simple online program. This program will
calculate a player’s scoring average.
Title
“With TOP INCL.”
should be checked.
Type “MODULE”
Go back to Repository
Browser, not source Application
code.
Object Navigator
Main Program
** SAPMY220_PLAYER_AVG **
INCLUDE MY220_PLAYER_AVGTOP.
Top Include
Screen Attributes
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.
Screen Painter
Screen Attributes
Screen Layout
Screen Painter
Fullscreen Editor
Field Attributes
Screen Painter
Element List
Flow Logic
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.
Screen Painter
Flow Logic
Screen 9000
ABAP Modules
PAI Module
Global Data
Main Program
It is important that these program
** SAPMY220_PLAYER_AVG ** fields are named the same as the
screen fields so automatic data
INCLUDE MY220_PLAYER_AVGTOP. transport will occur between the
INCLUDE MY220_PLAYER_AVGO01. screen work area and program work
INCLUDE MY220_PLAYER_AVGI01. area.
Top Include
** MY220_PLAYER_AVGTOP - Include Program **
PROGRAM SAPMY220_PLAYER_AVG.
DATA: POINTS TYPE I,
GAMES TYPE I,
AVERAGE TYPE P
DECIMALS 2.
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.
Transaction Code
SAPMY220_PLAYER_AVG 9000
Demonstration
Practice
Summary
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 on 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 (see next slide).
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.
Summary (Contd.)
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.
Questions
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?