812395816

2009nikola 205 views 10 slides Jan 24, 2017
Slide 1
Slide 1 of 10
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10

About This Presentation

Abap To the future


Slide Content

PaulHardy
ABAP®totheFuture
©Rheinwerk
Publishing
Bonn
•Boston

Contents
Foreword 19
Acknowledgments 21
Introduction 23
PART IProgramming
Tools
1.1 Installation 37
1.1.1 InstallingEclipse 37
1.1.2
InstallingtheSAP-SpecificAdd-Ons 39
1.1.3 ConnectingEclipse
toaBackendSAP
System
41
1.2 Features 42
1.2.1
Working
onMultipleObjects
attheSameTime 47
1.2.2 Bookmarking 48
1.2.3 Creating
aMethodfromtheCallingCode 50
1.2.4 Extracting
aMethod 53
1.2.5 DeletingUnusedVariables 58
1.2.6 Creating
InstanceAttributesandMethodParameters 59
1.2.7 CreatingClassConstructors 60
1.2.8 GettingNewIDEFeatures 61
1.3 Testing
andTroubleshooting
63
1.3.1 UnitTestingCodeCoverage
63
1.3.2
Debugging 67
1.3.3 RuntimeAnalysis 69
1.4 CustomizationOptionswithUser-Defined Plug-Ins 71
1.4.1UMAP 73
1.4.2 Obeo 78
1.5 Summary 79
2.1 DatabaseAccess 82
2.1.1 NewCommands in
OpenSQL 82
2.1.2 BufferingImprovements 85
2.1.3 CreatingwhileReading 87
2.1.4 InnerJoin
Improvements 88
9

Contents
2.2
Declaring
andCreating
Variables 90
2.2.1 Omitting
theDeclarationofTYPEPOOLStatements 90
2.2.2 Omitting
DataTypeDeclarations 92
2.2.3 CreatingObjectsUsing
NEW 92
2.2.4 Filling
StructuresandInternalTableswhile
CreatingThemUsing
VALUE 93
2.2.5 Filling
InternalTablesfromOtherTablesUsingFOR 94
2.2.6 CreatingShort-LivedVariablesUsing
LET 95
2.3 StringProcessing
96
2.3.1 NewString
FeaturesinRelease7.02 96
2.3.2 NewString
FeaturesinRelease7.4 97
2.4
Calling
Functions 98
2.4.1 MethodChaining
98
2.4.2 AvoidingType
MismatchDumpswhen
CallingFunctions 99
2.4.3 UsingConstructorOperators
toConvertStrings
100
2.4.4 FunctionsThatExpect
TYPEREFTODATA 101
2.5 ConditionalLogic
102
2.5.1
Using
FunctionalMethodsinLogicalExpressions
103
2.5.2 OmittingABAP_TRUE 103
2.5.3 Using
XSDBOOLasaWorkaroundforBOOLC 105
2.5.4 TheSWITCHStatementasaReplacementforCASE 106
2.5.5 TheCONDStatementasaReplacement forIF/ELSE 108
2.6 InternalTables 109
2.6.1 UsingSecondaryKeys
toAccesstheSameInternal
TableinDifferentWays
109
2.6.2 TableWorkAreas 112
2.6.3 ReadingfromaTable 114
2.6.4CORRESPONDING forNormalInternalTables 115
2.6.5MOVE-CORRESPONDING forInternal Tables
withDeep
Structures 116
2.6.6NewFunctionsforCommonInternalTableTasks 120
2.6.7 InternalTableQuerieswithREDUCE 122
2.6.8 GroupingInternalTables 122
2.6.9
Extracting
OneTablefromAnother 124
2.7 Object-OrientedProgramming 126
2.7.1
Upcasting/Downcasting
withCAST 126
2.7.2CHANGINGandEXPORTINGParameters 127
2.7.3 Changes
toInterfaces 128
2.8 Search
Helps 129
2.8.1 PredictiveSearch
Helps 129
2.8.2 SearchHelp
inSE80 130
10

Contents
2.9 Unit
Testing
131
2.9.1 Creating
TestDoublesRelatingtoInterfaces 131
2.9.2
Coding
ReturnValues fromTestDoubles 132
2.9.3 Creating
TestDoublesRelatedtoComplexObjects
133
2.10Cross-Program
Communication 134
2.11
Summary
136
3.1
EliminatingDependencies
139
3.1.1 IdentifyingDependencies
140
3.1.2
BreakingUpDependencies
141
3.2
Implementing
Mock
Objects
143
3.2.1 CreatingMockObjects 144
3.2.2
Injection 145
3.3 WritingandImplementingUnitTests 147
3.3.1 DefiningTestClasses 148
3.3.2 Implementing
TestClasses 153
3.4 AutomatingtheTestProcess 161
3.4.1
AutomatingDependencyInjection
162
3.4.2 Automating
MockObject
CreationviamockA 167
3.4.3
CombiningDependencyInjectionandmockA 170
3.5 Behavior-Driven
Development
171
3.6Summary
173
4.1 AutomaticRunofUnitTests 177
4.2 MassChecks 178
4.2.1
SettingUp
MassChecks 180
4.2.2 Running
MassChecks 182
4.2.3 Reviewing
MassChecks 185
4.2.4
Dismissing
FalseErrors 188
4.3 RecentCodeInspector
Enhancements 192
4.3.1 UnsecureFORALLENTRIES(12/5/2) 193
4.3.2 SELECT*
Analysis(14/9/2) 195
4.3.3
Improving
FORALLENTRIES(14/9/2) 196
4.3.4 SELECTwithDELETE(14/9/2) 198
4.3.5 CheckonStatements
Following
aSELECT
withoutORDERBY(14/9/3) 199
4.3.6 SELECTSinLoops
acrossDifferentRoutines(14/9/3) 200
4.4Summary 202
11

Contents
5DebuggerScripting
203
5.1 ScriptTabOverview 204
5.2
Coding
theSCRIPTMethod 209
5.3 CodingtheINITandENDMethods 215
5.4
Summary
222
6.1
Types
ofEnhancements 227
6.1.1 ExplicitEnhancements 227
6.1.2 ImplicitEnhancements 228
6.2
Creating
Enhancements 229
6.2.1 ProceduralProgramming
229
6.2.2
Object-OrientedProgramming
233
6.3 DefiningBAdls 235
6.3.1 CreatinganEnhancementSpot 237
6.3.2 Creating
theBAdlDefinition 237
6.3.3 CreatingtheBAdlInterface 244
6.4
Implementing
BAdls 245
6.5 CallingBAdls 249
6.6
Summary
252
PART IIBusinessLogicLayer
7.1
Types
of
Exception
Classes 257
7.1.1 StaticCheck(LocalorNearbyHandling)
258
7.1.2
DynamicCheck(LocalorNearbyHandling)
260
7.1.3NoCheck(RemoteHandling) 260
7.1.4 DecidingwhichType
ofException
ClasstoUse 262
7.2
DesigningExceptionClasses 263
7.2.1
Creating
the
Exception 264
7.2.2 DeclaringtheException 266
7.2.3
Raising
the
Exception
267
7.2.4
CleaningUp
afterthe
Exception IsRaised 268
7.2.5 ErrorHandlingwithRETRYandRESUME 270
7.3
DesignbyContract 274
7.3.1 PreconditionsandPostconditions 276
12

Contents
7.3.2 ClassInvariants 278
7.4 Summary
281
8.1
Defining
aBusiness
Object
284
8.1.1 CreatingtheObject 285
8.1.2 CreatingaHeaderNode 286
8.1.3 Creating
anItemNode 288
8.2 Using
BOPFtoWriteaDYNPRO-StyleProgram
290
8.2.1
Creating
ModelClasses 291
8.2.2 Creating
orChangingObjects
294
8.2.3
LockingObjects 304
8.2.4 PerformingAuthorityChecks 305
8.2.5 SettingDisplayTextUsing
Determinations 306
8.2.6
Disabling
CertainCommands
Using
Validations 316
8.2.7 CheckingDataIntegrityUsingValidations 318
8.2.8 Responding
toUserInput
viaActions 325
8.2.9 Saving
totheDatabase 335
8.2.10TrackingChangesinBOPFObjects 342
8.3 CustomEnhancements 350
8.3.1 EnhancingStandardSAPObjects 351
8.3.2
Using
aCustomInterface(Wrapper) 354
8.4Summary
355
9.1 TheHistoricLocationofRules 360
9.1.1 RulesinPeople'sHeads 360
9.1.2 RulesinCustomizingTables 362
9.1.3 RulesinABAP 364
9.2 CreatingRulesinBRFplus:BasicExample
365
9.2.1
Creating
aBRFplusApplication 365
9.2.2 Adding
RuleLogic
373
9.2.3 BRFplusRulesinABAP 386
9.3
Creating
Rulesin
BRFplus:ComplicatedExample 388
9.4 Simulations 394
9.5 SAPBusinessWorkflowIntegration
397
9.6 Options
forEnhancements 401
9.6.1 Procedure
Expressions
401
9.6.2 Application Exits 402
13

Contents
9.6.3 CustomFrontends 402
9.6.4 CustomExtensions 403
9.7Summary
403
PART IIIUserInterfaceLayer
10.1 Getting
Started 409
10.1.1 DefiningaSALV-Specific(Concrete)Class 410
10.1.2Coding
aProgram
toCallaReport
411
10.2Designing
aReport
Interface 414
10.2.1 Report
FlowStep
1:Creating
aContainer
(Generic/Optional)
416
10.2.2 ReportFlowStep
2:
Initializing
aReport(Generic) 416
10.2.3
Report
FlowStep
3:MakingApplication-Specific
Changes(Specific)
424
10.2.4Report
FlowStep
4:DisplayingtheReport(Generic) 435
10.3Adding
CustomCommandIconsProgrammatically
441
10.3.1 Creating
aMethodtoAutomatically
Createa
Container 442
10.3.2ChangingZCL_BC_VIEW_SALV_TABLE
toFill
theContainer 443
10.3.3
Changing
theINITIALIZEMethod 444
10.3.4AddingtheCustomCommandstotheToolbar 445
10.3.5Sending
UserCommandsfromthe
CallingProgram
446
10.4 Editing
Data 447
10.4.1 Creating
aCustomClasstoHoldtheStandard
SALVModelClass 448
10.4.2ChangingtheInitializationMethodof
ZCL_BC_VIEW_SALV_TABLE
449
10.4.3
Adding
aMethodtoRetrievethe
Underlying
GridObject 449
10.4.4ChangingtheCallingProgram
450
10.4.5
Coding
UserCommand
Handling
451
10.5HandlingLargeInternalTableswithCL_SALV_GUI_TABLEJDA 454
10.6Summary 456
11.1TheBasics 459
11.1.1HowXLSXFilesareStored 459
14

Contents
11.1.2
DownloadingABAP2XLSX 461
11.1.3
Creating
XLSXFiles
Using
ABAP 462
11.2
EnhancingCustomReportswithABAP2XLSX 466
11.2.1
Converting
anALVtoanExcelObject 466
11.2.2ChangingNumberandTextFormats 468
11.2.3
EstablishingPrinterSettings
471
11.2.4Using
Conditional
Formatting 474
11.2.5CreatingSpreadsheetswithMultipleWorksheets 482
11.2.6
UsingGraphs
andPieCharts 484
11.2.7
EmbeddingMacros 487
11.2.8
Emailing
theResult 493
11.2.9AddingHyperlinkstoSAPTransactions 496
11.3
Tips
andTricks 501
11.3.1
Using
theEnhancementFrameworkforYourOwnFixes
...501
11.3.2
Creating
aReusableCustomFramework 504
11.4
Summary 505
12.1TheModel-View-Controller Concept
508
12.1.1Model 508
12.1.2View 511
12.1.3 Controller 514
12.2BuildingtheWDAApplication 515
12.2.1
Creating
aWeb
DynproComponent
517
12.2.2
Declaring
DataStructuresfortheController 518
12.2.3
EstablishingViewSettings
522
12.2.4
SettingUp
theALV 529
12.2.5 DefiningtheWindows 531
12.2.6
NavigatingbetweenViewsInsidetheWindow 532
12.2.7 Enabling
theApplicationtoBeCalled 535
12.2.8Coding 535
12.3UsingFloorplanManagertoModifyExisting
WDAComponents
....546
12.3.1 Creating
anApplicationUsingFloorplanManager
548
12.3.2
Integrating
BOPFwithFloorplanManager 556
12.4
Summary 559
13.1 Architecture 563
13.1.1 Frontend:WhatSAPUI5 Is 564
13.1.2 Backend:WhatSAP
Gateway
Is 564
15

Contents
13.2 Prerequisites
565
13.2.1 Requirements
inSAP 565
13.2.2Requirements
onYourLocalMachine 566
13.3BackendTasks:Creating
theModelUsing
SAPGateway
567
13.3.1 Configuration
567
13.3.2
Coding
581
13.4FrontendTasks:CreatingtheViewandControllerUsing
SAPUI5
...592
13.4.1View 596
13.4.2 Controller 608
13.4.3 Testing
Your
Application
613
13.5Adding
ElementswithOpenUI5
615
13.6Importing
SAPUI5ApplicationstoSAPERP 620
13.6.1
Storing
the
Application
inReleasesLowerthan7.31 620
13.6.2 Storing
theApplication inReleases7.31andAbove 622
13.6.3
Testing
theSAPUI5Application
fromwithinSAPERP 624
13.7SAPUI5vs.SAPFiori 626
13.8Summary
627
PARTIVDatabase
Layer
14.1ThePromisesofShared
Memory 632
14.1.1 DatabaseAccess 633
14.1.2
MemoryUsage
633
14.2
Creating
and
Using
Shared
MemoryObjects 634
14.2.1 CreatingtheRootClass 635
14.2.2GeneratingtheBroker Class 640
14.2.3
Using
Shared
MemoryObjects
inABAPPrograms 643
14.3UpdatingtheDatabaseandShared
MemoryTogether
647
14.4
Troubleshooting 649
14.4.1Data
Inconsistency
between
ApplicationServers 649
14.4.2 ShortDumps
652
14.5
Summary 654
15.1 IntroductiontoCodePushdown 657
15.2
Top-DownDevelopment 658
15.2.1
BuildingandCallingCDSViews 659
15.2.2 BuildingandCalling
ABAP
ManagedDatabase
Procedures 671
16

Contents
15.3
Bottom-UpDevelopment 677
15.3.1 BuildingandCallingExternalViews 678
15.3.2
Building
and
CallingDatabaseProxies 679
15.3.3 TransportingChanges 680
15.4
LocatingCodethatCanBe PushedDown 681
15.4.1HowtoFindCustomCodethatNeedstoBe
PushedDown 682
15.4.2What
Technique
toUsetoPushtheCodeDown 684
15.4.3 Example 684
15.5OtherModificationstoABAPforSAPHANA 691
15.5.1 DatabaseTable
Design 691
15.5.2
AvoidingDatabase-Specific Features 695
15.5.3
Changes
toDatabaseSELECTCoding 697
15.6Summary 700
A
ImprovingCodeReadability 707
A.1
Readability
vs.Concision 707
A.2 TheWhatvs.theHow 708
B
MakingProgramsFlexible 711
CTheAuthor 719
Index 721
17
Tags