Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
HANAModelingGoodPractices.|SCN
GettingStarted Newsletters
Hi,Guest
LogOn
JoinUs
Store
SearchtheCommunity
Products
Services&Support
AboutSCN
Downloads
Industries
Training&Education
Partnership
DeveloperCenter
Activity
LinesofBusiness
UniversityAlliances
Events&Webinars
Innovation
Browse
Communications
Actions
SAPServices
HANAModelingGoodPractices.
PostedbyShivajiPatnaikinSAPServiceson26Mar201404:43:10
26
Share
Tweet
ContributorsforthisBlog:
ShivajiPatnaik,AbaniPattanayak,ImranRashid&GordonDailey
IneveryprojectwehavebeenaskedforbestpracticesforHANAModeling.Wethoughtitisgoodideatouseour
experiencestocomeupwithabestpracticesdocument.AlltheConsultantscontributedinthisdocumenthave
experiencewithmultipleHANAimplementationprojects.WeusedourcombinedexperiencestocomeupwithHANA
bestpractices.WewillbeenhancingthisdocumentbasedonanynewfindingsinfutureHANAReleases/
enhancements.
WewillbecoveringfollowingTopics:
1.)EnvironmentSetup
2.)DatabaseTables/SQLs
3.)NamingConventions
4.)Modeling
4.1)AttributeViews
4.2)AnalyticViews
4.3)CalculationViews
4.3.1)SCRIPTEDCALCULATIONVIEWS
5.)Security
6.)Performance
7.)Migrations
8.)Miscellaneous(commonerrors)
9.)BestPracticestoBuildBusinessObjectsUniverseagainstHANAModels.
10)Someusefullinks
1.)ENVIRONMENTSETUP:
PACKAGE:
Createonetoplevelpackageforallofthecustomerscontent(ifacceptabletothecustomer).
Createasubpackageforthecontentyouwilldeployintheproject.
Multiplesubpackagesmaybecreated,ifrequiredordesiredtoorganizealargeamountof
content.
Createallcontentmodelsunderthispackageortheappropriatesubpackages
Createseparatesubpackagesforeachgroupofrelatedcontentthatwillbedeployedtogether
asaset(e.g.,byproject).
Createonetoplevelpackagecalleddev(ordevelopment)forworkinprogress
Createasubpackageforeachdeveloper
CreateallAnalyticalandCalculationviewsundertheseplayareapackages.
Oncethedevelopmentiscomplete(includingunittesting),theseviewscanbecopied/movedtothemain
packagefortheprojectwhenitisreadytomigratebetweenenvironments.
Alwaystakebackups(ExportingContent)ofentirecontentofaproject.
ImportonlyyourcontentinsteadofCompleteProjectcontentandrestoreonlyyourstuff(Thiswill
avoidoverwritingothersstuffwhenyouimport)
OptionalCreateatoplevelpackagecalledtestorqa
Thestructureunderthispackageshouldmatchthatofthetoplevelcustomerpackageforyourcontenttobe
deployed.
Thisallowsyoutohavecodeintestingbeforecommittingittothedeploymentpackage.
Youmaycreatemultipletopleveltestpackagesforcomplexprojectswithmultipleworkstreams(thisisnot
generallyrecommendedunlessnecessary).
UseHANArepositorycheckin/out
SAPHANADevelopmentperspective(introducedinSP05)shouldbeusedtotrackversionofobjects
(insteadofdevelopermodeexport/import)
http://scn.sap.com/community/services/blog/2014/03/26/hanamodelinggoodpractices
1/11
6/3/2015
HANAModelingGoodPractices.|SCN
DELIVERYUNIT:
Createadeliveryunitforeachgroupofrelatedcontentthatyouwilldeployfortheproject.
ThiswillbeusedforpromotingyourcontentfromDEVtoQAandPROD
Ingeneral,thedeliveryunitsshouldmatchthesubpackagesunderthetoplevelpackageforthe
customer.
Assignyourdeploymentpackages(underthetoplevelcustomerpackage)totheappropriatedeliveryunits.
DELETINGPACKAGES:
Apackagecannotbedeletedwhenitisnotempty.
Deletealltheunderlyingobjectsbeforedeletingthepackage.Thisincludessubpackages.
NotethatsomeobjectsarehiddenintheModelerperspective.UsetheHANADevelopmentPerspectivetosee
alloftheassociatedobjects(alsoyoucanchangepreferencestoseehiddenobjects)
2.)DATABASETABLES/SQLs
Schema
PlanyourSchemalayoutbeforeyoustartyourproject.
CreategenericnamestoSchemas(forex:SLTECC,DS_SCHEMA,CUSTOM_SCHEMAetc.).Ifpossible
keepsameschemanamesinallenvironments.Thiswillhelpmigrationgosmoothlyfromoneenvironment
tootherenvironment.Ifschemanamesaredifferentyoumighthavetoadjustschemaswhenyoumigrateto
newenvironments.
AlltablesreplicatedthroughSLTshouldbeinthesameschema.However,donotcreatecustomtablesor
tablesloadedthroughDSinthesameschemaastheSLTtables.
Alltablescreated/loadedthroughDataServicesshouldbeinaseparateschemafromSLTtables.
StagingtablesforETLshouldbeinaseparatestagingschema.
Customtablesorstatictablesshouldbeinaseparateschema.
TableCreation
AlltablestobeusedincontentmodelsshouldbecreatedasCOLUMNTABLESinHANAforbest
performance.(Note:DataServicesandSLTcreatecolumntablesbydefault).
Itisrecommendedtoalwaysprovideacomment/descriptiononthetableandoneachcolumnforclarity
anddocumentationpurposes.
Security
YoumustgrantSELECTprivilegesonthedatabaseschemasortablesto_SYS_REPOinordertousethe
tablesincontentmodels
Syntax:
GRANTSELECTONSCHEMA"<SCHEMA_NAME>"to_SYS_REPOWITHGRANTOPTION
GrantDMLcommandstodifferentschema
Syntax:
GRANTSELECT/UPDATE/DELETEontables/procedureto<schema_owner>
Grantindividualtableaccesstodifferentschema
Syntax:
GRANTSELECTON"<SCHEMA_NAME>"."<TABLE>"to"<SCHEMA_NAME>"WITHGRANT
OPTION
AUTOGENERATEDCOLUMNS(ConcatAttributes)
Autogeneratedcolumnsarenewcolumnsautomaticallypopulatedbasedonacalculationusingthephysicalcolumns
inthesametable.Thesehavesomeadvantagesanddisadvantages.
Syntax:
ALTERtable"<SCHEMA>"."<TABLE>"ADD(ZZYEARNVARCHAR(4)GENERATEDALWAYSAS2014')
Advantages
Disadvantages
Calculationsarepusheddowntothe
Database(insteadofmodels)
Thecodeisnotvisibleandcantbetransported(unlesstabledefinitions
arecreatedintherepository)
Increasesperformance
Thecodetocreatethecolumnsneedstobemanuallyrunacross
environmentsandneedsmaintenance
MigrationofModelstodiffenvironmentswillfailifthevirtualcolumnsor
AutoGeneratedcolumnsarenotthere
SQLs
WhileusingdatapreviewonModels
DOs
Donts
Applyafiltercondition:
SELECT*FromView
Select*fromViewWhere<Condition>
SelectCount(column)fromView
SelectCount(*)fromview
Usefollowingconversionfunctionswhilemigrationfromotherdatabases(Oracle/Teradataandetc.)toHANA.
http://scn.sap.com/community/services/blog/2014/03/26/hanamodelinggoodpractices
2/11
6/3/2015
HANAModelingGoodPractices.|SCN
DECODEfunction(Oracle)toCASEstatementinHANA
CONVERTfunctiontoCASTstatementinHANA
TRUNCfunctiontoCASTstatementinHANA
SYSDATE,SYSTIMEorSYSTTIMESTAMPtoCURRENT_DATE,CURRENT_TIMEorCURRENT_TIMESTAMP
statementsinHANA
ConvertingBLOB/CLOBDataTypes(Oracle)toHANADatatypes:
BLOB/CLOBfieldscannotbeusedHANAmodels.However,youcancreateageneratedcolumnselecting
first5000characters(oranythingelseyoudlike)toreportonthedatastoredintheBLOB/CLOBfield.
StringfunctionslikeSUBSTRINGworksfineonNCLOBfield.ForotherBLOBtypefields,youcancastitto
VARCHARbeforeusingstringfunctions.
Substring(cast(BTESTasVARCHAR(5000)),1,10)
Concat()FunctionsinModelsareveryexpensiveandthecreateVirtualcolumns(autogeneratedcolumn)for
concatenatedtextstringswillmakemoresense.
Checkfollowinglinkforsomeadditionalinfo.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0f2d8c9f321311041bbdc8e8e14dc9a?
QuickLink=index&overridelayout=true&58815282151702
3.)NAMINGCONVENTIONS
ThereisnohardandfastruleforHANAModelNamingconvention.However,wehavefollowedcoupleofscenarios
andyoucanpickwhichevernamingconventionyoulike.WearealsoprovidinglinkfromSAPonthistopic.
Selectaconsistentnamingconventionsthroughouttheproject
NameeveryelementinCAPITALLETTERS.
Givemeaningfulbusinessnamestoallcolumnswhichareexposedtousers.Keepthenameasshortas
possible(preferablyunder15to20chars)
Option1
OptionII
ATTRIBUTEVIEWS
DIM_DATE_AT
AT_DATE
Givebusinessnames.
IfcolumnisparticipatinginKeyfor
Same
ColumnNames
ex:SITE_KEY
Columndescriptions
SITE_DESC
TheelementusedinLabelColumn
(labelmapping)shouldberenamed
as<ATTRIBUTE>.descriptions(e.g.
REGION.descriptions)
ANALYTICALVIEWS
FACT_SALES_AV
AN_SALES
Datafoundation
columns
IfECCyoucouldleavetechnicalnames
orsuffixwith_FACT
Same
RestrictedColumns
IfexposedtousergiveaBusinessName
same
otherwiseRM_.
Ex:SOLD_AMT_US(Exposedtouser)
RM_SOLD_AMT_US(usedforinternal
calculations)
CalculatedColumns
CALCULATIONVIEWS
RestrictedColumns
BusinessNameofthemeasure
same
FACT_SALES_CV
CA_SALES
IfexposedtousergiveaBusinessName
otherwiseRM_.
Ex:SALE_AMT(Exposedtouser)
CM_SALE_AMT(usedforinternal
Same
calculations)
CalculatedColumns
ANALYTICALPRIVILEGES
BusinessNameofthemeasure
Same
AP_RESTRICTION_AT(OnATTRView)
AP_RESTRICTION_AV(OnAnalytical
Same
View)
AP_RESTRICTION_CV(OnCalcview)
HIERARCHY
HI_<BUSINESS_NAME>_PC(forParent
Childhierarchy)
HI_<BUSINESS_NAME>_LV(forLabel
basedhierarchy).
Same
INPUTPARAMETERS
IP_PARAMETER_NAME
same
VARIABLES
VA_DATE
Same
PROCEDURES
SP_PROCEDURENAME
same
CUSTOMTABLES
ZT_TABLENAME
ZT_tablename
4.)MODELING
http://scn.sap.com/community/services/blog/2014/03/26/hanamodelinggoodpractices
3/11
6/3/2015
HANAModelingGoodPractices.|SCN
BeforeYouBegin
CheckforKeycolumnsforanyNullValuesattablelevel.
ThecolumnsthatarepartofthejoinsintheHANAmodelsshouldnotcontainanyNULLvalues(resolve
nullvaluesthroughETLorSLTjobsbeforestartingmodeling).
General
CreateallexpectedAttributeViewsfirst.
Thesewillbeusedlaterincreatinganalyticviewsandcalculationviews.
Anattributeviewcanbeusedinmultipleanalyticviewsorcalculationviews
Totheextentpossible,designyourattributeviewsascommoncomponentsthatcanbeusedin
multiplemodelstoreducemaintenanceeffort.
Decisiontreeformodeling(inorderofperformance)
AnalyticView>AttributeView>GraphicalCalcView>CalcView(CEfunction)>CalcView
(SQL)
CreateviewsStepbystep.
Whatitmeansiscreateyourviewsstepbystep.Verifyeachstepbeforemovingontothenextstep.
ForexampleincreatinganAnalyticView:Createthedatafoundationfirstandactivateitandseethe
data.Ifyourdatasetisbiguseafilterwhereyoucouldget1025rowsorlesstovalidatethemodel.
Nextaddanattributeviewjoinandactivateandcheckdata.Itmightbeslowprocessbutonceyouare
donemodelingitwillbedone.Theadvantagebydoingthisisyoucanfindanydataorjoinissuesat
everylevel.
4.1)ATTRIBUTEVIEWS:
YoumustdefineatleastoneKeyAttribute(Ex:SITE_KEY)onanattributeview.Thisistypicallythecolumn(s)
thatwillbeusedtojointheviewtoothertables/content.
Exposeonlyrequiredcolumnsusedinreportsandhierarchies.Donotcreatecolumnsforeverythingjust
becauseitsthere.
Givemeaningfulbusinessnamesforallexposedattributes.
Ingenerally,trytomakesureallattributenamesintheViewareunique.ThereshouldbenoduplicateAttributes
inotherAttributeviews.(SameattributecolumnshouldnotbeintwoAttributeViews,ingeneral)
Avoidcalculatedcolumns(exampleTo_date(),concat(),To_char()andetc.)inAttributeviews.
Calculatedcolumnscreateanimplicitcalcviewwrapperaroundtheanalyticviewandwillimpact
performance.
Considerreplacingthemwithmaterializedcolumns(orautogeneratedcolumns)intheunderlyingtable.
AlternatecreatetheminCalculatedViews.
Levelbasedhierarchiesworkinmostofthereportingtools.ParentchildhierarchiesworksonlyinAnalysis
OLAP,AnalysisOfficeorExcel.
Checkperformanceofattributeviews.QueriesonAttributeviewsshouldrespondinsecondsotherwiseitwill
impactoverallperformanceoftheviewsthatuseit.
ForDescriptioncolumnstheelementusedinLabelColumn(labelmapping)shouldberenamedas
<ATTRIBUTE>.descriptions(e.g.REGION.description)
NOTE:TherearesomeextrastepsyouneedtodoifyouarecreatingCalcviewsbasedonAnalyticalviewswith
Attributeviewsconsistsofcolumn.description.InCalcviewsitconvertscolumn.descriptiontocolumn_description
andthishastoberemappedwithcolumn.descriptioninXMLandreimportandactivateCalcviews.
4.2)ANALYTICALVIEWS
StarSchemaDesignispossiblewithanalyticalviews.
Youcandefinemeasuresonlyfromonefacttable,evenifyouhavemultiplefacttablesinyourdatafoundation.
Usedesigntimefilters/inputparameterstolimitthedataset(ifpossible).
Usejoinsoninteger/datekeycolumns(ifpossible)
CreaterestrictedmeasuresbyusingDimensionsfromattributeorfromFactkeysfromdatafoundation.
Userestrictedmeasures(wherepossible).Thisperformsbetterintermsresourceconsumption(memoryand/or
CPUtime)vs.calculatedmeasures
AvoidcreatingCalculatedAttributesinAVs.ForexampleTo_date(),concat(),To_char()andetc.Consider
movingthemtocalculationvieworpushthemtodatabaselayer(materializedorvirtualcolumn).Calculated
attributesarecomputedinthecontextofCalcEngine(eventhoughtheyareinAnalyticView),hencetherewillbe
datatransferbetweenenginesandhencelowerperformance.KeepingallthecalculationsinthecontextofOLAP
enginewillgivethebestperformance.
AfteractivatingAVcheckin_SYS_BICifitisgeneratingAV/olap(itiscalledwrappercalcview)Thismeansdata
ismovingbetweentheengines.Thisneedstobeavoided.
AvoidusingcalculationbeforeaggregationonBIGdatasets(thisisveryintensiveintermsofCPUtime).
Considermovingthesecalculationtodatabaselayer(materializedcolumnorvirtualcolumns)
IfyouhaveadesigntimefilterintheAttributeviewandifthisAttributeviewisjoinedtothedatafoundationusing
referentialjoin,thejointotheattributeviewwillbealwaysexecuted(evenifnoattributeisselectedfrom
AttributeView).Watchoutforthiswhileyouaremodeling.
BecarefulusingReferentialjoinssincethiscanleadtoinconsistentresultsifreferentialintegrityonbothsidesof
thejoinisnotassured.Ifyouarenotsure,useaLeftOuterJoinoranInnerJoin,asappropriate,forconsistent
resultsacrossqueriesemployingdifferentcolumnsfromthemodel.
UseTemporalJoin(introducedinHANASP05)formodelingslowlychangingdimension.Onlyreferentialjoin
anddate&integerdatatypesaresupported.
AvoidCompoundjoins.Thismaynotpossiblealwaysbutwatchoutforanyperformanceissues.
IfyourmodelhavemanyjoinsyoucouldalsodeployonJoinenginetogetabestperformance(possibleonly
http://scn.sap.com/community/services/blog/2014/03/26/hanamodelinggoodpractices
4/11
6/3/2015
HANAModelingGoodPractices.|SCN
OLAPenginespecificfunctionslikeTemporalJoinisnotused)
UseInputparameterstocalculatemeasuresbasedonuserinput
Usevariablestofurtherrestrictthedatasetforbetterperformance
DISTINCTCOUNTS:
Distinctcountsinanylargedatabasesarechallenging.IfyouruncountdistinctonOLAPviewonalargefacttables
withahighnumberofdistinctvaluesconsiderusingthenote.
1941113InfluencestandardbehaviorofOLAPqueriesinadistributedHANAinstallation.
4.3)CALCULATIONVIEWS
Allviews/tablesshouldbeusedwithaprojectionnode.Projectionnodesimproveperformancebynarrowingthe
dataset(columns).
Furtheroptimizationcanbedonebyapplyingfiltersatprojectionnodes.
AvoidusingJOINnodesincalculationview.ConsiderreplacingthemwithUNIONnodes(wherepossible).
AlternatelyconsiderpushingthesejoinstoAnalyticviews.
UseInputParameters/VariablestorestrictthedatasetwithintheCalcView.Filtersshouldbeappliedasearlyas
possibleinthedataflow.IfyouarecreateaCalcViewthatunionsmultipleCalcviews(orSubCalc
views),useConstantmappinginUnionNode.Thiswillimprovetheperformanceasthequerywillonly
fetchtheresultsrelatedtotheconstantvalueofthesubCalcviewbypassingothervaluesfora
particularsubCalcviewunderneaththeunionforexecutioninreportingifneeded.(Seethepicture
below)
Calculatedcolumnsshouldbedefinedhere
Forexample:midstr(string("ERDAT"),strlen(string("ERDAT"))9,4)
Concat(String1,String2)
CalculatedColumnsarecalculatedbeforeaggregation.
Hierarchies(ifany)needtoberedefinedintheCalculationview.HierarchiesdefinedintheAttributeViewsare
notvisibleintheCalculationView.
LabelsofAttribute(LabelColumn)&DescriptionofMeasuresfromunderlyingAttribute/AnalyticorCalculation
viewsarenotvisibleintheCalculationView.Theseneedtoberemapped.
EnableMultidimensionalreporting(introducedinSP06)shouldbeused.
IftheviewwascreatedinSP05orearlierrevision,thiscanbeenabledbyclickingSwitchtoAggregation
inthecontextmenuoftheprojectionnode(justbelowthesemanticnode)
STARJOINSINCALCVIEWS:
IntroducedinSP07.YoucanselectmultiplemeasuresfrommultiplefactstablesinoneStarmodeltosupport
3rdNormalFormdesign.
CheckthefollowingURLformoreonStarJoinsinCalculationviews.
http://scn.sap.com/community/services/blog/2014/02/13/hanasp07starjoin
4.3.1)SCRIPTEDCALCULATIONVIEWS
DONOTmixthefunctionsofSQLScriptandCEFunctionsinacompositemodel
(Forexample:donotcodeoneCalculationViewwithSQLScriptanduseitinsideanotherCalculation
ViewwithCEFunctions).Theperformancewillbeverybad.
TrytoexposeONLYrequiredfieldsintheCE_PROJECTIONS
Passonallparametersasrequiredtothelowestlevel(thisappliestoGraphicalorScriptbasedViews).
Reducethesizeofthedatasetasearlyaspossibleinthedataflow.Thiscanbedonebyapplyingstatic
filtersorapplyingdynamicfiltersusingparametersatthelowestlevel
Minimizethesizeofanyintermediateresultsetsincomplexprocessing.Donotincludeanyextraattribute
columnsthatmayincreasetherowsofaggregatedresultsbeingpassedbetweennodesinthedataflow.
Avoidextremelylargeintermediateresultsets,eveniftheywillbereducedoraggregatedbeforethefinal
resultisreturnedtotheclient.Thesecanhavehighmemoryrequirements.
http://scn.sap.com/community/services/blog/2014/03/26/hanamodelinggoodpractices
5/11
6/3/2015
HANAModelingGoodPractices.|SCN
Performcalculationsatthelastnodepossibleinthedataflow(ideallydoneinfinalaggregationor
projection).Thiswillreducetheamountofdatarowsonwhichyouareperformingthecalculationsalso
reducethenumberofcolumnsbeingtransferredfromonenodetoanother.
Insomesituations,youcanuseaunionandthenaggregatetheresultsinsteadofusingajoinforbetter
performance.
ReduceComplexityofSQLStatements:BreakupacomplexSQLstatementintomanysimpler
ones.ThismakesaSQLScriptprocedureeasiertocomprehend.
IdentifyCommonSubExpressions:Ifyousplitacomplexqueryintologicalsubqueriesitcanhelp
theoptimizertoidentifycommonsubexpressionsandtoderivemoreefficientexecutionplans.
UnderstandtheCostsofStatements:Employtheexplainplanfacilitytoinvestigatethe
performanceimpactofdifferentSQLqueriesusedinscripts.
ReduceDependencies:AsSQLScriptistranslatedintoadataflowgraph,andindependentpathsin
thisgraphcanbeexecutedinparallel,reducingdependenciesenablesbetterparallelism,andthus
betterperformance.
TESTING:Dounittestingforeachmodelandcreatetestcasesdocument.Thiswillhelptocreatea
deliverabledocumenttoclient.
5.)SECURITY
DonotusetheoutoftheboxSYSTEMusertomanagedaytodaydatabaseadministration
CreateDelegatedAdministratorstododaytodayjobanduseSystemuserifnecessary.
CreateSecurityModel(Whichusercanseewhatdata)
USERS/ROLESwillbecreatedONLYbyDelegatedSYSTEMAdministratorUsers.
Usethedesigntimeroleinsteadoftheruntimerole(throughCreaterole/userSQLstatement)
Usedesigntimerolestocreatesecurity.
CreatingUserwillalsocreateaSchemabydefault.
ByDefaultSYSTEMdonothaveaccesstoothersusersSchemas.Systemuseroranyotherusercansee
dataonlywhenSchemaUsersGrantsaccesstoUsersandSystemUsers.
CreateaSecuritymodel(whichusercanseewhatcontent)beforeyouimplementHanadatalevelsecurity.
Considerusingrowlevelsecurity.
HANAOutoftheboxtheCOLUMNLevelsecurityfeatureisnottherebutthisneedtobehandledin
ModelingbycreatingonebasemodelwithSecuredColumnsandcreateanotherviewwithhidingallthe
securedcolumns.
HANAsecurityisimplementedwithAnalyticalprivileges(APs)andAPswillimprovetheperformanceasit
appliesfilterstomodels.
ConsiderusingDynamicAnalyticPrivileges(introducedinSP05)wheneverpossible.Thiswillsimplifythe
process.
AlwayscreaterolesandassignrequiredprivilegestoroleandassignRolestousers.
Donotgrant_SYS_BI_CP_ALLprivilegetoanyrole/user.
Createadevelopmentprojecttostoreyourdesigntimeobjectsinasharedrepository.
Designsecurityusingthedesigntimeroles.
DesigntimeroleisportabletoanotherSAPHANALandscapethroughlifecyclemanager.
6.)PERFORMANCE
CreateallcalculationsinAnalyticalorCalculationviews.AvoidcreatinganycalculationsinReporting
layer(Universe&Frontendtools).
LimitoutputcolumnsusingProjectionnodes
Considerpartitioninglargetablestogetbetterperformance
Max2Brecordspertable(ortablepartition)andmax1000partitionspertable.
ForMoredetailscheckfollowinglink
https://cookbook.experiencesaphana.com/bw/operatingbwonhana/hanadatabaseadministration/system
configuration/partitioninganddistributionlargetables/
Donotcreateworkingtablesindifferentschemas.Thiswillcreatesecurityproblemsonownerships.Insteadof
thatcreateaseparateschemaandcreateallworkingtablesanduseitinyourModeling.
Avoidcompositeprimarykeyswheneverpossible.Compositeprimarykeycreatesadditionalindexesonthe
table,whichwilltakeadditionalspaceandhitstheperformance.Ifyouhavetouseitbeawareofthisfact.
IfpossibleavoidJoinsonCharactercolumns.
AnalyzetheperformanceoftheQuery/ModelsusingExplainPlanandVisualizationPlan
IdentifythelongrunningqueriesbyreviewingPerformancetabtoanalyzesystemperformancelocatedunderthe
Administrationeditor
HanaAutomaticallyhandlesIndexesonkeycolumns.Createsecondaryindexonnonkeycolumnsifitis
absolutelynecessary.Createindexesonnonprimarykeycolumns(withhighcardinality)toenhancethe
performanceofsomequeriesusingtheindexadviser.
Syntax:CREATEINDEX<name>ON<table>.<column>
Usetheindexadvisertofindoutforwhichtablesandcolumnsindexingwouldbemostvaluable.The
http://scn.sap.com/community/services/blog/2014/03/26/hanamodelinggoodpractices
6/11
6/3/2015
HANAModelingGoodPractices.|SCN
indexAdvisor.pyscriptispartofaSAPHANAsysteminstallationandrunsfromthecommandline.Itislocatedin
the$DIR_INSTANCE/exe/python_supportdirectory.
Indexingtheprimarykeycolumnsisusuallysufficientbecausequeriestypicallyputfilterconditionsonprimary
keycolumns.Whenfilterconditionsareonnonkeyfieldsandtableshavemanyrecords,creatinganindexon
thenonprimarykeycolumnsmayimprovetheperformance.
Thereisatradeoffbetweenindexingandmemoryconsumption:Whileindexingnonprimarykeycolumnscan
makequeryexecutionfaster,thedownsideisthatmemoryconsumptionincreases.Theindexadvisertakesthis
tradeoffintoaccount:Indynamicmode,theindexadviserlooksforthetablesandcolumnsthatareusedmost
often.Thehighertheselectivityis,thatis,themoredifferentvaluesareinthecolumn,thehigherarethe
performancegainsfromindexingthecolumns.
Tocheckwhetherthereisanindexforacolumn,youcanseethesystemviewM_INDEXES.
WithSAPHANA,youdonotneedtoperformanytuningtoachievehighperformance.Ingeneral,theSAPHANA
defaultsettingsshouldbesufficientinalmostanyapplicationscenario.Anymodificationstothepredefined
systemparametersshouldonlybedoneafterreceivingexplicitinstructionfromSAPSupport.
Iftwocolumnsarefrequentlycomparedbyqueries,ensurethetwocolumnshavethesamedatatype.
Forcolumnsofdifferenttypes,SAPHANAusesimplicittypecastingtoenablecomparisoninHANA
Models.However,implicittypecastinghasanegativeeffectonperformance.
7.)MIGRATION:
IfyouwanttotransporttheHANAcontentasyouareusedtodofortheABAPlandscapeandhase.g.processtoolsin
topofthesystemtransportlandscape,thentherecommendedapproachwouldbetouseCTS+.
iftheHANAlandscapeiscompletelyindependentandtherearenorequirementsconcerningprocessintegrationor
couplingofotherapplicationartifacts,thenyoucanusetheHANAonlytransporttoolthatispartofHANALifecycle
Management(knownasHANAApplicationLifecycleManager),whichisaHANAonlytool.
Currentlythelimitationinbothscenariosis,thatyouhavetotransportthecompleteDeliveryUnit(DU)andcannot
transportsmallergranularities.
SAPHANALifecycleManager:
TheSAPHANAlifecyclemanager(HLM)isatoolthatenablesflexiblecustomizationsofanexistingSAPHANA
system.TherearethreeavailableworkingmodesfortheSAPHANAlifecyclemanager:
1.UsingSAPHANAstudio
2.Usingthecommandline
3.Usingastandalonebrowser
UsingSAPHANALifecycleManagerthroughSAPHANAStudio:
Keepinmindthat,toworkwiththeHLM,youneedtomakecertainconfigurationsettingsfortheSAPHANAstudio.
Therearealsocertainbrowserrestrictions.Formoreinformation,see
http://help.sap.com/hana/SAP_HANA_Update_and_Configuration_Guide_en.pdf
KeepinmindthatLifecycleManagementperspectiveintheSAPHANAstudiorequiresversionofJavaVirtual
Machineequalorhigherto1.6.0_12.
UsingSAPHANALifecycleManagerthroughStandaloneBrowser:
Makesureyoureviewthefollowingbrowserrequirements:
ForMicrosoftWindows,youneedInternetExplorerversion9orabove.IfyouarerunningInternetExplorer
version9,makesurethatyourbrowserisnotrunningincompatibilitymodewithyourSAPHANAhost.Youcan
checkthisinyourbrowserbychoosingTools>CompatibilityViewsettings.
ForLinux,youneedXULRunner1.9.2orabove.WerecommendthatyouinstallXULRunner1.9.2(ornewer)
separately,butifyouhavealreadyinstalledFirefox3.6(ornewer),itcontainsXULRunner1.9.2.
Tousethetoolfromastandalonebrowser,callthefollowingURL:https://<host>:1129/lmsl/HLM/<SID>/ui/?sid=
<SID>.
MakesureyouusethefullyqualifiednameoftheSAPHANAsystem,suchasmyhost.sap.com(not
justmyhost).
8.)COMMONERRORS
Error:Cannotcreatecolumnindex"duringactivation.
Thisissueoccurswhenyoutrytoredeploy/reactiveamodelafteryoumademinorchanges(orimporteda
modelfromanothersystem).
DeletetheentryfromtheRUNTIME_OBJECTStableandactivateagain
DELETEfrom"_SYS_REPO"."RUNTIME_OBJECTS"whereOBJECT_NAMELIKE
'%CA_MY_CALC_VIEW'
You'llseethisissue,ifyoutrytoactivateamodelwhilemassivedataloadtounderlyingtableisin
progress,whichlocksthetableforsignificantamountoftime(say1030minormore).
However,thismaynotbeanissuewithtypicalSLTreplication(notfirsttimeload).TypicalSLTloadsonly
locksthetablesforfewseconds,SoSLTloadmayslowdowntheactivation.Butitdoesnoterroroutthe
activation.
Error:SAPDBTechJDBC:[2048]:columnstoreerror:<?xmlversion="1.0"encoding="utf8"?><createCubeResult
http://scn.sap.com/community/services/blog/2014/03/26/hanamodelinggoodpractices
7/11
6/3/2015
HANAModelingGoodPractices.|SCN
version="1.0"><status><message>Indexnameconflictswithexistingindexname</message>
<errorCode>2019</errorCode></status><details><warnings><detail><element>cubeSchema</element>
<code>46</code><message>Defaultlanguagenotset.Use'en'</message></detail></warnings></details>
</createCubeResult>
AsSystemUser:
dropcalculationscenario"_SYS_BIC"."pkg/view"Ex:dropcalculationscenario_SYS_BIC"."ms/FACT_WM_AV"
Error:Couldnotexecute'selectyear,count(*)FROM"_SYS_BIC"."ms/FACT_SHIPPING_AV"groupbyyear'
SAPDBTechJDBC:[2048](at28):columnstoreerror:searchtableerror:[2712]Errorexecutingphysicalplan:olap:
mergingmultivaluedictsisnotimplementedBwPopJoin2Inwardspop17(MODELER:VTTPen.TKNUMto.VBELN),in
executor::Executorincube:_SYS_BIC:ms/FACT_SHIPPING_AV
UPDATE"schema"."table"mergedeltaindexEx:UPDATE"SAP_MODELER"."VBAK"mergedeltaindex
Error:InternaldeploymentofobjectfailedRepository:EncounteredanerrorinrepositoryruntimeextensionInternal
Error:CreateScenario:failedaCalcEngine.createScenario():Thefollowingerrorsoccured:Anindexalreadyexists
withthesamename(2003)nnprintingXML<?xmlversion="1.0"encoding="UTF8"standalone="no"?><cubeSchema
defaultLanguage="EN"defaultSchema="_SYS_BIC""select*fromsys.m_ce_calcscenarios
dropcalculationscenario""_SYS_BIC"".""emc.sd/CV_BACKLOG_UPD2""cascade
Ifyouarenotabletoopenanyoftheviews:
CouldbeSTUDIOVersionproblem.UpgradeStudio
NotabletoopenanyANVIEW:
UnderlyingKeyColumnsinjoinsarechanged.OpenXmlfileandmapcorrectkeys.
TroubleDeletingPackage:
Checkin_SYS_BI
select*from"_SYS_BI"."BIMC_ALL_CUBES"wherecube_name='FACT_WM_AV'
select*from"_SYS_BI"."BIMC_DIMENSIONS"whereCOLUMN_OBJECT='"_SYS_BIC"."ms/FACT_WM_AV"'
select*from"_SYS_BI"."BIMC_DIMENSIONS"
FROM_SYS_REPO
select*from"_SYS_REPO"."ACTIVE_OBJECT"whereObject_name='FACT_WM_AV'
select*from"_SYS_REPO"."PACKAGE_CATALOG"wherePACKAGE_ID=ms
select*from"_SYS_REPO"."INACTIVE_OBJECT"whereObject_name='FACT_WM_AV'
Someotherissuessolutioncanbefoundinfollowingdoc.
http://scn.sap.com/docs/DOC50291
9.)BestPracticestoBuildBusinessObjectsUniverseagainstHANAModels.
UniversesshouldalwayscreateagainstHANADatabaseinformationModels.
BusinesslogicneedtobepushedtoHANAmodelstogetmaximizingthequeryperformanceandalsoitis
presentationlayeragnostic.EveryreportingtoolisabletoconsumeHANAmodelsasis.ForExampleWebi,
Explorer,Lumira,AOffice,XSengine,HTML5appsandother3rdpartyreportingtools.
10.)SomeUsefulLinks:
YTD,MTDothercalculationsbasedonrelativedates
http://scn.sap.com/docs/DOC50420
HandlingSCDswithSLT
http://scn.sap.com/docs/DOC45991
HanaDBInstall:
http://scn.sap.com/docs/DOC31036
RowtoColumn&ColumntoRowTransformationinModeling.
http://scn.sap.com/docs/DOC51791
http://scn.sap.com/docs/DOC50541
Conclusion:
Thanksforreadingthisblog.WewillcontinuouslyupdatethisBlogwithnewupdates.Weappreciateyourfeedbackto
improvethisblog.
DISCLAIMER:USETHISDOCUMENTATYOUROWNRISK.
27034Views
AverageUserRating
http://scn.sap.com/community/services/blog/2014/03/26/hanamodelinggoodpractices
8/11
6/3/2015
HANAModelingGoodPractices.|SCN
(18ratings)
Share
26
Tweet
19Comments
AbaniPattanayak26Mar201416:36
Thanks
ShivajiPatnaikforputtingthistogether.
Like(1)
PanCheng01Apr201522:05(inresponsetoAbaniPattanayak)
Awesomejob.
Thanks,
Like(0)
SatyaPVV18Jul201410:06
Goodwork!!
Like(0)
StephaneMarie28Aug201417:58
Whatisyourmethodologytocopy/Moveviewsbetweenpackages?
Westartedwith,asadvised,aDEVpackagewith'developperssubpackage,butitseemsthenthat
dependanciesbetweenviewarereallydifficulttomanagewhenyouwanttocopyormoveyour
developmenttoyour'ProjectContent'package.
Infact,wefoundoutthatwehadtoredevelopmostofthingsinthetargetpackage,sothatrelation
betweenobjectscanbeestablishedinasustainablemaaner.
Howdidyouhandlethisissue?
Like(0)
AbaniPattanayak28Aug201418:55(inresponsetoStephaneMarie)
HiStephane,
Movingobjectsbetweenthepackageswillrespecttheassociateddependency.Howare
youmovingobjectsbetweenpackagesandsubpackages?
I'dsuggestyoutry(Selectaview).RightClick:REFACTOR==>MOVE
Like(1)
StephaneMarie29Aug201415:23(inresponsetoAbaniPattanayak)
...Andyouareright.
Iguesswehadproblemsduetoauthorizations,notduetotheprocessinitsel.
ThanksAbani.
Like(0)
ShivajiPatnaik29Aug201418:51(inresponsetoStephaneMarie)
Stephane,
WhatAbanisaidisright.Alsosometimesifyoubuildmodelsreferencingmultiplepackages
(orDBSchemanamesarediffinDev/QAorProd)thenmovewillstillreferencetothose
packages.IfyouwanttochangethesereferencesyouhavetoexportandchangeinXML.
WedidchangeinXMLinmultipleinstances..
Thanks
Shivaji
Like(1)
KishoreJhunjhunwala30Sep201416:45
Thanksforthisamazingdocument.
Like(0)
FrankMisch01Oct201413:34
Hi,
goodnewsthelimitationfortheHANAApplicationLifecylceManagement(HALM)"Currentlythe
limitationinbothscenariosis,thatyouhavetotransportthecompleteDeliveryUnit(DU)andcannot
transportsmallergranularities."isalreadygonefornativeHANAtransportinSAPHANA1.0SP8and
willbegoneverysoonwithCTS,too.Withthoseversionsonelevelofchangelistsispossible.
Andalsoconcerningthemanagementofdeliveryunits,productsandpackagesyouwillfindfeatures
withinHALMtosupportforexampleaprojectlead,productresponsible,architectordeveloperto
modeltheapplication.
http://scn.sap.com/community/services/blog/2014/03/26/hanamodelinggoodpractices
9/11
6/3/2015
HANAModelingGoodPractices.|SCN
Moreinformationcanbefoundat:SAPHANAApplicationLifecycleManagement(HALM)|SAP
HANA
Kindregards,
Frank
Like(0)
RanjitPradhan02Dec201423:58
Fantasticworkbytheeliteteam.Thanksabunch.
Like(0)
RemyaRaj04Dec201407:05
HiShivaji,
CouldyoupleaseconfirmthisCalculatedColumnsarecalculatedbeforeaggregation.
IfIdocalculatedcolumnonanaggregationnode,willitnotbecomputedafteraggregation?
Thanks,
Remya
Like(0)
ShivajiPatnaik13Jan201516:46(inresponsetoRemyaRaj)
Ramya,
Yes.CalculatedColumnsarecalculatedbeforeAggregation.Iguessthereisflagyoucan
setuptocalculateafteraggregation.
ThesecondpartofyourquestionifIunderstandcorrectlyIfyoudocreateacalculated
columninAggregationnode,itwillcomputedafterthataggregationnodeanditwillbe
visibleafterthatnodetoothernodes.
Thanks
Shivaji
Like(0)
AbaniPattanayak18Feb201515:18(inresponsetoShivajiPatnaik)
Actuallycalculatedcolumnsarebydefault"afteraggregation".Youcanchangethe
behaviorbyusingtheflagtocalculate"afteraggregation"
Like(0)
HratchSofoian27Feb201517:13
Thankyouforthegreatpost.
Howcanijoinmultiplecalculationviews(morethan10)inanewCVusinggraphicaloption?Using
unionandprojection?oranyotherbestpracticefromyourside?
appreciateyourfeedbackandtime
Like(0)
ShivajiPatnaik27Feb201517:28(inresponsetoHratchSofoian)
BestoptionistouseUnion.Unionisfastestofalloptions.
Thanks
Shivaji
Like(0)
HratchSofoian27Feb201517:30(inresponsetoShivajiPatnaik)
Thankyou.
Sowouldyourecommendtoaddthose10viewsinonesingleunionortrysome
kindof"nested"union?
Like(0)
ShivajiPatnaik27Feb201517:45(inresponsetoHratchSofoian)
Sofoian,
InthepastIhaveadded8Views(combinationofCalc/AnalyticalViews)
inoneUnion(Itismassiveandmessybutworkedlikeacharm).
NestedunionsmightalsoworkbutIhavenottestedoneversustheother
.
Thanks
Shivaji
Like(1)
SteveSiew30Mar201517:53
GreatJobShivaji.Nicetoknowyouarestillatit.
Like(0)
http://scn.sap.com/community/services/blog/2014/03/26/hanamodelinggoodpractices
10/11
6/3/2015
HANAModelingGoodPractices.|SCN
ShivendraSingh16Apr201500:00
Greatworkbytechieband...Veryusefulinformation
Like(0)
SiteIndex
Privacy
ContactUs
TermsofUse
SAPHelpPortal
LegalDisclosure
Copyright
http://scn.sap.com/community/services/blog/2014/03/26/hanamodelinggoodpractices
FollowSCN
11/11