0% found this document useful (0 votes)
133 views3 pages

SAP Temporal Joins

SAP based temporal join

Uploaded by

Raja
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)
133 views3 pages

SAP Temporal Joins

SAP based temporal join

Uploaded by

Raja
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/ 3

1/10/2016

UsingTemporalJointofetchtheresultsetwit...|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

SAPHANAandInMemoryComputing

UsingTemporalJointofetchtheresultsetwithinthe
TimeintervalinSAPHANA
PostedbyAkshayNayakinSAPHANAandInMemoryComputingonSep28,201412:04:26PM

HelloAll,

Inthisblog,iamgoingtoexplainhowtouseTemporalJoinfeatureavailableinHANAtofetchtheRecordsfrom
transactiontablebasedonTimeintervalfieldsofMasterTable.

Problem:

SometimewecomeacrossscenariowhereinweneedtoanalysethedatabyjoiningTransactiontableandMaster
tableonkeycolumnandfetchthedataforaparticulartimeperiodasspeicifiedinFromandTodatesofMastertable.
InthiscaseweneedtogoforaNonEquijoin.ThiscanbeeasilyachievedthroughScriptbasedViewswhereinyou
useeitherBETWEENoperatoror>and<operator.HowdoweachievethesameusingAnalyticalviewinHANA?

Solution:

ToachievetheabovestatedprobleminAnalyticalview,wehavetogoforaTemporaljoin.Youcreateatemporaljoin
usingthetemporalcolumnthatspecifiesthetimeintervalwiththestartandtheenddate.Theresultsetisfetched
basedonthetimeintervalmappedusingthetemporalcolumn.Thatmeansarecordisonlyincludedintheresultsetif
thetimeintervallieswithinthevalidtimeinterval.ThisfeatureisavailableinSAPHANAstartingfromSP05.

Ihavecreated2tablesProduct_masterandProduct_salestableandloadedwithsampledataasshownbelow,

ProductMaster:

Product_sales:

NowletscreateanattributeviewcontainingmastertableProduct_master.

http://scn.sap.com/community/hanainmemory/blog/2014/09/28/usingtemporaljointofetchtheresultsetwithinthetimeinterval

1/3

1/10/2016

UsingTemporalJointofetchtheresultsetwit...|SCN

AlsowewillcreateAnalyticalviewwithProduct_salestableindatafoundationlayerandletstrytojoinabovecreated
attributeviewinLogicaljoinnode.

Inthelogicaljoin,letscreateatemporaljoinbetweenthedatefieldofthefacttabletoaninterval(toandfrom)fieldof
theattributeview.Thesupporteddatatypesare:timestamp,date,andinteger.
NowselectTemporalcolumnthatindicatestimecolumninfacttable,fromandtocolumnfromattributeviewwhich
specifiestimeintervalandTemporalconditiononwhethertoincludeorexcludeDates.Thevariousoptionsavailable
forTemporalconditionare,IncludetoandExcludefrom,Excludeboth,Includeto.WewillkeepExcludetoandInclude
fromoption.

ActivateandruntheAnalyticalviewandyoucanseetheoutput.

WecanseethatP001productvaluefordate20140310,P003productvaluefordate20140410and20140628
hasbeenfilteredsincetheyfallbeyondthetimeinterval.AlsoyoucannoticeP002productvaluefordate20140426
hasbeenfilteredsincewehavekeptExcludetoandIncludefromoption.

ThusweareabletoachievetheintendedresultthroughAnalyticalview.

Thanksforreadingthisblog,YourSuggestionsandfeedbacksaremostwelcome

Regards,
Akshay

http://scn.sap.com/community/hanainmemory/blog/2014/09/28/usingtemporaljointofetchtheresultsetwithinthetimeinterval

2/3

1/10/2016

2791Views

UsingTemporalJointofetchtheresultsetwit...|SCN

Products:sap_hanaTags:temporal_join,analytical_views

AverageUserRating
(9ratings)

1Comment
PetrStastnyMar5,20153:44PM

Hi,
honestlyIdonotunderstandtheexample.ThetablecontentyouhaveintroducedIwouldcall
inconsistentdatabase.HowcanIhaveasalesforproductwhichisnotvalidforthatdate?
Petr
Like(0)

SiteIndex
Privacy

ContactUs
TermsofUse

SAPHelpPortal
LegalDisclosure

Copyright

http://scn.sap.com/community/hanainmemory/blog/2014/09/28/usingtemporaljointofetchtheresultsetwithinthetimeinterval

FollowSCN

3/3

You might also like