Sie sind auf Seite 1von 2

11/8/2016

ABAP4TuningChecklistABAPDevelopmentSCNWiki
GettingStarted

CommunityWIKI

SAPCommunity

Welcome,Guest

Login

Store

Register

ABAPDevelopment / ABAPPerformanceandTuning

ABAP4TuningChecklist
CreatedbyKalenthirababupaulsamy,lastmodifiedonJul05,2007

ABAP/4TuningChecklist
GeneralConsiderations:
1.IstheprogramYEAR2000compliant?
checkdatelogicandmakesuretherearenotany2digityearfields
2.IstheprogramUSready?
takingintoconsiderationtheUSvolumes,willtheprogrameverfinish?CandatabeselectedforjusttheUSselectionparametersatcompanycodelevel,plant,purchorg,
salesdiv,etc...
SQLSELECTstatements:
3.IstheprogramusingSELECT*statements?
ConvertthemtoSELECTcolumn1column2oruseprojectionviews
4.AreCHECKstatementsfortablefieldsembeddedinaSELECT...ENDSELECTloop,orinaLOOPAT...ENDLOOP?
IncorporatetheCHECKstatementsintoWHEREclauseoftheSELECTstatement,ortheLOOPATstatement
5.DoSELECTSonnonkeyfieldsuseanappropriateDBindexoristablebuffered?
Createanindexforthetableinthedatadictionaryorbuffertablesiftheyarereadonlyorreadmostly
6.IstheprogramusingnestedSELECTstoretrievedata?
Convertnestedselectstodatabaseviews,DBjoins(4.0)orSELECTxxxFORALLENTRIESINITABNestedopenselecttatementsareusuallybad,andunlesstheamountofdata
isenormous,thesetypesofreadsshouldbeavoided.Theyareusuallyusedastheyarethesafestwaytoprogramyouwillneverhaveanymemoryissues.Thetechnicalexplanationastowhythis
isbadfollowsfeelfreetotuneoutfortheremainderoftheparagraph.Openselectsreadjustonerecordfromthedatabaseatatime.Eachtimeyoudothis,theappserveranddatabaseserverneedto
communicate.Thepacketsizeofthiscommunicationistypicallymuchlargerthanthesizeoftherecord,somostofthepacketiswaistedwiththistypeofread.Whensystemloadisheavy,thiscanslow
performance.Combinethiswiththeoverheadofaccessingthedatabasemanytimesvsjustonce.
7.ArethereSELECTswithoutWHEREconditionagainstfilesthatgrowconstantly(BKPF/BSEG,MKPF/MSEG,VBAK/VBAP...)?
Programdesigniswrongbacktodrawingboard
8.AreSELECTaccessestomasterdatafilesbuffered(noduplicateaccesseswiththesamekey)?
BufferaccessestomasterdatafilesbystoringthedatainaninternaltableandfillingthetablewithREADTABLE...BINARYSEARCHmethod
9.IstheprogramusingSELECT...APPENDITAB...ENDSELECTtechniquestofillinternaltables?
Changeprocessingtoreadthedataimmediatelyintoaninternaltable(SELECTVBELNAUART...INTOTABLEIVBAK...)
10.IstheprogramusingSELECTORDERBYstatements?
Datashouldbereadintoaninternaltablefirstandthensorted,unlessthereisanappropriateindexontheorderbyfields
11.Istheprogrammingdoingcalculations/summationsthatcanbedoneonthedatabaseviaSUM,AVG,MINorMAXfunctionsoftheSELECTstatement?
usethecalculationcapabilitiesofthedatabaseviaSELECTSUM...
12.DoanySELECTstatementscontainfullyqualifiedkeys(allkeysarespecifiedtomatchasinglevalueintheWHEREclause)butnotthekeywordSINGLE?
thesyntaxcheckerwon'tcatchthis&neitherdoesthedatabaseoptimizer!suchan"incorrect"statementcantake5xlonger
13.ArethereanySELECTorLOOPATstructuresthatareonlyattemptingtoretrievethefirstmatchonagenerickeylookup?
usetheEXITstatement,orUPTO1ROWSoptioninthecaseofSELECT,tobreaktheloop&avoidunnecessaryiterations
14.DoUPDATE/INSERT/DELETEstatementsoccurinsideloops?
saveallaccumulatedchangesinaninternaltableandthenusetheSQLarraystatementstoperformtheupdates:INSERT<tab>FROMTABLE<itab>.
15.AreonlyafewfieldsbeingchangedbyanUPDATEstatement?
usetheSET<field>=<value>clauseoftheUPDATEstatementratherthanupdatingtheentirerecord
16.Istheprograminserting/updatingordeletingdataindialogmode(notviaanupdatefunctionmodule)?
MakesurethattheprogramissuesCOMMITWORKstatementswhenoneormorelogicalunitsofwork(LUWS)havebeenprocessed
InternalTableProcessing:
(alsosee4&13above)
17.AreinternaltablesprocessedusingREADTABLEitabWITHKEY...BINARYSEARCHtechnique?
ChangetableaccessestouseBINARYSEARCHmethod.NotethatthisisONLYpossibleifthetableissortedbytheaccesskey!AddaSORTifnotalreadythere.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP4+Tuning+Checklist

1/2

11/8/2016

ABAP4TuningChecklistABAPDevelopmentSCNWiki

18.Isasemisequentialscanofalarge,sortedinternaltablebeingperformedbyaLOOPAT...WHERE,orLOOPAT...withCHECKstatementstocontinue/terminatetheloop?
UseaREADTABLEwithBINARYSEARCHtoretrievefirstrecordinthesequencematchingthelookupkeys,thenLOOPAT...FROMSYTABIX+1untiloneofthekeyfieldvalues
changesthiswayyougetonlytherecordsyouneed,ratherthanreadinguptothestartingpoint
19.Isacondensed,summaryinternaltablebeingbuiltbyREADTABLE...BINARYSEARCHandthensum,INSERTorAPPEND?
UsetheCOLLECTstatement,andSORTtheresultafterthetableiscomplete
20.IsaCOLLECTstatementbeingusedsimplytoavoidduplicateentriesinanallcharacterfieldsnonumericfields:typesI,PorFinternaltable?
UsetheREADTABLE...WITHKEY...BINARYSEARCHwithanINSERT...INDEXSYTABIXtobuildthetable
21.AreinternaltablesbeingSORTedwithoutanyfieldqualifiers?
Specifytheactualfieldstobeused:SORT<tab>BY<fld1><fld2>...Thefewerfields,thebetter!
22.Areinternaltablesbeingcopiedorcomparedrecordbyrecord?
Usethe"[]"optiontorefertotheentiretableinonelineofcode:
TAB2[]=TAB1[]copyTAB1toTAB2
IFTAB1[]EQTAB2[]compareTAB1toTAB2

StringProcessing:
23.Arestringsbeingbuiltup/brokendownmanuallywithcodefragments?
usethenewCONCATENATE/SPLITstatements,withtheSEPARATEDBYSPACEoptionofCONCATENATEifdesired
24.Aretheolder,obsoletestringhandlingfunctionsforfindingstringlength,orcentering/rightjustifyingstringsbeingcalled?
usethenewer"strlen()","WRITE...TO...CENTERED","WRITE...TO...RIGHTJUSTIFIED"statements
25.Arefieldstrings(records)beingsettoaspecialcharacter,otherthanSPACE,viaaCLEARandthenaTRANSLATEinstruction?
usethenewCLEAR<record>WITH<char>statement(esp.usefulwithstandardSAPbatchinputgenerationprogramstosetthe"novalueforthis
field"indicator,whichhasadefaultsymbolof"/")
Miscellaneous:
26.Isaninternaltablefilledwithamassiveamountofdata(approx.5000to10000recordsormore,dependingonrecordlength),sortedandprocessed?
instead,usetheFIELDGROUPSdeclaration,andtheINSERT,EXTRACT,SORTandLOOPinstructionstodefine,create,sortandprocesssuchlargevolumesofdatamoreefficiently
27.Isalogicaldatabasedrivenprogramtakingtoolongtoselectdata?
converttheprogramtospecificSELECTstatements,withmoreappropriateindexusageandaminimizedsequenceofnestedSELECTsdon'tforgettoremovethe'Logicaldatabase'
name/applicationfromtheprogram'sattributes
28.IsaMOVECORRESPONDINGstatementusedwhenit'snotneeded?
ifmovingacompleterecordwithsamestructure,justusethesimpleassignmentstatement:XVBAP=VBAPorMOVEVBAPTOXVBAP
andifmovingonlyahandfuloffields,usespecificassignments
29.AretherenoOBLIGATORYspecificationsonthekeyPARAMETERSand/orSELECTOPTIONSdeclarations?
enforceuserentryofkeyfields,thuslimitingdatabaseaccessestosomedegree.Toreadeverything,however,theusercouldstillenter"1""99999999..."(seenextitemthough),butat
leasttheystarttothinkaboutwhattheyreallyneedtosee.
30.AreSELECTOPTIONSfullyopentothemostcomplexsearchesevenwhentheyneednotbe?
UsethekeywordsNOEXTENSIONand/orNOINTERVALSoftheSELECTOPTIONSdeclaration,ifpossible,tolimitthenumberofrangestoonly1(NO
EXTENSION),orlimittheentrytosinglevaluesonly(NOINTERVALS)ifthat'sallthatisreallyneededfortheapplication,sothattheSELECTstatement's"IN"operationislesscomplex
31.Producinginformationmessagesabout"longruntimes"canalsobebeneficialinreducingruntimes
theuserwillthinktwiceandhopefullyrestartstheprogramwithasmallerrangeorinextremesituations,anerrormessagepreventinggenericinputorcompleterangeinputonakeyfield
32.Inespeciallydifficultcases,wherenoamountofspecificstatementrewriting,indexing,orbufferingincreasesperformanceenough,considerrestructuringthemain
SELECTsequence,ifpossible,toreducethetotalnumberofrecordstoamanageablesize.
thistechniqueisonlypossiblewithcertaintablesequencesthatarerelatedviabothforwardandbackwardpointingforeignkeyrelationships,andthenonlymakessensewhenreversing
thelogicwilldefinitelyreducethetotalreadaccesses,anddoesnotrequireacompleteprogramrewriteofallrelatedroutines,etc.vardomainName='https://wiki.sdn.sap.com/wiki'varentityId='35836'
varspaceKey='Snippets'newAjax.Autocompleter('labelName','labelsAutocompleteList','35836',
Unknownmacro:{tokens}
)

tutorial
ContactUs
Privacy

SAPHelpPortal
TermsofUse

LegalDisclosure

Copyright

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP4+Tuning+Checklist

FollowSCN

2/2

Das könnte Ihnen auch gefallen