Você está na página 1de 44

ABAP Program Types

Report
ReportPrograms
Programs Online
OnlinePrograms
Programs

Conventional

Interactive Report
Developing Online Programs

Screen
ScreenPainter
Painter ABAP
ABAPEditor
Editor

Repository Browser
+Program object types
+Dictionary structures
+Global data
+PBO modules
+ PAI modules
+Subroutine

ABAP
ABAPDictionary
Dictionary Menu
Menupainter
painter
Screen Components

Screen
ScreenPainter
Painter Screen
Screen
Attributes
Attributes

Screen
ScreenLayout
Layout

Field
FieldAttributes
Attributes
Flow
FlowLogic
Logic
Screen Layout

ABAP/4
FI/CO
M
M
ABAP Program Components

Top
TopInclude
Include
ABAP
ABAP
PBO
PBOModule
Module

Subroutine PAI
PAIModules
Modules
Subroutine
Online Program Processing
Control
Dynpro Processor ABAP Processor

** Include MZAG001
**Screen 900 ** Module clear output.
Process Before OUTPUT. ….
Module Clear End module.

**Include MZAVGO01
MODULE Check INPUT.
**Screen 9001 ** ………..
Process before output End module
MODULE Select INPUT.
……….
End module
Online Program Work Areas

PBO
Screen Work Area Program Work Area
Name Data name(10)
Honey Honey
Identical
Phone Names
Data num(10)
011-5509767

PAI
Overview

Player
PlayerAverage
Average

Total
TotalPoints
Points 165
Total
TotalGames
Games6

Player
PlayerAverage
Average

Total
TotalPoints
Points 165
Total
TotalGames
Games 6
Points/games
Points/games27.50
Creating an Online Program

Online program name must


begin with “SAPM” and then
Either a “Y” or “Z”

“With Program Attribute


“WithTOP
TOPINCL.”
INCL.”
should
shouldbe
bechecked.
checked. Title

Type “M”
Go
Goback
backtotothe
theBrowser,
Browser,
not
notsource
sourcecode.
code. Application
Repository Browser

Main Program

**
**SAPMY220_PLAYER_AVG**
SAPMY220_PLAYER_AVG**
INCLUDE
INCLUDEMY220_PLAYER_AVGTOP
MY220_PLAYER_AVGTOP

Top Include

**MY220_PLAYER_AVGTOP-Include
**MY220_PLAYER_AVGTOP-IncludeProgram**
Program**
Program
ProgramSAPMY220_PLAYER_AVG.
SAPMY220_PLAYER_AVG.
Online Program Components
• Print Screen is needed
Screen Attributes

Screen
ScreenAttributes
Attributes

Short
ShortDescription
Description Screen
ScreenType
Type Next
NextScreen
Screen

Required Required Required


Screen Layout

Full Screen Editor

Text
Textfields
fieldsare
are
Created
Createdwith
with Player_Average
Player_Average
character
characterstrings
strings Total_Points
Total_Points
Total_Games
Total_Games
Use
Useananunderscore
underscore
to Input/output
Input/output
to templates
link
linkwords
wordsinto
into templates
one are
arecreated
createdwith
with
onetext
text Underscores.
Underscores.
Field Attributes
Flow Logic

Screen
Screen9000
9000
Process Before Output ABAP
ABAPmodule
moduleto
toclear
clear
Module initialize. all
allfields
fieldsbefore
beforescreen
screenisis
displayed.
displayed.
Process after input ABAP
Module calculate ABAPmodule
moduletoto
calculate
calculateaverage
averageafter
afteruser
user
has
hasentered
enteredvalues
valuesand
and
Flow
Flow pressed
pressed‘Enter’
‘Enter’
Logic
Logic
Command
Command
ABAP Modules
Main Program PBO Module
**SAPMY220_PLAYER_AVG**
**SAPMY220_PLAYER_AVG** **My220_player_avgO01
**My220_player_avgO01
Include
Includemy220_player_avgtop. Program
Include
my220_player_avgtop. Program** **
Includemy220_player_avgO01.
my220_player_avgO01. MODULE
Include MODULEINTIALIZE
INTIALIZEOUTPUT.
OUTPUT.
Includemy220_player_avgI01
my220_player_avgI01 Clear:
Clear:Points,
Points,games,
games,
average.
average.
The End
Endmodule.
module.
Thefields
fields
POINTS,
POINTS,
GAMES, PAI Module
GAMES,
and
andAVERAGE
AVERAGEneed need **My220_player_avgi01
**My220_player_avgi01
to
tobe
bedefined
definedasasglobal
global Module
Modulecalculate
calculateinput.
input.
data
data Check
Checkgames
games<>0.
<>0.
Average
Average==point/games.
point/games.
End
Endmodule.
module.
Global Data

Main Program
ItItisisimportant
important
that
that
**SAPMY220_PLAYER_AVG**
**SAPMY220_PLAYER_AVG** these program
Include these program
Includemy220_player_avgtop.
my220_player_avgtop. fields
fieldsare arethe
thenamed.
named.
Include my220_player_avgO01. The
Include my220_player_avgO01.
Include The same asaathe
same as the
Includemy220_player_avgI01
my220_player_avgI01 screen fields
screen fields so so
automatic
automaticdata datatransport
transport
Will occur between
Will occur between
The
Thescreen
screenwork workarea
PBO Module and program
area
and program
Work
Workarea area
**MY220_player_avgtop
**MY220_player_avgtop––include
includeprogram
program
Program SAPMY220_player_avg.
Program SAPMY220_player_avg.
Data:
Data:Point
Pointtype
typeI,I,
Games
Gamestypes
typesI,I,
Average
Averagetype
typeppdecimals
decimals2.2.
Screen to Program Data Transport

Process
ProcessBefore
BeforeOutput
Output
Module
Moduleinitialize
initialize When
WhenthethePAI
PAIevent
eventisistriggered,
triggered,
Process
Processafter
afterinput
input values
valuesare
aretransported
transportedfrom
fromthe thescreen
screen
Module
Modulecalculate
calculate work
workarea
areatotothe
theprogram
programfields
fields
with
withthe
thesame
samenames
namesbefore
beforeany anyPAI
PAI
module
moduleare areexecuted
executed

Total
Total 165
Total Program
ProgramSAMy220_player_avg
SAMy220_player_avg
TotalGames
Games 6
DATA:
DATA:points
pointstype
typeII
Games
Gamestype
typeI.I.
Average
Averagetype
typeppdecimals
decimals2.
2.
Executing an online Program

F8
Transport
TransportCode
Code

Transaction
TransactionText
Text Program
ProgramName
Name Initial
InitialScreen
Screen
Questions???

Screen
Screen9000
9000 Screen
Screen9001
9001

Process
ProcessBefore
Beforeoutput
output Process
ProcessBefore
BeforeOutput.
Output.
Module
ModuleInitialize.
Initialize. Module
ModuleCalculate.
Calculate.
Process
ProcessAfter
AfterInput
Input Process
ProcessAfter
AfterInput.
Input.
Module
ModuleCalculate.
Calculate.

Add
Addcould
couldhave
havecalculate
calculatethe
theplayer’s
player’saverage
averageininthe
the
PBO
PBOofofscreen
screen9001.
9001.Why
Whyisisititbetter
betterto
todo
dothe
thecalculation
calculationin
in
the
thePAI
PAIofofthe
thescreen
screen9000
9000instead
insteadofofthe
thePBO
PBOof ofthe
thescreen
screen9001.
9001.
Overview
Screen
Screen
Attributes
Attributes
Screen
ScreenPainter
Painter

Screen
ScreenLayout
Layout

Field
FieldAttributes
Attributes

Flow
FlowLogic
Logic
Field List Versus Field Attributes
Full screen Editor Editing
Function
Select
Select
Player_Average
Player_Average
Total_Points
Total_Points--------
--------
Total_Games
Total_Games-------
-------
Graphical Elements
ABAP/4
FI/CO
M
M
Radio Buttons
Graphical Element Radio
Which
WhichArea?
Area? Buttons
-ABAP
-ABAP
-MM Radio
Radiobuttons
buttonsmust
mustbe
be
-MM defined
-SD
-SD definedas
asaagraphical
graphical
-PP group
groupto
tomake
makethem
them
-PP mutually
-FI/CO
-FI/CO mutuallyexclusive
exclusive
-HR
-HR

Radio
Radiobuttons
buttonsare
arecreated
created The
The“label”
“label”for
forthe
theradio
radio
as
assingle
singlecharacter
character button
buttonshould
shouldhave
havethethe
input/output
input/output same
samefield
field name
nameas as
templates.
templates. the
theradio
radiobutton
buttonitself.
itself.
Check Boxes
Graphical element
Which_course?
Which_course?
-Course_1
-Course_1
-Course_2
-Course_2 Check boxes
-Course_3
-Course_3
-Course_4
-Course_4
Check
Checkboxes
boxesare
arecreated
created
with
withaa“title
“titleat
attop
topofofthe
thebox.
box. The
The“label”
“label”for
forthe
thecheck
check
This
This“title
“titlemust
mustbe beaasingle
single box
boxshould
should have
havethe
thesame
samefield
field
text
textfield.
field. Name
Name as
asthe
thecheck
checkbox
boxitself.
itself.
Frames
Graphical element
Which_course?
Which_course?
-Course_1
-Course_1
-Course_2
-Course_2 BOX
-Course_3
-Course_3
-Course_4
-Course_4
Frames
Framesare arecreated
created End of Block
with
withaa“title
“titleatattop
topofofthe
thebox.
box.
This
This“title
“titlemust
mustbe beaasingle
single
text
textfield.
field.
Pushbuttons
Graphical element

Pushbuttons
Enroll_for_Courses
Enroll_for_Courses

Pushbuttons
Pushbuttonsmust
must
be
beassigned
assignedaafunction
function
Pushbuttons
Pushbuttonsare
arecreated
created code.
from code.You
Youcan
canalso
alsodefine
define
fromtext
textfields
fields aafunction
functiontype
typefor
foraa
pushbutton.
pushbutton.
Scrollable fields
Description This Course covers online programming techniques.

Instructor Anthon, Dionne

Description This Course covers online program Scrollable field


Instructor Anthon, Dionne

These Scrollable
Scrollablefields
fieldshave
have
Theselengths
lengthsare
are
“attributes” aavisible
visiblelength
lengththat
thatisis
“attributes”
of smaller
smallerthan
thanthe
thedefined
definedlength.
length.
ofthe
thefiled.
filed.
Using Search Help
IfIfyou
youassign
assignaasearch
searchhelp
helpto
toan
an
input/output
input/outputtemplate,
template,
you
youwill
willsee
seeaadrop-down
drop-downarrow
arrow
Description
Description This course covers onlineto get a list of possible values (F4)
Instructor to get a list of possible values (F4)
Instructor Anthon, Dionne

Another,
Another,Dionne
Dionne
Bacon,
Bacon,Patricia
Patricia
Banning,
Banning,
Search
Searchhelp
helpisisan
an mark
markCooper,
Cooper,
“attribute”
“attribute”of ofaafield.
field. Angela
AngelaShepski,
Shepski,Lee
Lee
ItItcan
canonly
onlybebeused
used
on
oninput/
input/output
output
templates.
templates.
Academy Awards table

AAYear
Category
Winner
Notes
Critic
Academy Awards Online Program

All of these screen fields,


Academy except for the Academy
AcademyAwards
Awards
Year Awards title, will be
Year
Category “painted” from ABAP
Category
dictionary fields.

Academy Awards
Year 1994

Category PIC
Winner Forrest Gump
Notes The Shawshank Redemption should have won.
Paint Dictionary Fields
Field List for Dictionary Fields
Use Dictionary Fields
When
Whenyouyou“Paint”
“Paint”screen
screen
fields
fieldsfrom
fromthe
theABAP
ABAPDictionary, **MZA1TOP-
Dictionary, **MZA1TOP-Top TopInclude
Include
you
youdefine
definethe
theprogram
program Program
ProgramSAPMZA01
SAPMZA01
fields
fieldswith
withthe
the“TABLES”
“TABLES”
statement Tables
TablesYMovie
YMovie
statement
**MZA01O01
**MZA01O01
Screen 9000 Module
Moduleinitialize
initializeoutput.
output.
Process Clear
ClearYmovie.
Ymovie.
ProcessBefore
BeforeOutput
Output
Module End
Endmodule.
module.
Moduleinitialize
initialize
**MZA01I01
**MZA01I01
Process
Processafter
afterinput
input Module
ModuleSelect_listing
Select_listinginput
input
Module
ModuleSelect_listing
Select_listing End
Endmodule.
module.
Online Help For Dictionary
Fields
IfIfaascreen
screenfield
fieldisis
“painted”
“painted”from fromthe
the Academy
AcademyAwards
Awards
ABAP
ABAP Dictionary,
Dictionary, Year
Year F1
ititpoints
points Category
Category
totoaadate
dateelement
element
and
andthethedata
dataelement’s
element’s
online Data
DataElement
Element
onlinehelp.
help.
Short
Shorttext
text
Data
Dataelement
element Data
DataElement
Element
supplemental
supplemental documentation
documentation System-Wide
documentation
documentation Automatic
Screen-specific Data element
Only if maintained documentation
ABAP Dictionary Integration
Academy
AcademyAwards
Awards
Execute
Executetransaction
transaction Year
Year
Category
Category

IfIfaachange
changeisismade
madeto toan
anABAP
ABAPDictionary
Dictionaryfield
field
(e.g.
(e.g.category
categorylength
lengthisischanged
changedfrom
from33toto66characters)
characters)
and
andthe
theappropriate
appropriateDictionary
Dictionaryobjects
objectsare
arereactivated,
reactivated,the
thechange
change
will
willtake
take effect
effectthroughout
throughout thethesystem
systemwhere
wherethis
thisfield
fieldisisused.
used.

Notice
Notice
Academy
AcademyAwards
Awards Change
Execute
Executetransaction
transaction Year Changein in
Year “category”
“category”
Category
Category field
fieldlength
length
Automatic Checks
Values
Valuesininall
all Required
RequiredField
FieldEntered?
Entered?
input/output
input/output
Templates
Templatesareare
checked
checkedfor…
for… Proper
ProperFormat?
Format?

Values
Valuesin
in
input/output Foreign
ForeignKey
KeyValue?
Value?
input/output
templates
templates“painted”
“painted”
from
fromthe
theABAP
ABAP
Dictionary
Dictionaryare
are
checked
checkedfor…
for… Valid
ValidValue?
Value?
Timings of Automatic Checks
PROCESS
PROCESSBEFORE
BEFOREOUTPUT
OUTPUT
SCREEN
SCREEN PROCESS
PROCESSAFTER
AFTERINPUT.
INPUT.
Enter Module
Moduleone.
one.
Module
ModuleTwo.
Two.

No Automatic
Automatic YES Data
DataTransport
Transportfrom
fromscreen
screen
Screen
ScreenField
FieldChecks
Checks Fields
Fields totoprogram
programfields
fieldswith
with
OK?
OK? the
thesame
samenames.
names.

Module Go to PBO
Module“ONE”
“ONE” Module
Module“Two”
“Two”executed
executed of
executed
executed next screen
Required Field Check
Academy
AcademyAwards
Awards
Year
Year ? Fields
Fieldscan
canbe
bemarked
marked
Category
Category PIC as
asrequired
requiredtwo
twoways:
ways:
1.
1. Use
Useaaquestion
questionmark
mark“?”
“?”as
asthe
thefirst
first
character
characterOf
Of an
aninput/output
input/outputtemplate
template

Enter

Academy
AcademyAwards
Awards
IfIfaarequired
requiredfield
fieldisisnot
notentered,
entered, Year
Year
?

the
thesystem
systemwill
willdisplay
displaythetheerror
error Category
Category PIC
message:
message:“Required
“Requiredentry
entrynot
notmade”.
made”.
E: Required entry not made
Field Format Check
Academy
AcademyAwards
Awards The
TheAAYEAR
AAYEARfield fieldin
inthe
theYMOVIE
YMOVIE
Year
Year 19a4 table
tablehas
hasthe
theNUMC
NUMCdata datatype,
type,The
Thesystem
system
Category
Category PIC Will
Willautomatically
automaticallycheck
checkthat
thatthe
the
user
userhas
hasentered
enteredall
allnumbers
numbersininthis
thisfield.
field.

Enter

Academy
AcademyAwards
Awards
IfIfaafiled
filedformat
formatisisincorrect,
incorrect, Year
Year
19a4
the
thesystem
systemwill
willdisplay
display Category
Category PIC
an
anappropriate
appropriateerror
errormessage.
message.
E: Enter Numeric Value
Foreign Key Check
This
Thiscustomer
customernumber
numberfield
field
Address “painted”
“painted”from
fromthe
theABAP
ABAP
AddressInformation
Information
Customer Dictionary
Dictionaryhashasaaforeign
foreignkey
keyrelationship
relationship
Customer##
maintained.
maintained.Because
Becauseofofthis
this
relationship,
relationship,you
youwill
willsee
seeaadrop-down
drop-downarrow
arrow
to
toget
getaalist
listof
ofpossible
possiblevalues
values(F4)
(F4)

Enter Address
AddressInformation
Information
Customer
Customer##

IfIfthe
thevalue
valueentered
entereddoes
doesnot
notexist
existin
inthe
theforeign
foreignkey
keytable,
table,the
thesystem
system
will
willdisplay
displaythe
theerror
errormessage:
message:“Entry
“Entry<x>
<x>does
doesnot
notexist
exist
(please
(pleasecheck
checkyour
yourentry)”.
entry)”.
Valid Value Check
Academy
AcademyAwards
Awards The
TheCategory
Categoryfield
fieldininthe
theYMOVIE
YMOVIE
Year
Year 19a4 Table
Tablepoints
pointstotoaadomain
domainwithwithaaset
set
Category
Category PI of
ofvalid
validvalues.
values.Because
Becauseof ofthis
thisset
setof
ofvalid
valid
values,
values,you
youwill
willsee
seeaadrop-down
drop-down
arrow
arrowtotoget
getaalist
listof
ofpossible
possiblevalues
values(F4.)
(F4.)
Enter

IfIfaavalid
validvalue
valueisisnot
notentered,
entered, Academy
AcademyAwards
Awards
the
thesystem
systemwill
willdisplay
displaythe
theerror
error Year 19a4
Year
message:
message: Category
Category PI
“Please
“Pleaseenter
enteraavalid
validvalue”.
value”.
E: Please enter a valid value
Overview
Academy Academy
AcademyAwards
Awards
AcademyAwards
Awards Year 19a4
Year Year
Year 19a4 Enter Category
Category Category PI
Category PI
E: No Record Exist

Instead
Insteadof
ofinforming
informingthetheuser
user
Academy
AcademyAwards
Awards on
onthe
thesecond
second
Year
Year
19a4
screen
screenthat
thataarecord
record
Category PIC does
doesnotnotexist.
exist.
Category
Winner We
Wewant
wanttotoissue
issueaamessage
message
Winner No Records exists on
Notes onthe
thefirst
firstscreen
screen
Notes

Você também pode gostar