0% found this document useful (0 votes)
212 views4 pages

Sap Luw - Abap Programming (Bc-Aba) - Sap Library

The document discusses different techniques for bundling database changes within an SAP logical unit of work (LUW) to ensure data integrity and reversibility of changes. It covers bundling using function modules, subroutines, and calling functions in other SAP systems.

Uploaded by

sudh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
212 views4 pages

Sap Luw - Abap Programming (Bc-Aba) - Sap Library

The document discusses different techniques for bundling database changes within an SAP logical unit of work (LUW) to ensure data integrity and reversibility of changes. It covers bundling using function modules, subroutines, and calling functions in other SAP systems.

Uploaded by

sudh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like