Vous êtes sur la page 1sur 4

11/9/2016

SAPLUWABAPProgramming(BCABA)SAPLibrary

TheBestRunBusinessesRunSAP

TechnologyPlatform

SAPBusinessWarehouse

SAPNetWeaverBIContent

SAPLUW
TheOpenSQLstatementsINSERT,UPDATE,MODIFY,andDELETEallowyoutoprogramdatabase
changesthatextendoverseveraldialogsteps.Evenifyouhavenotexplicitlyprogrammedadatabasecommit,
theimplicitdatabasecommitthatoccursafterascreenhasbeenprocessedconcludesthedatabaseLUW.The
followingdiagramshowstheindividualdatabaseLUWsinatypicalscreensequence:

Underthisprocedure,youcannotrollbackthedatabasechangesfrompreviousdialogsteps.Itistherefore
onlysuitableforprogramsinwhichthereisnologicalrelationshipbetweentheindividualdialogsteps.
However,thedatabasechangesinindividualdialogstepsnormallydependonthoseinotherdialogsteps,and
mustthereforeallbeexecutedorrolledbacktogether.Thesedependentdatabasechangesformlogicalunits,
andcanbegroupedintoasingledatabaseLUWusingthebundlingtechniqueslistedbelow.
Alogicalunitconsistingofdialogsteps,whosechangesarewrittentothedatabaseinasingledatabaseLUW
iscalledanSAPLUW.UnlikeadatabaseLUW,anSAPLUWcanspanseveraldialogsteps,andbeexecuted
usingaseriesofdifferentworkprocesses.IfanSAPLUWcontainsdatabasechanges,youshouldeitherwrite
allofthemornoneatalltothedatabase.Toensurethatthishappens,youmustincludeadatabasecommit
whenyourtransactionhasendedsuccessfully,andadatabaserollbackincasetheprogramdetectsanerror.
However,sincedatabasechangesfromadatabaseLUWcannotbereversedinasubsequentdatabaseLUW,
youmustmakeallofthedatabasechangesfortheSAPLUWinasingledatabaseLUW.Tomaintaindata
integrity,youmustbundleallofyoudatabasechangesinthefinaldatabaseLUWoftheSAPLUW.The
followingdiagramillustratesthisprinciple:

https://help.sap.com/saphelp_nw70/helpdata/en/41/7af4bfa79e11d1950f0000e82de14a/content.htm

1/4

11/9/2016

SAPLUWABAPProgramming(BCABA)SAPLibrary

ThebundlingtechniquefordatabasechangeswithinanSAPLUWensuresthatyoucanstillreversethem.It
alsomeansthatyoucandistributeatransactionacrossmorethanoneworkprocess,andevenacrossmore
thanoneSAPsystem.ThepossibilitiesforbundlingdatabasechangeswithinanSAPLUWarelistedbelow:
Thesimplestformofbundlingistoprocessawholeapplicationwithinasingledialogstep.Here,thesystem
checkstheusersinputandupdatesthedatabasewithoutadatabasecommitoccurringwithinthedialogstep
itself.Ofcourse,thisisnotsuitableforcomplexbusinessprocesses.Instead,theSAPsystemcontainsthe
followingbundlingtechniques.
BundlingusingFunctionModulesforUpdates
IfyoucallafunctionmoduleusingthestatementCALLFUNCTION...INUPDATETASK,thefunctionmodule
isflaggedforexecutionusingaspecialupdateworkprocess.ThismeansthatyoucanwritetheOpenSQL
statementsforthedatabasechangesinthefunctionmoduleinsteadofinyourprogram,andcallthefunction
moduleatthepointintheprogramwhereyouwouldotherwisehaveincludedthestatements.Whenyoucalla
functionmoduleusingtheINUPDATETASKaddition,itanditsinterfaceparametersarestoredasalogentryin
aspecialdatabasetablecalledVBLOG.
ThefunctionmoduleisexecutedusinganupdateworkprocesswhentheprogramreachestheCOMMIT
WORKstatement.AftertheCOMMITWORKstatement,thedialogworkprocessisfreetoreceivefurtheruser
input.TheupdateworkprocessisresponsiblefortheupdatepartoftheSAPLUW.ThestatementCOMMIT
WORKclosestheSAPLUWforthedialogpartoftheprogramandstartstheupdate.TheSAPLUWis
completeoncetheupdateprocesshascommittedorrolledbackallofthedatabasechanges.Bundlingusing
functionmodulesiscalledUpdate.
Forfurtherinformationabouthowtocreatefunctionmodulesforuseinupdate,refertoCreatingFunction
ModulesforDatabaseUpdates
Duringtheupdate,errorsonlyoccurinexceptionalcasses,sincethesystemchecksforalllogicalerrors,such
asincorrectentries,inthedialogphaseoftheSAPLUW.Ifalogicalerroroccurs,theprogramcanterminate
theupdateusingtheROLLBACKWORKstatement.Then,thefunctionmodulesarenotcalled,andthelog

https://help.sap.com/saphelp_nw70/helpdata/en/41/7af4bfa79e11d1950f0000e82de14a/content.htm

2/4

11/9/2016

SAPLUWABAPProgramming(BCABA)SAPLibrary

entryisdeletedfromtableVBLOG.Errorsduringtheupdateitselfareusuallytechnical,forexample,memory
shortage.Ifatechnicalerroroccurs,theupdateworkprocesstriggersadatabaserollback,andplacesthelog
entrybackintoVBLOG.ItthensendsamailtotheuserwhosedialogoriginallygeneratedtheVBLOGentry
withdetailsofthetermination.Theseerrorsmustbecorrectedbythesystemadministrator.Afterthis,the
returnedVBLOGentriescanbeprocessedagain.
Forfurtherinformationaboutupdateadministration,see

UpdateAdministration

ThistechniqueofbundlingdatabasechangesinthelastdatabaseLUWoftheSAPLUWallowsyoutoupdate
thedatabaseasynchronously.Thisdecreasestheresponsetimesinthedialogprocess.Youcan,forexample,
decoupletheupdateentirelyfromthedialogworkprocessanduseacentralupdateworkprocessonaremote
databaseserver.
BundlingUsingSubroutines
ThestatementPERFORMONCOMMITcallsasubroutineinthedialogworkprocess.However,itisnot
executeduntilthesystemreachesthenextCOMMITWORKstatement.Here,aswell,theABAPstatement
COMMITWORKdefinestheendoftheSAPLUW,sinceallstatementsinasubroutinecalledwithPERFORM
ONCOMMITthatmakedatabasechangesareexecutedinthedatabaseLUWofthecorrespondingdialogstep.

TheadvantageofthisbundlingtechniqueagainstCALLFUNCTION...INUPDATETASKisbetter
performance,sincetheupdatedatadoesnothavetobewrittenintoanextratable,thereforereducingthe
databaseaccesses..Thedisadvantage,however,isthatyoucannotpassparametersinaPERFORM...ON
COMMITstatement.DataispassedusingglobalvariablesandABAPmemory.Thereisaconsiderabledanger
ofdatainconsistencywhenyouusethismethodtopassdata.
BundlingUsingFunctionModulesinOtherSAPSystems
FunctionmodulesthatyoucallusingCALLFUNCTION...INBACKGROUNDTASKDESTINATIONare
registeredforbackgroundexecutioninanotherSAPSystemwhentheprogramreachesthenextCOMMIT
WORKstatement(usingRemoteFunctionCall).AftertheCOMMITWORK,thedialogprocessdoesnotwait
forthesefunctionmodulestobeexecuted(asynchronousupdate).Allofthefunctionmodulesthatyouregister
inthiswayareexecutedtogetherinasingledatabaseLUW.Theseupdatesareuseful,forexample,whenyou
needtomaintainidenticaldatainmorethanonedatabase.
https://help.sap.com/saphelp_nw70/helpdata/en/41/7af4bfa79e11d1950f0000e82de14a/content.htm

3/4

11/9/2016

SAPLUWABAPProgramming(BCABA)SAPLibrary

Forfurtherdetails,refertothekeyworddocumentation.
FormoredetailsofRFCprocessing,refertothe RemoteCommunications sectionofthe BasisServices
documentation.

C OPYR I GH T BY SAP SE OR AN SAP AF F I LI AT E C OM PAN Y. ALL R I GH T S R ESER VED . PR I N T ED F R OM SAP H ELP POR TAL.
(ht t p: / / help. s ap. c om )

https://help.sap.com/saphelp_nw70/helpdata/en/41/7af4bfa79e11d1950f0000e82de14a/content.htm

4/4

Vous aimerez peut-être aussi