Professional Documents
Culture Documents
ABAPNewsfor7.40,SP08ABAPManagedDatabas...|SCN
GettingStarted Newsletters
LogOn
Hi,Guest
JoinUs
Store
SearchtheCommunity
Products
Services&Support
AboutSCN
Downloads
Industries
Training&Education
Partnership
DeveloperCenter
Activity
LinesofBusiness
UniversityAlliances
Events&Webinars
Innovation
Browse
Communications
Actions
ABAPDevelopment
ABAPNewsfor7.40,SP08ABAPManaged
DatabaseProcedures(AMDP)
PostedbyHorstKellerinABAPDevelopmentonOct10,20142:45:05PM
Share
Tweet
13
Like
Recap
Forcodepushdown,meaningpushinganalyticsfromtheABAPapplicationservertothedatabaseserver,youcan
useopenABAPfeaturesthatrunonanydatabase.Thoseare OpenSQLthatwasenhancedwidelyinABAP7.40
withanalyticcapabilitieslikeSQLexpressionsorbyremovingrestrictionsfromjoinsandthe ABAPCoreData
Services(ABAPCDS)foradvancedviewbuildingintheABAPDictionary.
Ifthefunctionalityofferedbytheopenfeaturesisnotsufficicienttocoveryourneeds,youhavetoswitchtoNativeSQL
(soundsfamiliar?).ThisisespeciallytrueforSAPHANA,thatoffersanalyticalfeaturesnotcoveredinstandardSQL,as
e.g.calculationviews.IfyourABAPprogramsshouldrunonHANAonly(orifyouwanttoofferspecial
implementationsforHANAandalternativeimplementationsforotherdatabases),databaseprocedureswrittenin
SQLScriptofferaconvenientaccesstothecapabilitesofHANA.InordertofacilitatethisNativeaccesstoHANA,in
7.40,SP05theconceptofABAPManagedDatabaseProcedures(AMDP)wasintroduced,thatallowsyoutocode
SQLScriptinspecialmethodsofnormalABAPclassesandtheruntimeenvironmentdoestherestforyou.(Butplease
notethatasingleSQLstatementdoesnotbecomefasterifyoucodeitinanAMDP,howshouldit?Aslongasyoucan
stayopen,stayopen.Thereisnodrawbackinperformanceifyoucanexpressthelogicsinsinglestatementsorin
CDSviews.YouuseAMDPtoavoidunnecessarydatatransfersbetweendatabaseandapplicationserverwhenusing
severalstatementsorwhenyouneedaccesstofuctionalitynotcoveredbySQL).
NewsforABAP7.40,SP08
WithABAP7.40,SP08,AMDPwasenhancedasfollows:
TabularChangingParameters
AlthoughNativeSQLScriptproceduresdonotofferINOUTparameters,youcandefineCHANGINGparametersfor
AMDPmethodsnow.Thetrickis,thatthedatabaseproceduregeneratedfromAMDPgetsanadditionalINparameter
ofthesamenameasthechanigingparameterwiththepstfix__IN__whiletheCHANGINGparameterbecomesan
OUTparameter.Whencallingtheprocedure,theOUTparameterisfilledimplicitlywiththeCHANGINGvaluepassed
totheINparameter.Normally,youdon'thavetocareabouttheimplicitINparameter.Onlyifyouwanttocallsucha
procedurefromanotherdatabaseprocedure,youhavetosupplyit.
AMDPmethoddefinition
METHODS
get_carriers
CHANGING
VALUE(carriers)TYPEt_carriers
RAISINGcx_amdp_error.
AMDPmethodimplementation
METHODget_carriersBYDATABASEPROCEDUREFORHDB
LANGUAGESQLSCRIPT
USINGscarr.
carriers=selects.*
fromscarrass
innerjoin:carriersasc
ons.mandt=c.mandtand
s.carrid=c.carrid
ENDMETHOD.
http://scn.sap.com/community/abap/blog/2014/10/10/abapnewsfor740sp08abapmanageddatabaseprocedures
1/4
4/27/2015
ABAPNewsfor7.40,SP08ABAPManagedDatabas...|SCN
AgoodexamplewhereAMDPisnotneededatall,butKISShere.
CallfromABAP
TRY.
NEWcl_demo_amdp_changing(
)>get_carriers(CHANGINGcarriers=carriers).
CATCHcx_amdp_errorINTODATA(amdp_error).
...
ENDTRY.
ClassBasedExceptions
Asshownabove,youcanhandleexceptionsthatoccurduringprocessinganAMDPnow.Beforeyougotruntime
errorsonly.
AMDPBAdIs
SpecialAMDPBAdIsallowyoutoimplementBAdImethodsasAMDPmethods.Thesetransfertheeffectofthe
switchesfromSwitchFrameworktotheimplementationofdatabaseproceduresinthecurrentdatabase.Whenan
AMDPprocedurecallsanotherAMDPproceduremanagedbyanAMDPBAdI,theimplementationisexecutedthatis
prescribedbythecurrentswitchsetting.(forcallingAMDPproceduresfromABAPnospecialBAdIsarenecessary,
becauseABAPcallsofnormalBAdImethodsaregoverenedbytheswitchframeworkanyway).
1932Views
AverageUserRating
(5ratings)
Share
Tweet
13
Like
7Comments
ClemensLiOct10,20143:48PM
Justaquestion.IgotusedtoavoidALIASexceptforSelfjoinsforthesakeofreadability.CouldIwrite
carriers=selectscarr.*
fromscarr
innerjoin:carriers
onscarr.mandt=:carriers.mandtand
scarr.carrid=:carriers.carrid
formoreclarity?
And,btw,doIreallyneedscarr.mandt=:carriers.mandtasIthoughtmandtis
implicitlysuppliedbythedatabaseinterface?
Thanksforenlightenment,Ilovethisseries!
Like(0)
HorstKellerOct10,20144:12PM(inresponsetoClemensLi)
Ichecked,andyourcodedoesn'tcompile.WellitisSQLScriptandI'mnottoomuchan
expertthere,butseehttp://help.sap.com/hana/sap_hana_sql_script_reference_en.pdf.
Regardingclient:ItisNativeSQLinfullglory!Noautomaticclienthandling.Therfore,stay
openaslongaspossible
Like(1)
HorstKellerOct11,201412:56PM(inresponsetoClemensLi)
PS:CDS, ABAPNewsfor7.40,SP08ABAPCoreDataServices(CDS),isopenand
clientsarehandledimplicitlyasinOpenSQL,noclientfieldsinthejointhere.
Like(0)
http://scn.sap.com/community/abap/blog/2014/10/10/abapnewsfor740sp08abapmanageddatabaseprocedures
2/4
4/27/2015
ABAPNewsfor7.40,SP08ABAPManagedDatabas...|SCN
PaulHardyOct28,20141:27PM
HelloMr.Horst,
InsomeSAPpresentationonusingSQLScriptforHANAmuchismadeofusingCEFunctions
wheneverpossibleasopposedtostraightSELECTstatments,asCEfunctionsaresupposedtoruna
lotfaster,whichmakesupforthembeingnotasflexibleasSELECTstatements.
WhatIwanttoknow,please,isifCEfunctionsarejustforwhenyouaredoingnativedevelopmentin
theHANAstudio(XS?River?)orcanyouusetheminAMDPaswell?Iknowyoucanusethe
CE_CURRENCY_CONVERSIONasthatisinalotofthetutorials,butcanyouuseothersaswell?
Andifitisinfactpossibletousesuchthings,doesitmakeanysenseinanADMPenviroment?Isthe
recommendationstilltouseCEfunctionsoverSELECTstatementsinanADMP?Iknowyoushould
notmixtheminthesameprocedure,asthatwouldcausetheuniversetoexplode.
Asalways,anyhelpwouldbegratefullyappreciated.
CheersyCheers
Paul
Like(0)
HorstKellerNov14,20149:31AM(inresponsetoPaulHardy)
butcanyouuseothersaswell
Sure,thelistofavailablefunctionscanbetakenfrom
http://help.sap.com/hana/sap_hana_sql_script_reference_en.pdf
doesitmakeanysenseinanADMPenviroment
Sure,AMDPfacilitatesthiskindofcodepushdownfromABAPprograms.Seetheexamples
inmyanswerabove.YouwriteanAMDPprocedureinordertocallthefunctioninsteadof
havingtouseADBCtoaccessthefunctionality.
Like(0)
ArunKumaarMenonNov22,20141:09PM
Hi
nicedocument.
Ihavecreatedthefollowingmethod
METHODSretv_bgsml
IMPORTING
value(iv_from)typed
value(iv_to)typed
value(iv_plnt)TYPEtt_pnt
exporting
value(et_itm_bgsml)typett_bgsml.
inmyzreport
SELECTOPTIONSs_plntforz_cds_purcplant
lo_itm_sum>retv_bgsml(
EXPORTING
iv_from=p_ivfrm
iv_to=p_ivto
iv_plnt=s_plnt[]
IMPORTING
et_itm_bgsml=DATA(lt_itm_sum)
).
Igetanerrorativ_plntitsayssplntisnottypecompatible
amidoingsomethingwronghere.
Thanksandregards
ArunKumarMenon
Like(0)
ClemensLiNov25,20147:26PM(inresponsetoArunKumaarMenon)
Ithinkthishasnothingincommonwith
ABAPNewsfor7.40,SP08ABAPManaged
DatabaseProcedures(AMDP)
pleaseaskinABAPforum.
Hint:Whatistt_pntdefinedas?
http://scn.sap.com/community/abap/blog/2014/10/10/abapnewsfor740sp08abapmanageddatabaseprocedures
3/4
4/27/2015
ABAPNewsfor7.40,SP08ABAPManagedDatabas...|SCN
Regards
Clemens
Like(0)
SiteIndex
Privacy
ContactUs
TermsofUse
SAPHelpPortal
LegalDisclosure
Copyright
http://scn.sap.com/community/abap/blog/2014/10/10/abapnewsfor740sp08abapmanageddatabaseprocedures
FollowSCN
4/4