Vous êtes sur la page 1sur 9

3/23/2017 HANAModelingGoodPractices|StartupFocus

SignupforourNewsletter

Events GoToMarket News&Views Community Alliances JoinStartupFocus Search Login

blog. AllBlogs Contribute Subscribe

HANAModelingGoodPractices

ByShivajiPatnaik November04,2015


ContributorsforthisBlog:ShivajiPatnaik,AbaniPattanayak,ImranRashid&GordonDailey

IneveryprojectwehavebeenaskedforbestpracticesforHANAModeling.Wethoughtitisgood
ideatouseourexperiencestocomeupwithabestpracticesdocument.AlltheConsultants
contributedinthisdocumenthaveexperiencewithmultipleHANAimplementationprojects.We
usedourcombinedexperiencestocomeupwithHANAbestpractices.Wewillbeenhancingthis
documentbasedonanynewndingsinfutureHANAReleases/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:
Createonetop-levelpackageforallofthecustomerscontent(ifacceptabletothecustomer).
Createasub-packageforthecontentyouwilldeployintheproject.

Multiplesub-packagesmaybecreated,ifrequiredordesiredtoorganizealargeamountof
content.
Createallcontentmodelsunderthispackageortheappropriatesub-packages

Createseparatesub-packagesforeachgroupofrelatedcontentthatwillbedeployedtogether
asaset(e.g.,byproject).
Createonetop-levelpackagecalleddev(ordevelopment)forwork-in-progress
Createasub-packageforeachdeveloper
CreateallAnalyticalandCalculationviewsundertheseplay-areapackages.

Oncethedevelopmentiscomplete(includingunittesting),theseviewscanbecopied/movedtothe
mainpackagefortheprojectwhenitisreadytomigratebetweenenvironments.
Alwaystakebackups(ExportingContent)ofentirecontentofaproject.
ImportonlyyourcontentinsteadofCompleteProjectcontentandrestoreonlyyourstu(Thiswill
avoidoverwritingothersstuwhenyouimport)
OptionalCreateatop-levelpackagecalledtestorqa

Thestructureunderthispackageshouldmatchthatofthetop-levelcustomerpackageforyour
contenttobedeployed.
Thisallowsyoutohavecodeintestingbeforecommittingittothedeploymentpackage.
Youmaycreatemultipletop-leveltestpackagesforcomplexprojectswithmultipleworkstreams(this
isnotgenerallyrecommendedunlessnecessary).
UseHANArepositorycheckin/out

http://startupfocus.saphana.com/hanamodelinggoodpractices/ 1/9
3/23/2017 HANAModelingGoodPractices|StartupFocus
SAPHANADevelopmentperspective(introducedinSP05)shouldbeusedtotrackversionofobjects
(insteadofdevelopermodeexport/import)
DELIVERYUNIT:
Createadeliveryunitforeachgroupofrelatedcontentthatyouwilldeployfortheproject.

ThiswillbeusedforpromotingyourcontentfromDEVtoQAandPROD
Ingeneral,thedeliveryunitsshouldmatchthesub-packagesunderthetop-levelpackageforthe
customer.
Assignyourdeploymentpackages(underthetop-levelcustomerpackage)totheappropriatedelivery
units.
DELETINGPACKAGES:
Apackagecannotbedeletedwhenitisnotempty.
Deletealltheunderlyingobjectsbeforedeletingthepackage.Thisincludessub-packages.

NotethatsomeobjectsarehiddenintheModelerperspective.UsetheHANADevelopmentPerspectiveto
seealloftheassociatedobjects(alsoyoucanchangepreferencestoseehiddenobjects)
2.)DATABASETABLES/SQLs
Schema

PlanyourSchemalayoutbeforeyoustartyourproject.
CreategenericnamestoSchemas(forex:SLTECC,DS_SCHEMA,CUSTOM_SCHEMAetc.).If
possiblekeepsameschemanamesinallenvironments.Thiswillhelpmigrationgosmoothlyfromone
environmenttootherenvironment.Ifschemanamesaredierentyoumighthavetoadjustschemas
whenyoumigratetonewenvironments.
AlltablesreplicatedthroughSLTshouldbeinthesameschema.However,donotcreatecustom
tablesortablesloadedthroughDSinthesameschemaastheSLTtables.

Alltablescreated/loadedthroughDataServicesshouldbeinaseparateschemafromSLTtables.
StagingtablesforETLshouldbeinaseparatestagingschema.
Customtablesorstatictablesshouldbeinaseparateschema.

TableCreation
AlltablestobeusedincontentmodelsshouldbecreatedasCOLUMNTABLESinHANAforbest
performance.(Note:DataServicesandSLTcreatecolumntablesbydefault).

Itisrecommendedtoalwaysprovideacomment/descriptiononthetableandoneachcolumnfor
clarityanddocumentationpurposes.
Security
YoumustgrantSELECTprivilegesonthedatabaseschemasortablesto_SYS_REPOinordertouse
thetablesincontentmodels
Syntax:
GRANTSELECTONSCHEMA<SCHEMA_NAME>to_SYS_REPOWITHGRANTOPTION;
GrantDMLcommandstodierentschema
Syntax:
GRANTSELECT/UPDATE/DELETEontables/procedureto<schema_owner>;
Grantindividualtableaccesstodierentschema
Syntax:
GRANTSELECTON<SCHEMA_NAME>.<TABLE>to<SCHEMA_NAME>WITHGRANT
OPTION;
AUTO-GENERATEDCOLUMNS(ConcatAttributes)
Autogeneratedcolumnsarenewcolumnsautomaticallypopulatedbasedonacalculationusing
thephysicalcolumnsinthesametable.Thesehavesomeadvantagesanddisadvantages.
Syntax:
ALTERtable<SCHEMA>.<TABLE>ADD(ZZYEARNVARCHAR(4)GENERATEDALWAYSAS
2014);

Advantages Disadvantages

Calculationsarepusheddowntothe Thecodeisnotvisibleandcantbetransported(unlesstabledenitions
Database(insteadofmodels) arecreatedintherepository)

Increasesperformance Thecodetocreatethecolumnsneedstobemanuallyrunacross
environmentsandneedsmaintenance

MigrationofModelstodienvironmentswillfailifthevirtualcolumnsor
AutoGeneratedcolumnsarenotthere

http://startupfocus.saphana.com/hanamodelinggoodpractices/ 2/9
3/23/2017 HANAModelingGoodPractices|StartupFocus
SQLs
WhileusingdatapreviewonModels
DOs Donts

Applyaltercondition:Select*fromViewWhere< SELECT*FromView
Condition>

SelectCount(column)fromView SelectCount(*)fromview

Usefollowingconversionfunctionswhilemigrationfromotherdatabases(Oracle/Teradataand
etc.)toHANA.
DECODEfunction(Oracle)toCASEstatementinHANA
CONVERTfunctiontoCASTstatementinHANA
TRUNCfunctiontoCASTstatementinHANA

SYSDATE,SYSTIMEorSYSTTIMESTAMPtoCURRENT_DATE,CURRENT_TIMEorCURRENT_TIMESTAMP
statementsinHANA

ConvertingBLOB/CLOBDataTypes(Oracle)toHANADatatypes:
BLOB/CLOBeldscannotbeusedHANAmodels.However,youcancreateageneratedcolumn
selectingrst5000characters(oranythingelseyoudlike)toreportonthedatastoredinthe
BLOB/CLOBeld.
StringfunctionslikeSUBSTRINGworksneonNCLOBeld.ForotherBLOBtypeelds,youcan
castittoVARCHARbeforeusingstringfunctions.
Substring(cast(BTESTasVARCHAR(5000)),1,10)
Concat()FunctionsinModelsareveryexpensiveandthecreateVirtualcolumns(auto-generatedcolumn)
forconcatenatedtextstringswillmakemoresense.
Checkfollowinglinkforsomeadditionalinfo.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0f2d8c9-f321-3110-
41bb-dc8e8e14dc9a?QuickLink=index&overridelayout=true&58815282151702
3.)NAMINGCONVENTIONS
ThereisnohardandfastruleforHANAModelNamingconvention.However,wehavefollowed
coupleofscenariosandyoucanpickwhichevernamingconventionyoulike.Wearealso
providinglinkfromSAPonthistopic.
Selectaconsistentnamingconventionsthroughouttheproject
NameeveryelementinCAPITALLETTERS.

Givemeaningfulbusinessnamestoallcolumnswhichareexposedtousers.Keepthenameasshortas
possible(preferablyunder15to20chars)

Option1 OptionII

ATTRIBUTEVIEWS DIM_DATE_AT AT_DATE

ColumnNames Givebusinessnames.Ifcolumnis Same


participatinginKeyforex:SITE_KEY

Columndescriptions SITE_DESC TheelementusedinLabel


Column(labelmapping)should
berenamedas
<ATTRIBUTE>.descriptions(e.g.
REGION.descriptions)

ANALYTICALVIEWS FACT_SALES_AV AN_SALES

Datafoundationcolumns IfECCyoucouldleavetechnicalnames Same


orsuxwith_FACT

RestrictedColumns IfexposedtousergiveaBusinessName same


otherwiseRM_.Ex:SOLD_AMT_US
(Exposedtouser)RM_SOLD_AMT_US
(usedforinternalcalculations)

CalculatedColumns BusinessNameofthemeasure same

http://startupfocus.saphana.com/hanamodelinggoodpractices/ 3/9
3/23/2017 HANAModelingGoodPractices|StartupFocus
CALCULATIONVIEWS FACT_SALES_CV CA_SALES

RestrictedColumns IfexposedtousergiveaBusinessName Same


otherwiseRM_.Ex:SALE_AMT
(Exposedtouser)CM_SALE_AMT(used
forinternalcalculations)

CalculatedColumns BusinessNameofthemeasure Same

ANALYTICALPRIVILEGES AP_RESTRICTION_AT(OnATTR Same


View)AP_RESTRICTION_AV(On
AnalyticalView)AP_RESTRICTION_CV
(OnCalcview)

HIERARCHY HI_<BUSINESS_NAME>_PC(forParent Same


Childhierarchy)
HI_<BUSINESS_NAME>_LV(forLabel
basedhierarchy).

INPUTPARAMETERS IP_PARAMETER_NAME same

VARIABLES VA_DATE Same

PROCEDURES SP_PROCEDURENAME same

CUSTOMTABLES ZT_TABLENAME ZT_tablename

4.)MODELING
BeforeYouBegin
CheckforKeycolumnsforanyNullValuesattablelevel.

ThecolumnsthatarepartofthejoinsintheHANAmodelsshouldnotcontainanyNULLvalues
(resolvenullvaluesthroughETLorSLTjobsbeforestartingmodeling).
General
CreateallexpectedAttributeViewsrst.
Thesewillbeusedlaterincreatinganalyticviewsandcalculationviews.
Anattributeviewcanbeusedinmultipleanalyticviewsorcalculationviews
Totheextentpossible,designyourattributeviewsascommoncomponentsthatcanbeusedin
multiplemodelstoreducemaintenanceeort.
Decisiontreeformodeling(inorderofperformance)
AnalyticView>AttributeView>GraphicalCalcView>CalcView(CEfunction)>CalcView
(SQL)

CreateviewsStepbystep.
Whatitmeansiscreateyourviewsstepbystep.Verifyeachstepbeforemovingontothenext
step.
ForexampleincreatinganAnalyticView:Createthedatafoundationrstandactivateitandsee
thedata.Ifyourdatasetisbigusealterwhereyoucouldget10-25rowsorlesstovalidatethe
model.Nextaddanattributeviewjoinandactivateandcheckdata.Itmightbeslowprocessbut
onceyouaredonemodelingitwillbedone.Theadvantagebydoingthisisyoucanndanydataor
joinissuesateverylevel.
4.1)ATTRIBUTEVIEWS:
YoumustdeneatleastoneKeyAttribute(Ex:SITE_KEY)onanattributeview.Thisistypicallythe
column(s)thatwillbeusedtojointheviewtoothertables/content.
Exposeonlyrequiredcolumnsusedinreportsandhierarchies.Donotcreatecolumnsforeverythingjust
becauseitsthere.

Givemeaningfulbusinessnamesforallexposedattributes.
Ingenerally,trytomakesureallattributenamesintheViewareunique.Thereshouldbenoduplicate
AttributesinotherAttributeviews.(SameattributecolumnshouldnotbeintwoAttributeViews,in
general)

Avoidcalculatedcolumns(exampleTo_date(),concat(),To_char()andetc.)inAttributeviews.

http://startupfocus.saphana.com/hanamodelinggoodpractices/ 4/9
3/23/2017 HANAModelingGoodPractices|StartupFocus
Calculatedcolumnscreateanimplicitcalcviewwrapperaroundtheanalyticviewandwillimpact
performance.
Considerreplacingthemwithmaterializedcolumns(orauto-generatedcolumns)intheunderlying
table.
AlternatecreatetheminCalculatedViews.
Levelbasedhierarchiesworkinmostofthereportingtools.ParentchildhierarchiesworksonlyinAnalysis
OLAP,AnalysisOceorExcel.
Checkperformanceofattributeviews.QueriesonAttributeviewsshouldrespondinsecondsotherwiseit
willimpactoverallperformanceoftheviewsthatuseit.
ForDescriptioncolumnstheelementusedinLabelColumn(labelmapping)shouldberenamedas
<ATTRIBUTE>.descriptions(e.g.REGION.description)
NOTE:TherearesomeextrastepsyouneedtodoifyouarecreatingCalcviewsbasedon
AnalyticalviewswithAttributeviewsconsistsofcolumn.description.InCalcviewsitconverts
column.descriptiontocolumn_descriptionandthishastoberemappedwithcolumn.description
inXMLandre-importandactivateCalcviews.
4.2)ANALYTICALVIEWS
StarSchemaDesignispossiblewithanalyticalviews.
Youcandenemeasuresonlyfromonefacttable,evenifyouhavemultiplefacttablesinyourdata
foundation.
Usedesigntimelters/inputparameterstolimitthedataset(ifpossible).
Usejoinsoninteger/datekeycolumns(ifpossible)

CreaterestrictedmeasuresbyusingDimensionsfromattributeorfromFactkeysfromdatafoundation.
Userestrictedmeasures(wherepossible).Thisperformsbetterintermsresourceconsumption(memory
and/orCPUtime)vs.calculatedmeasures
AvoidcreatingCalculatedAttributesinAVs.ForexampleTo_date(),concat(),To_char()andetc.Consider
movingthemtocalculationvieworpushthemtodatabaselayer(materializedorvirtualcolumn).
CalculatedattributesarecomputedinthecontextofCalcEngine(eventhoughtheyareinAnalyticView),
hencetherewillbedatatransferbetweenenginesandhencelowerperformance.Keepingallthe
calculationsinthecontextofOLAPenginewillgivethebestperformance.

AfteractivatingAVcheckin_SYS_BICifitisgeneratingAV/olap(itiscalledwrappercalcview)Thismeans
dataismovingbetweentheengines.Thisneedstobeavoided.
AvoidusingcalculationbeforeaggregationonBIGdatasets(thisisveryintensiveintermsofCPUtime).
Considermovingthesecalculationtodatabaselayer(materializedcolumnorvirtualcolumns)

IfyouhaveadesigntimelterintheAttributeviewandifthisAttributeviewisjoinedtothedata
foundationusingreferentialjoin,thejointotheattributeviewwillbealwaysexecuted(evenifnoattribute
isselectedfromAttributeView).Watchoutforthiswhileyouaremodeling.
BecarefulusingReferentialjoinssincethiscanleadtoinconsistentresultsifreferentialintegrityonboth
sidesofthejoinisnotassured.Ifyouarenotsure,useaLeftOuterJoinoranInnerJoin,asappropriate,
forconsistentresultsacrossqueriesemployingdierentcolumnsfromthemodel.
UseTemporalJoin(introducedinHANASP05)formodelingslowlychangingdimension.Onlyreferential
joinanddate&integerdatatypesaresupported.

AvoidCompoundjoins.Thismaynotpossiblealwaysbutwatchoutforanyperformanceissues.
IfyourmodelhavemanyjoinsyoucouldalsodeployonJoinenginetogetabestperformance(possible
onlyOLAPenginespecicfunctionslikeTemporalJoinisnotused)
UseInputparameterstocalculatemeasuresbasedonuserinput
Usevariablestofurtherrestrictthedatasetforbetterperformance
DISTINCTCOUNTS:
Distinctcountsinanylargedatabasesarechallenging.IfyouruncountdistinctonOLAPviewon
alargefacttableswithahighnumberofdistinctvaluesconsiderusingthenote.
1941113InuencestandardbehaviorofOLAPqueriesinadistributedHANAinstallation.
4.3)CALCULATIONVIEWS
Allviews/tablesshouldbeusedwithaprojectionnode.Projectionnodesimproveperformanceby
narrowingthedataset(columns).
Furtheroptimizationcanbedonebyapplyingltersatprojectionnodes.

AvoidusingJOINnodesincalculationview.ConsiderreplacingthemwithUNIONnodes(wherepossible).
AlternatelyconsiderpushingthesejoinstoAnalyticviews.
UseInputParameters/VariablestorestrictthedatasetwithintheCalcView.Filtersshouldbeappliedas
earlyaspossibleinthedataow.IfyouarecreateaCalcViewthatunionsmultipleCalcviews(orSubCalc

http://startupfocus.saphana.com/hanamodelinggoodpractices/ 5/9
3/23/2017 HANAModelingGoodPractices|StartupFocus
views),useConstantmappinginUnionNode.Thiswillimprovetheperformanceasthequerywillonly
fetchtheresultsrelatedtotheconstantvalueofthesubCalcview-bypassingothervaluesforaparticular
subCalcviewunderneaththeunionforexecutioninreportingifneeded.(Seethepicturebelow)

pic1sbt.png


Calculatedcolumnsshouldbedenedhere
Forexample:midstr(string(ERDAT),strlen(string(ERDAT))-9,4)
Concat(String1,String2)
CalculatedColumnsarecalculatedbeforeaggregation.
Hierarchies(ifany)needtoberedenedintheCalculationview.HierarchiesdenedintheAttributeViews
arenotvisibleintheCalculationView.

LabelsofAttribute(LabelColumn)&DescriptionofMeasuresfromunderlyingAttribute/Analyticor
CalculationviewsarenotvisibleintheCalculationView.Theseneedtobere-mapped.
EnableMultidimensionalreporting(introducedinSP06)shouldbeused.
IftheviewwascreatedinSP05orearlierrevision,thiscanbeenabledbyclickingSwitchto
Aggregationinthecontextmenuoftheprojectionnode(justbelowthesemanticnode)

STARJOINSINCALCVIEWS:
IntroducedinSP07.YoucanselectmultiplemeasuresfrommultiplefactstablesinoneStarmodelto
support3rdNormalFormdesign.

CheckthefollowingURLformoreonStarJoinsinCalculationviews.
http://scn.sap.com/community/services/blog/2014/02/13/hana-sp07star-join
4.3.1)SCRIPTEDCALCULATIONVIEWS

DONOTmixthefunctionsofSQLScriptandCEFunctionsinacompositemodel
(Forexample:donotcodeoneCalculationViewwithSQLScriptanduseitinsideanotherCalculation
ViewwithCEFunctions).Theperformancewillbeverybad.
TrytoexposeONLYrequiredeldsintheCE_PROJECTIONS
Passonallparametersasrequiredtothelowestlevel(thisappliestoGraphicalorScriptbasedViews)
.

Reducethesizeofthedatasetasearlyaspossibleinthedataow.Thiscanbedonebyapplying
staticltersorapplyingdynamicltersusingparametersatthelowestlevel
Minimizethesizeofanyintermediateresultsetsincomplexprocessing.Donotincludeanyextra
attributecolumnsthatmayincreasetherowsofaggregatedresultsbeingpassedbetweennodesin
thedataow.

Avoidextremelylargeintermediateresultsets,eveniftheywillbereducedoraggregatedbeforethe
nalresultisreturnedtotheclient.Thesecanhavehighmemoryrequirements.

Performcalculationsatthelastnodepossibleinthedataow(ideallydoneinnalaggregationor
projection).Thiswillreducetheamountofdatarowsonwhichyouareperformingthecalculations
alsoreducethenumberofcolumnsbeingtransferredfromonenodetoanother.
Insomesituations,youcanuseaunionandthenaggregatetheresultsinsteadofusingajoinforbetter
performance.
ReduceComplexityofSQLStatements:BreakupacomplexSQLstatementintomanysimplerones.
ThismakesaSQLScriptprocedureeasiertocomprehend.

IdentifyCommonSub-Expressions:Ifyousplitacomplexqueryintologicalsubqueriesitcanhelpthe
optimizertoidentifycommonsubexpressionsandtoderivemoreecientexecutionplans.

UnderstandtheCostsofStatements:Employtheexplainplanfacilitytoinvestigatetheperformance
impactofdierentSQLqueriesusedinscripts.

http://startupfocus.saphana.com/hanamodelinggoodpractices/ 6/9
3/23/2017 HANAModelingGoodPractices|StartupFocus
ReduceDependencies:AsSQLScriptistranslatedintoadataowgraph,andindependentpathsinthis
graphcanbeexecutedinparallel,reducingdependenciesenablesbetterparallelism,andthusbetter
performance.
TESTING:Dounittestingforeachmodelandcreatetestcasesdocument.Thiswillhelptocreate
adeliverabledocumenttoclient.
5.)SECURITY
DonotusetheoutoftheboxSYSTEMusertomanagedaytodaydatabaseadministration

CreateDelegatedAdministratorstododaytodayjobanduseSystemuserifnecessary.

CreateSecurityModel(Whichusercanseewhatdata)
USERS/ROLESwillbecreatedONLYbyDelegatedSYSTEMAdministratorUsers.

Usethedesigntimeroleinsteadoftheruntimerole(throughCreaterole/userSQLstatement)
Usedesigntimerolestocreatesecurity.

CreatingUserwillalsocreateaSchemabydefault.
ByDefaultSYSTEMdonothaveaccesstoothersusersSchemas.Systemuseroranyotherusercan
seedataonlywhenSchemaUsersGrantsaccesstoUsersandSystemUsers.

CreateaSecuritymodel(whichusercanseewhatcontent)beforeyouimplementHanadatalevel
security.

Considerusingrowlevelsecurity.
HANAOutoftheboxtheCOLUMNLevelsecurityfeatureisnottherebutthisneedtobehandledin
ModelingbycreatingonebasemodelwithSecuredColumnsandcreateanotherviewwithhidingall
thesecuredcolumns.

HANAsecurityisimplementedwithAnalyticalprivileges(APs)andAPswillimprovetheperformance
asitapplieslterstomodels.
ConsiderusingDynamicAnalyticPrivileges(introducedinSP05)wheneverpossible.Thiswillsimplify
theprocess.
AlwayscreaterolesandassignrequiredprivilegestoroleandassignRolestousers.

Donotgrant_SYS_BI_CP_ALLprivilegetoanyrole/user.

Createadevelopmentprojecttostoreyourdesigntimeobjectsinasharedrepository.
Designsecurityusingthedesigntimeroles.

DesigntimeroleisportabletoanotherSAPHANALandscapethroughlifecyclemanager.
6.)PERFORMANCE
CreateallcalculationsinAnalyticalorCalculationviews.AvoidcreatinganycalculationsinReportinglayer
(Universe&Frontendtools).
LimitoutputcolumnsusingProjectionnodes

Considerpartitioninglargetablestogetbetterperformance

Max2Brecordspertable(ortablepartition)andmax1000partitionspertable.
ForMoredetailscheckfollowinglink
https://cookbook.experiencesaphana.com/bw/operating-bw-on-hana/hana-database-
administration/system-conguration/partitioning-and-distribution-large-tables/
Donotcreateworkingtablesindierentschemas.Thiswillcreatesecurityproblemsonownerships.
InsteadofthatcreateaseparateschemaandcreateallworkingtablesanduseitinyourModeling.
Avoidcompositeprimarykeyswheneverpossible.Compositeprimarykeycreatesadditionalindexeson
thetable,whichwilltakeadditionalspaceandhitstheperformance.Ifyouhavetouseitbeawareofthis
fact.

IfpossibleavoidJoinsonCharactercolumns.

AnalyzetheperformanceoftheQuery/ModelsusingExplainPlanandVisualizationPlan
IdentifythelongrunningqueriesbyreviewingPerformancetabtoanalyzesystemperformancelocated
undertheAdministrationeditor
HanaAutomaticallyhandlesIndexesonkeycolumns.Createsecondaryindexonnon-keycolumnsifitis
absolutelynecessary.Createindexesonnon-primarykeycolumns(withhighcardinality)toenhancethe
performanceofsomequeriesusingtheindexadviser.
Syntax:CREATEINDEX<name>ON<table>.<column>
Usetheindexadvisertondoutforwhichtablesandcolumnsindexingwouldbemostvaluable.The
indexAdvisor.pyscriptispartofaSAPHANAsysteminstallationandrunsfromthecommandline.Itis
locatedinthe$DIR_INSTANCE/exe/python_supportdirectory.

Indexingtheprimarykeycolumnsisusuallysucientbecausequeriestypicallyputlterconditionson
primarykeycolumns.Whenlterconditionsareonnon-keyeldsandtableshavemanyrecords,creating

http://startupfocus.saphana.com/hanamodelinggoodpractices/ 7/9
3/23/2017 HANAModelingGoodPractices|StartupFocus
anindexonthenon-primarykeycolumnsmayimprovetheperformance.

Thereisatrade-obetweenindexingandmemoryconsumption:Whileindexingnon-primarykeycolumns
canmakequeryexecutionfaster,thedownsideisthatmemoryconsumptionincreases.Theindexadviser
takesthistrade-ointoaccount:Indynamicmode,theindexadviserlooksforthetablesandcolumnsthat
areusedmostoften.Thehighertheselectivityis,thatis,themoredierentvaluesareinthecolumn,the
higheraretheperformancegainsfromindexingthecolumns.
Tocheckwhetherthereisanindexforacolumn,youcanseethesystemviewM_INDEXES.

WithSAPHANA,youdonotneedtoperformanytuningtoachievehighperformance.Ingeneral,theSAP
HANAdefaultsettingsshouldbesucientinalmostanyapplicationscenario.Anymodicationstothe
predenedsystemparametersshouldonlybedoneafterreceivingexplicitinstructionfromSAPSupport.
Iftwocolumnsarefrequentlycomparedbyqueries,ensurethetwocolumnshavethesamedatatype.For
columnsofdierenttypes,SAPHANAusesimplicittypecastingtoenablecomparisoninHANAModels.
However,implicittypecastinghasanegativeeectonperformance.
7.)MIGRATION:
IfyouwanttotransporttheHANAcontentasyouareusedtodofortheABAPlandscapeandhas
e.g.processtoolsintopofthesystemtransportlandscape,thentherecommendedapproach
wouldbetouseCTS+.
iftheHANAlandscapeiscompletelyindependentandtherearenorequirementsconcerning
processintegrationorcouplingofotherapplicationartifacts,thenyoucanusetheHANAonly
transporttoolthatispartofHANALifecycleManagement(knownasHANAApplicationLifecycle
Manager),whichisaHANAonlytool.
Currentlythelimitationinbothscenariosis,thatyouhavetotransportthecompleteDelivery
Unit(DU)andcannottransportsmallergranularities.
SAPHANALifecycleManager:
TheSAPHANAlifecyclemanager(HLM)isatoolthatenablesexiblecustomizationsofan
existingSAPHANAsystem.TherearethreeavailableworkingmodesfortheSAPHANAlifecycle
manager:
1.UsingSAPHANAstudio
2.Usingthecommandline
3.Usingastandalonebrowser
UsingSAPHANALifecycleManagerthroughSAPHANAStudio:
Keepinmindthat,toworkwiththeHLM,youneedtomakecertaincongurationsettingsforthe
SAPHANAstudio.Therearealsocertainbrowserrestrictions.Formoreinformation,see
http://help.sap.com/hana/SAP_HANA_Update_and_Conguration_Guide_en.pdf
KeepinmindthatLifecycleManagementperspectiveintheSAPHANAstudiorequiresversionof
JavaVirtualMachineequalorhigherto1.6.0_12.
UsingSAPHANALifecycleManagerthroughStandaloneBrowser:
Makesureyoureviewthefollowingbrowserrequirements:
ForMicrosoftWindows,youneedInternetExplorerversion9orabove.IfyouarerunningInternetExplorer
version9,makesurethatyourbrowserisnotrunningincompatibilitymodewithyourSAPHANAhost.You
cancheckthisinyourbrowserbychoosingTools->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>.
MakesureyouusethefullyqualiednameoftheSAPHANAsystem,suchasmyhost.sap.com
(notjustmyhost).
8.)COMMONERRORS
Error:Cannotcreatecolumnindexduringactivation.
Thisissueoccurswhenyoutrytoredeploy/reactiveamodelafteryoumademinorchanges(or
importedamodelfromanothersystem).

DeletetheentryfromtheRUNTIME_OBJECTStableandactivateagain
DELETEfrom_SYS_REPO.RUNTIME_OBJECTSwhereOBJECT_NAMELIKE
%CA_MY_CALC_VIEW;
Youllseethisissue,ifyoutrytoactivateamodelwhilemassivedataloadtounderlyingtableisin
progress,whichlocksthetableforsignicantamountoftime(say1030minormore).
However,thismaynotbeanissuewithtypicalSLTreplication(notrsttimeload).TypicalSLTloads
onlylocksthetablesforfewseconds,SoSLTloadmayslowdowntheactivation.Butitdoesnoterror
outtheactivation.
Error:SAPDBTechJDBC:[2048]:columnstoreerror:<?xmlversion=1.0encoding=utf-8?>
<createCubeResultversion=1.0><status><message>Indexnameconictswithexistingindex
name</message><errorCode>2019</errorCode></status><details><warnings><detail>
<element>cubeSchema</element><code>46</code><message>Defaultlanguagenotset.Use
en</message></detail></warnings></details></createCubeResult>

http://startupfocus.saphana.com/hanamodelinggoodpractices/ 8/9
3/23/2017 HANAModelingGoodPractices|StartupFocus
AsSystemUser:
dropcalculationscenario_SYS_BIC.pkg/view;Ex:dropcalculationscenario
_SYS_BIC.ms/FACT_WM_AV;
Error:Couldnotexecuteselectyear,count(*)FROM_SYS_BIC.ms/FACT_SHIPPING_AV
groupbyyearSAPDBTechJDBC:[2048](at28):columnstoreerror:searchtableerror:[2712]
Errorexecutingphysicalplan:olap:mergingmultivaluedictsisnot
implemented;BwPopJoin2Inwardspop17(MODELER:VTTPen.TKNUMto.VBELN),in
executor::Executorincube:_SYS_BIC:ms/FACT_SHIPPING_AV
UPDATEschema.tablemergedeltaindex;Ex:UPDATESAP_MODELER.VBAKmergedeltaindex;
Error:Internaldeploymentofobjectfailed;Repository:Encounteredanerrorinrepository
runtimeextension;InternalError:CreateScenario:failedaCalcEngine.createScenario():The
followingerrorsoccured:Anindexalreadyexistswiththesamename(2003)nnprintingXML<?
xmlversion=1.0encoding=UTF-8standalone=no?><cubeSchemadefaultLanguage=EN
defaultSchema=_SYS_BICselect*fromsys.m_ce_calcscenarios;
dropcalculationscenario_SYS_BIC"."emc.sd/CV_BACKLOG_UPD2cascade;
Ifyouarenotabletoopenanyoftheviews:
CouldbeSTUDIOVersionproblem.UpgradeStudio
NotabletoopenanyANVIEW:
UnderlyingKeyColumnsinjoinsarechanged.OpenXmlleandmapcorrectkeys.
TroubleDeletingPackage:
Checkin_SYS_BI
select*from_SYS_BI.BIMC_ALL_CUBESwherecube_name=FACT_WM_AV;

select*from_SYS_BI.BIMC_DIMENSIONSwhereCOLUMN_OBJECT
=_SYS_BIC.ms/FACT_WM_AV
select*from_SYS_BI.BIMC_DIMENSIONS
FROM_SYS_REPO
select*from_SYS_REPO.ACTIVE_OBJECTwhereObject_name=FACT_WM_AV
select*from_SYS_REPO.PACKAGE_CATALOGwherePACKAGE_ID=ms
select*from_SYS_REPO.INACTIVE_OBJECTwhereObject_name=FACT_WM_AV
Someotherissuessolutioncanbefoundinfollowingdoc.
http://scn.sap.com/docs/DOC-50291
9.)BestPracticestoBuildBusinessObjectsUniverseagainstHANAModels.
UniversesshouldalwayscreateagainstHANADatabaseinformationModels.

BusinesslogicneedtobepushedtoHANAmodelstogetmaximizingthequeryperformanceandalsoitis
presentationlayeragnostic.EveryreportingtoolisabletoconsumeHANAmodelsasis.ForExampleWebi,
Explorer,Lumira,A-Oce,XSengine,HTML5appsandother3rdpartyreportingtools.
10.)SomeUsefulLinks:
YTD,MTDothercalculationsbasedonrelativedates
http://scn.sap.com/docs/DOC-50420
HandlingSCDswithSLT
http://scn.sap.com/docs/DOC-45991
HanaDBInstall:
http://scn.sap.com/docs/DOC-31036
RowtoColumn&ColumntoRowTransformationinModeling.
http://scn.sap.com/docs/DOC-51791
http://scn.sap.com/docs/DOC-50541
Conclusion:
Thanksforreadingthisblog.WewillcontinuouslyupdatethisBlogwithnewupdates.We
appreciateyourfeedbacktoimprovethisblog.
DISCLAIMER:USETHISDOCUMENTATYOUROWNRISK.

ThisentrywaspostedinBlogsandtaggedhana,MODELINGonNovember4,2015
[http://startupfocus.saphana.com/hana-modeling-good-practices/]byShivajiPatnaik.
17,421views
(0votes,average:0.00outof5)
Youneedtobearegisteredmembertoratethispost.

SAP.com SAP.com/HANA SCN.SAP.com SAP.com/big

TopOfPage Privacy LegalDisclosure Copyright AdditionalTerms FollowSAPStartupFocus

http://startupfocus.saphana.com/hanamodelinggoodpractices/ 9/9

Vous aimerez peut-être aussi