Using CALL TRANSACTION USING For Data Transfer - Background Processing - SAP Library
Using CALL TRANSACTION USING For Data Transfer - Background Processing - SAP Library
UsingCALLTRANSACTIONUSINGforDataTransferBackgroundProcessingSAPLibrary
TheBestRunBusinessesRunSAP
EnterpriseManagement
SAPERP
6.0
UsingCALLTRANSACTIONUSINGfor
DataTransfer
ProcessingbatchinputdatawithCALLTRANSACTIONUSINGisthefasterofthetworecommended
datatransfermethods.Inthismethod,legacydataisprocessedinlineinyourdatatransferprogram.
Formoreinformation,see
choosingadatatransfermethod.
Syntax:
CALLTRANSACTION<tcode>
USING<bdc_tab>
MODE<mode>
UPDATE<update>
<tcode>
:Transactioncode
<bdc_tab>
:InternaltableofstructureBDCDATA.
<mode>
:Displaymode:
A
Displayall
Displayerrorsonly
Nodisplay
<update>
:Updatemode:
S
Synchronous
Asynchronous
http://help.sap.com/saphelp_erp60_sp/helpdata/en/fa/09715a543b11d1898e0000e8322d00/content.htm
1/5
09/07/2015
UsingCALLTRANSACTIONUSINGforDataTransferBackgroundProcessingSAPLibrary
Localupdate
Aprogramthatuses
CALLTRANSACTIONUSINGtoprocesslegacydatashouldexecutethefollowingsteps:
1. Preparea
BDCDATAstructureforthetransactionthatyouwishtorun.
2. WithaCALLTRANSACTIONUSINGstatement,callthetransactionandpreparetheBDCDATA
structure.Forexample:
CALLTRANSACTION'TFCA'USINGBDCDATA
MODE'A'
UPDATE'S'.
MESSAGESINTOMESSTAB.
IFSYSUBRC<>0.
<Error_handling>.
ENDIF.
TheMODEParameter
YoucanusetheMODEparametertospecifywhetherdatatransferprocessingshouldbedisplayedasit
happens.Youcanchoosebetweenthreemodes:
ADisplayall.Allscreensandthedatathatgoesinthemappearwhenyourunyourprogram.
NNodisplay.Allscreensareprocessedinvisibly,regardlessofwhetherthereareerrorsornot.Control
returnstoyourprogramassoonastransactionprocessingisfinished.
EDisplayerrorsonly.Thetransactiongoesintodisplaymodeassoonasanerrorinoneofthescreens
isdetected.Youcanthencorrecttheerror.
Thedisplaymodesarethesameasthosethatareavailableforprocessingbatchinputsessions.
TheUPDATEParameter
YouusetheUPDATEparametertospecifyhowupdatesproducedbyatransactionshouldbe
processed.Youcanselectbetweenthesemodes:
AAsynchronousupdating.Inthismode,thecalledtransactiondoesnotwaitforanyupdatesitproduces
tobecompleted.ItsimplypassestheupdatestotheSAPupdateservice.Asynchronousprocessing
thereforeusuallyresultsinfasterexecutionofyourdatatransferprogram.
AsynchronousprocessingisNOTrecommendedforprocessinganylargeramountofdata.Thisis
becausethecalledtransactionreceivesnocompletionmessagefromtheupdatemodulein
asynchronousupdating.Thecallingdatatransferprogram,inturn,cannotdeterminewhethera
calledtransactionendedwithasuccessfulupdateofthedatabaseornot.
http://help.sap.com/saphelp_erp60_sp/helpdata/en/fa/09715a543b11d1898e0000e8322d00/content.htm
2/5
09/07/2015
UsingCALLTRANSACTIONUSINGforDataTransferBackgroundProcessingSAPLibrary
Ifyouuseasynchronousupdating,thenyouwillneedtousetheupdatemanagementfacility
(TransactionSM12)tocheckwhetherupdateshavebeenterminatedabnormallyduringsession
processing.Erroranalysisandrecoveryislessconvenientthanwithsynchronousupdating.
SSynchronousupdating.Inthismode,thecalledtransactionwaitsforanyupdatesthatitproducesto
becompleted.Executionisslowerthanwithasynchronousupdatingbecausecalledtransactionswaitfor
updatingtobecompleted.However,thecalledtransactionisabletoreturnanyupdateerrormessage
thatoccurstoyourprogram.Itismucheasierforyoutoanalyzeandrecoverfromerrors.
LLocalupdating.Ifyouupdatedatalocally,theupdateofthedatabasewillnotbeprocessedina
separateprocess,butintheprocessofthecallingprogram.(SeetheABAPkeyworddocumentationon
SETUPDATETASKLOCALformoreinformation.)
TheMESSAGESParameter
The
MESSAGESspecificationindicatesthatallsystemmessagesissuedduringaCALLTRANSACTION
USINGarewrittenintotheinternaltable<MESSTAB>.Theinternaltablemusthavethestructure
BDCMSGCOLL.
YoucanrecordthemessagesissuedbyTransactionTFCAintable
MESSTABwiththefollowingcoding:
(Thisexampleusesaflightconnectionthatdoesnotexisttotriggeranerrorinthetransaction.)
DATA:BEGINOFBDCDATAOCCURS100.
INCLUDESTRUCTUREBDCDATA.
DATA:ENDOFBDCDATA.
DATA:BEGINOFMESSTABOCCURS10.
INCLUDESTRUCTUREBDCMSGCOLL.
DATA:ENDOFMESSTAB.
BDCDATAPROGRAM='SAPMTFCA'.
BDCDATADYNPRO='0100'.
BDCDATADYNBEGIN='X'.
APPENDBDCDATA.
CLEARBDCDATA.
BDCDATAFNAM='SFLIGHTCARRID'.
BDCDATAFVAL='XX'.
APPENDBDCDATA.
BDCDATAFNAM='SFLIGHTCONNID'.
BDCDATAFVAL='0400'.
APPENDBDCDATA.
CALLTRANSACTION'TFCA'USINGBDCDATAMODE'N'
MESSAGESINTOMESSTAB.
LOOPATMESSTAB.
WRITE:/MESSTABTCODE,
http://help.sap.com/saphelp_erp60_sp/helpdata/en/fa/09715a543b11d1898e0000e8322d00/content.htm
3/5
09/07/2015
UsingCALLTRANSACTIONUSINGforDataTransferBackgroundProcessingSAPLibrary
MESSTABDYNAME,
MESSTABDYNUMB,
MESSTABMSGTYP,
MESSTABMSGSPRA,
MESSTABMSGID,
MESSTABMSGNR.
ENDLOOP.
ThefollowingfiguresshowthereturncodesfromCALLTRANSACTIONUSINGandthesystemfields
thatcontainmessageinformationfromthecalledtransaction.Asthereturncodechartshows,return
codesabove1000arereservedfordatatransfer.IfyouusetheMESSAGESINTO<table>option,then
youdonotneedtoquerythesystemfieldsshownbelowtheircontentsareautomaticallywrittenintothe
messagetable.Youcanloopoverthemessagetabletowriteoutanymessagesthatwereenteredinto
it.
Returncodes:
Value
Explanation
Successful
<=1000
Errorindialogprogram
>1000
Batchinputerror
Systemfields:
Name:
Explanation:
SYMSGID
MessageID
SYMSGTY
Messagetype(E,I,W,S,A,X)
SYMSGNO
Messagenumber
SYMSGV1
Messagevariable1
SYMSGV2
Messagevariable2
SYMSGV3
Messagevariable3
SYMSGV4
Messagevariable4
ErrorAnalysisandRestartCapability
Unlikebatchinputmethodsusingsessions,CALLTRANSACTIONUSINGprocessingdoesnotprovide
anyspecialhandlingforincorrecttransactions.Thereisnorestartcapabilityfortransactionsthatcontain
errorsorproduceupdatefailures.
http://help.sap.com/saphelp_erp60_sp/helpdata/en/fa/09715a543b11d1898e0000e8322d00/content.htm
4/5
09/07/2015
UsingCALLTRANSACTIONUSINGforDataTransferBackgroundProcessingSAPLibrary
YoucanhandleincorrecttransactionsbyusingupdatemodeS(synchronousupdating)andcheckingthe
returncodefromCALLTRANSACTIONUSING.Ifthereturncodeisanythingotherthan0,thenyou
shoulddothefollowing:
writeoutorsavethemessagetable
usetheBDCDATAtablethatyougeneratedfortheCALLTRANSACTIONUSINGtogeneratea
batchinputsessionforthefaultytransaction.Youcanthenanalyzethefaultytransactionand
correcttheerrorusingthetoolsprovidedinthebatchinputmanagementfacility.
http://help.sap.com/saphelp_erp60_sp/helpdata/en/fa/09715a543b11d1898e0000e8322d00/content.htm
5/5