Escolar Documentos
Profissional Documentos
Cultura Documentos
HANAbasedBWTransformation|SAPBlogs
GetStarted
Solutions
Partner
Community
Support
About
Training
Community
Developer
Blogs
HANAbasedBW
Transformation
May24,2016
| 3,036Views |
TorstenKessler
morebythisauthor
BW(SAPBusinessWarehouse)
SAPHANA | abap | BusinessIntelligence | bw | calcscenario | calculationscenario | data
warehouse | datawarehousing | hana | pushdown | saphana | transformation
share
0
share
0
tweet
share
2
Follow
1HANAbasedBWTransformation
What is a SAP HANA push down in the context of BW
transformations? When does a push down occur? What are the
prerequisitesforforcingaSAPHANApushdown?
BeforeIstarttoexplainhowaSAPHANAbasedBWtransformation
couldbecreatedandwhatprerequisitesarenecessarytoforcea
pushdownIwillprovidesomebackgroundinformationonthe
differencesbetweenanABAPandSAPHANAexecutedBW
transformation.
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
1/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
AHANAbasedBWtransformationexecutesthedatatransformation
logicinsidetheSAPHANAdatabase.Figure1.1showsontheleft
handsidetheprocessingstepsforanABAPbasedtransformation
andontherighthandsideforaSAPHANAbasedtransformation.
This blog provides information on the pushdown feature for
transformationsinSAPBWpoweredbySAPHANA.Thecontenthere
isbasedonexperienceswithrealcustomerissues.Thematerialused
is partly taken from the upcoming version of the SAP education
coursePDEBWPBWBackendundProgramming.
This blog is planned as part of a blog series which shares
experiences collected while working on customer issues. The listed
explanationsareprimarilybasedonreleasesbetweenBW7.40SP09
andBW7.5SP00.
Thefollowingadditionalblogsareplanned/available:
HANAbasedTransformation(deepdive)(Addedon06/17/2016)
HANA
based
BW
Transformation
Analyzing
and
debugging(Addedon06/23/2016)
SAPHANAAnalysisProcess
Generalrecommendation
HANA based BW Transformation New features delivered by
7.50SP04(Addedon08/29/2016)
Routines
ErrorHandling
HANA based BW Transformation SAP Notes (Added
on
06/09/2016)
AHANAbasedBWtransformationisanormalBWtransformation.The
newfeatureisthatthetransformationlogicisexecutedinsidetheSAP
HANAdatabase.Fromadesigntimeperspective,intheAdministrator
Workbench,thereisnodifferencebetweenaHANAbasedBW
transformationandaBWtransformationthatisexecutedintheABAP
stack.BydefaulttheBWruntimetriestopushdownalltransformationsto
SAPHANA.Beawarethattherearesomerestrictionswhichpreventa
pushdown.Forexampleapushdowntothedatabase(SAPHANA)isnot
possibleifaBWtransformationcontainsoneormoreABAProutines(Start,
End,ExpertorFieldRoutine).FormoreinformationseeTransformationsin
SAPHANADatabase.
RestrictionsforHANAPushDown
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
2/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
SAPNote2057542Recommendation:UsageofHANAbased
Transformationsprovidessomebasicinformationand
recommendationsregardingtheusageofSQLScriptinsideBW
transformations.
1.1HANAPushDown
What is a SAP HANA push down in the context of BW
transformations? When does a push down occur? What are the
prerequisitesforforcingaSAPHANApushdown?
Before I start to explain how a SAP HANA based BW transformation
could be created and what prerequisites are necessary to force a
push down I will provide some background information on the
differences between an ABAP and SAP HANA executed BW
transformation.
AHANA based BW transformation executes the data transformation
logic inside the SAP HANA database. Figure 1.1 shows on the left
hand side the processing steps for an ABAP based transformation
andontherighthandsideforaSAPHANAbasedtransformation.
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
3/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
Figure1.1:ExecutionofSAPBWTransformations
4/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
transferreddirectlyfromthesourceobjecttothetargetobjectwithina
singleprocessingstep.TechnicallythisisimplementedasanINSERT
AS SELECT statement that reads from the ColumnView and inserts
into the target database object of the BW transformation. This
eliminatesthedatatransferbetweenDatabaseServerandApplication
Server(ABAP).ThecompleteprocessingtakesplaceinSAPHANA.
1.2CreateaHANAbasedBWTransformation
ThefollowingstepsarenecessarytopushdownaBWtransformation:
CreateaSAPHANAexecutableBWtransformation
CreateaDataTransferProcess(DTP)toexecutetheBW
transformationinSAPHANA
1.2.1CreateastandardSAPHANAexecutableBW
transformation
A standard SAP HANA executable BW transformation is a BW
transformation without SAP HANA specific implementation, which
forcesaSAPHANAexecution.
The BW Workbench tries to push down new BW transformations by
default.
The activation process checks a BW transformation for unsupported
push down features such as ABAP routines. For a detailed list of
restrictionsseeSAPHelpTransformationsinSAPHANADatabase.
If none of these features are used in a BW transformation, the
activation process will mark the BW transformation as SAP HANA
ExecutionPossiblesee(1)inFigure1.2.
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
5/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
Figure1.2:FirstsimpleSAPHANAbasedTransformation
6/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
1.2.2CreateaSAPHANAtransformationwithSAP
HANAExpertScript
Ifthebusinessrequirementismorecomplexanditisnotpossibleto
implement these requirements with the standard BW transformation
feature, it is possible to create a SQLScript procedure (SAP HANA
Expert Script). When using a SAP HANA Expert Script to implement
the business requirements the BW framework pushes the
transformationlogicdowntothedatabase.Beawarethatthereisno
optiontoexecuteaBWtransformationwithaSAPHANAExpertScript
intheprocessingmodeABAP,onlyprocessingmodeHANAapplies.
FromtheBWmodellingperspectiveaSAPHANAExpertScriptisvery
similar to an ABAP Expert Routine. The SAP HANA Expert Script
replaces the entire BW transformation logic. The SAP HANA Expert
Scripthastwoparameters,oneimporting(inTab)andoneexporting
(outTab) parameter. The importing parameter provides the source
datapackageandtheexportingparameterisusedtoreturntheresult
datapackage.
However,
there
are
differences
from
the
perspective
of
7/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
support,etc.isbetterintheABAPdevelopmentenvironment.
SQLscriptdevelopmentexperienceiscurrentlynotas
widespreadasABAPdevelopmentexperience
AHANAexecutedtransformationisnotalwaysfaster
FromthetechnicalperspectivetheSAPHANAExpertScriptisaSAP
HANA database procedure. From the BW developer perspective the
SAP HANA Expert Script is a SAP HANA database procedure
implemented as a method in an AMDP (ABAP Managed Database
Procedure)class.
TheAMDPclassisbegeneratedbytheBWframeworkandcanonly
be modified within the ABAP Development Tools for SAP
NetWeaver(ADT),seehttps://tools.hana.ondemand.com/#abap.The
generated AMDP class cannot not be modified in the SAP GUI like
Class editor (SE24) or the ABAP Workbench (SE80). Therefore it is
recommended to implement the entire dataflow in the Modeling
Tools
for
SAP
BW
powered
by
SAP
HANA,
see
NowwemustswitchintotheBWModelingPerspective.Toopenthe
BWModelingPerspectivegotoWindow=>Other..andselectinthe
upcomingdialogtheBWModelingPerspective,seeFigure1.3.
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
8/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
Figure1.3:OpentheBWModelingPerspective
To open the embedded SAP GUI a BW Project is needed. It is
necessary to create the BW Project before calling the SAP GUI. To
createanewBWProjectopenFile=>New=>BWProject.Tocreatea
BW Project a SAP Logon Connection is required, choose the SAP
Logon connection and use the Next button to enter your user logon
data.
Recommendations: After entering your logon data it is possible to
finalizethewizardandcreatetheBWProject.Irecommendtousethe
Next wizard page to change the project name. The default project
nameis:
<SystemID>_<Client>_<Username>_<Language>
I normally add at the end a postfix for the project type such as_BW
fortheBWProject.ForanABAPprojectlateronIwillusethepostfix
_ABAP. The reason I do that is both projects are using the same
symbol in the project viewer and the used postfix makes it easier to
identifytherightproject.
Once the BW Project is created we can open the embedded SAP
GUI.TheBWModelingperspectivetoolbarprovidesabuttontoopen
theembeddedSAPGUI,seeFigure1.4.
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
9/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
Figure1.4:OpentheembeddedSAPGUIinEclipse
ChoosethecreatedBWProjectintheupcomingdialog.Nextstartthe
BW Workbench (RSA1) within the embedded SAP GUI and create
the BW transformation or switch into the edit mode for an existing
one.
To create a SAP HANA Expert Script open Edit => Routines => SAP
HANAExpertScriptCreateinthemenuoftheBWtransformation.Confirm
therequesttodeletetheexistingtransformationlogic.Keepinmindthatall
implemented stuff like Start End or FieldRoutines and formulas will be
deletedifyouconfirmtocreateaSAPHANAExpertScript.
In the next step the BW framework opens the AMDP class by calling the
ABAP Development Tools for SAP NetWeaver (ADT). For this an ABAP
projectisneeded.SelectanexistingABAPProjectorcreateanewonein
thedialog.
AnewwindowwiththeAMDclasswillappear.Sometimesitisnecessary
to reload the AMDP class by pressing F5. Enter your credentials if
prompted.
The newly generated AMDP class, see Figure1.5, cannot not directly be
activated.
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
10/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
Figure1.5:NewgeneratedAMDPClass
Before I explain the elements of the AMDP class and the method I will
finalize the transformation with a simple valid SQL statement. The used
SQLstatement,asshowninFigure1.6,isasimple1:1transformationand
isonlyusedasanexampletoexplainthetechnicalbehavior.
Figure1.6:SimplevalidAMDPMethod
Figure1.7:BWTransformationwithSAPHANAScriptProcessing
As explained before, if you use a SAP HANA Expert Script the BW
transformationcanonlybeenprocessedinSAPHANA.Itisnotpossibleto
execute the transformation on the ABAP stack. Therefore the generated
ABAPprogram(Extras=>DisplayGeneratedProgram)isnotavailablefora
BWtransformationwiththeprocessingtypeSAPHANAExpertScript.
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
11/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
1.2.2.1Sortingaftercallofexpertscript
WithintheBWtransformationtheflagSortingaftercallofexpertscript,see
Figure1.8,(Edit=>Sortingaftercallofexpertscript)canbeusedtoensure
thatthedataiswritteninthecorrectordertothetarget.
Figure1.8:Sortingaftercallofexpertscript
Ifthedataisextractedbydeltaprocessingthesortorderofthedata
couldbeimportant(dependingonthetypeoftheuseddeltaprocess).
By default, the flag is always set for all new transformations and its
recommendedtoleaveitunchanged.
For older transformations, created with a release before 7.40 SP12,
theflagisnotsetbydefault.Sothecustomercansettheflagifthey
needthedatainaspecificsortorder.
Keepinmindthattheflaghasimpactattwopoints:
Theinput/outputstructureoftheSAPHANAExpertScriptis
enhanced/reducedbythefieldRECORD
TheresultdatafromtheSAPHANAExpertScriptwillbesorted
bythenewfieldRECORD,iftheflagisset,aftercallingtheSAP
HANAExpertScript
Figure1.9:ConcatenatedfieldRECORD
TheRECORDfieldfromtheoutTabstructureismappedtotheinternalfield
#SOURCE#.1.RECORD.Lateroninarownumnodeofthe
CalculationScenariotheresultdatawillbesortedbythenewinternalfield
#SOURCE#.1.RECORD,seeFigure1.10.
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
12/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
Figure1.10:CalculationScenarionoterownum
1.2.2.2TheAMDPClass
TheBWtransformationframeworkgeneratesanABAPclasswithamethod
called PROCEDURE. The class implements the ABAP Managed Database
Procedure (AMDP) marker interface IF_AMDP_MARKER_HDB. The
interfacemarkstheABAPclassasanAMDPclass.AmethodofanAMDP
class can be written as a database procedure. Therefore the BW
transformation framework creates a HANA specific database procedure
declarationforthemethodPROCEDURE,seeFigure1.11:
Figure1.11:MethodPROCEDUREdeclaration
This declaration specifies the method to the HANA database (HDB), the
languagetoSQLSCRIPTandfurtherondefinesthatthedatabaseprocedure
isREADONLY. The read only option means that the method / procedure
must be sideeffect free. Sideeffect free means that only SQL elements
(DML) could be used to read data. Elements like DELETE, UPDATE,
INSERT used on persistent database objects are not allowed. These data
modification statements can also not be encapsulated in a further
procedure.
You cannot directly read data from a database object managed by ABAP
likeatable,vieworprocedureinsideanAMDPprocedure,see(1)inFigure
1.12.AdatabaseobjectmanagedbyABAPhastobedeclaredbeforethey
can used inside an AMDP procedure, see (2). For more information about
theUSINGoptionseeAMDPMethodsintheABAPdocumentation.
Modificationofthemethoddeclaration
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
13/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
IncaseofreadingfromfurthertablesinsidetheSQLScriptitcouldbe
necessarytochange(enhance)themethoddeclarationbyaddingthe
USINGoption.Itisimportanttoensurethatthefirstpartofthemethod
declarationisstableandwillnotbechanged.Donotchangethefollowing
partofthedeclaration:
METHODPROCEDUREBYDATABASEPROCEDUREFORHDBLANGUAGE
SQLSCRIPTOPTIONSREADONLY
TheUSINGoptionmustbeaddedattheendofthedeclarationpart,see
Figure1.12
Figure1.12:DeclarationofDDICobjects
TheAMDPframeworkgenerateswrapperobjectsforthedeclareddatabase
object
managed
by
ABAP
The
view
/BIC/5MDEH7I6TAI98T0GHIE3P69D1=>/BIC/ATK_RAWMAT2#covw in (3)
was generated for the declared table /BIC/ATK_RAWMAT2 in (2). The blog
UndertheHANAhoodofanABAPManagedDatabaseProcedureprovides
some further background information about AMDP processing and which
objectsaregenerated.
AMDPClassmodification
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
14/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
Currently the ABAP Development Tools for SAP NetWeaver (ADT) does not
protectthesourcecodewhichshouldnotbeenmodified,likeinanABAProutine.
That means all modifications in the AMDP class outside the method
implementationwillnotbetransportedtothenextsystemandwillbeoverwritten
by the next activation process. The BW transformation framework regenerates
theAMDPclassduringtheactivationprocess.
LateronIllprovidesomegeneralrecommendationsinaseparate
blogwhicharebasedonexperienceswecollectedincustomer
implementationsandcustomerincidents.Thegeneral
recommendationwillcoverthefollowingtopics:
Avoidpreventingfilterpushdown
Keepinternaltablesmall
Initialvalues
Columntypedefinition
Avoidimplicitcasting
UseofDISTINCT
PotentialpitfallatUNION/UNIONALL
InputParameterinsideunderlyingHANAobjects
Internalvs.externalformat
AMDPClassname
Until version BW 7.50 SP04 the AMDP class name is generated based on the
fieldRSTRANTRANPROG.FromBW7.50SP04thefieldRSTRANEXPERTis
used to generate the AMDP class name. The metadata storage for the AMDP
routines was adjusted to align the AMDP metadata storage analogous to the
ABAPmetadata.
AMDPdatabaseprocedure
Sometime, in BW 7.40, it could be happen that the corresponding database
procedure is not generated. The report RSDBGEN_AMDP can be used to
generatethedatabaseproceduresforagivenAMDPclass.
1.2.3DataflowwithmorethanoneBW
transformation
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
15/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
The push down option is not restricted on data flows with one BW
transformation. It is also possible to push down a complete data flow with
several included BW transformations (called stacked data flow). To get the
bestperformancebenefitsfromthepushdownitisrecommendedtostacka
dataflowbyamaximumofthreeBWtransformations.Morearepossiblebut
notrecommended.
The
used
InfoSources
(see
SAP
Help:
InfoSource
and
Figure1.13:HANAprocessingandInfoSources
CalculationScenarioinastackeddataflow
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
16/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
1.2.4CreateaDataTransferProcess(DTP)to
executetheBWtransformationinSAPHANA
TheDataTransferProcess(DTP)toexecuteaBWtransformationprovides
a flag to control the HANA pushdown of the transformation. The DTP flag
SAPHANAExecution,see(1)inFigure1.14,canbecheckedorunchecked
by the user. However, the flag in the DTP can only be checked if the
transformation is marked as SAP HANA Execution Possible, see (1) in
Figure1.2. By default the flag SAP HANA Execution will be set for each
newDTPif
UptoBW7.50SP04thefollowingDTPoptionspreventapushdown:
SemanticGroups
ErrorHandlingTrackRecordsafterFailedRequest
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
17/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
Figure1.14:DTPforthefirstsimpleSAPHANAbasedTransformation
InthesimpletransformationsampleaboveImusingoneBWtransformation
to connect a persistent source object (DataSource (RSDS)) with a
persistent target object (Standard DataStore Object (ODSO)). We also call
this type a nonstacked dataflow Ill provide more information about non
stacked and stacked data flows later. The related SAP HANA
Transformation for a DTP can be found in menu Extras => Display
GeneratedHANATransformation,see(2)inFigure1.14. In case of a non
stacked data flow the DTP uses the SAP HANA Transformation of the
BWtransformation,see(3)inFigure1.14.
The usage of a filter in the DTP does not prevent the HANA push down.
ABAPRoutinesorBExVariablescanbeusedaswell.Thefiltervalue(s)is
calculated in a prestep and added to the SQL SELECT statement which
reads the data from the source object. We will look into this later in more
detail.
1.2.5ExecuteaSAPHANAbasedtransformation
From the execution perspective, regarding the handling, a HANA
based transformation behaves comparable to an ABAP based
transformation,simplypresstheExecutebuttonorexecutetheDTP
formaprocesschain.
LateronIwillprovidemoreinformationaboutpackagingandparallel
processing.
1.2.6Limitations
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
18/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
1.2.7Featurelistthatpreventsapushdown(Addedon
07/20/2016)
TheofficialSAPHelpprovidesasmallfeaturelistwhichpreventsa
HANAexecution.Hereareamoredetailedlist:
QueriesasInfoProviderarenotsupportedasthesource
ABAPStart,EndandFieldRoutines
WithBW7.50SP04correspondingSQLScriptroutines
aresupported
Formulaelementsthatpreventsapushdown
DATECONV,
WEEK_TO_1ST_DAY,
FISCPER_CALMONTH,
CALMONTH_FISCPER,
CONDENSE,
ABORT_PACKAGE,
SKIP_RECORD,
SKIP_RECORD_AS_ERROR
LOG_MESSAGE
Customercreatedformulas(BAdIRSAR_CONNECTOR)
TransferroutineCharacteristic/InfoObjectRoutine)arenot
supported
0SOURSYSTEMand0LOGSYSaresupported
RuletypeTIME(TimeCharacteristic)withTimeDistributionare
notsupported
Rulegroupsarenotsupported
InfoObjectwithtimedependentAttributesarenotsupported
assourceandastarget
SupportedwithBW7.50SP04
CubelikeDataStoreObjects(advanced)arenotsupported
astarget
SupportedwithBW7.50SP04
DataStoreObjects(advanced)withnoncumulativekey
figure(s)arenotsupportedastarget
SupportedwithBW7.50SP04
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
19/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
ToreaddatafromDataStoreobjects,theentirekeymustbe
provided
Nearlineconnections
SupportedwithBW7.50SP04(Addedon09/21/2016)
DTPOptions
ErrorHandlingnotsupported
SupportedwithBW7.50SP04
SemanticGroups
FurtherinformationaboutsupportedSAPHANAexecutionfeatureare
providedintheSAPnote:2329819SAPHANAexecutioninDTPs
(DataTransferProcesses)Optimizations.
AlertModerator
22Comments
YoumustbeLoggedontocommentorreplytoapost.
NileshPathak
June1,2016at1:35pm
HiTorsten,thanksforblogwewereworkingonBW7.5SP2HANAproject
&foroneofrequirementweneedtodeletesomedatacominginfrom
sourceERPtoBW.likeinBWwewouldnormallyusestartroutinetodelete
unwantedrecordsbuthereasweknowprocessingatHANADBwillnotbe
supportedwhenweuseStartroutine.
HencewewerelookingtouseHANASQLscriptinordertoleverageHANA
hencepleasecanyouletusknowifthisispossibletodeletecertainrecords
basedonsomeconditionletssay
IwanttodeleteallrecordsfromsourcewherefieldXisblank.
IfthisispossiblethencanyouadvisesyntaxplsaswhenIwastryingtouse
DELETEinprocedureitwasgivingerror.
Henceappreciateyourquickresponse.
regards
Nilesh
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
20/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
TorstenKessler Postauthor
June1,2016at2:42pm
Hi,
SQLScriptStart,EndandFieldroutinesareplannedforSP04.
Buttodelete(donotfurtherprocess)specificrowsyoucanfilter
theinTab.
Foryoursampleaboveyoucanwritethewholecontentfrom
theinTabintoatemporarytableandfilterouttherowswhich
youdonotwanttoprocessfurtheron.Example:
tmpInTab=
SELECT*
FROM:inTab
WHEREfield_X=
Iftherenofurtherlogicrequiredyoucanalsowritethefiltered
resultintotheoutTab:
outTab=
SELECT<fieldlist>
FROM:inTab
WHEREfield_X=
HereyoumustexplicitmapthefieldsfromtheinTabtothefieldfrom
theoutTab!
Keepinmindthatthelogicshouldbeimplementedbyusing
declarativeSQLScriptlogic
toenabletheoptimizertogetthebestruntimeperformance.
Illprovidemoreinformationaboutrecommendationinoneofthenext
upcomingblogs(Generalrecommendation).
Regrads
Torsten
TorstenKessler Postauthor
June9,2016at11:30am
Shortupdate:Addedbox:Modificationofthemethoddeclaration
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
21/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
ErdemPekcan
June10,2016at2:42pm
Greatinformation,thankyou!
WhatcouldbethereasonthatIcantseethegeneratedprocedureinFigure
1.12?
Also,Itrytomapasamplefieldwithalookup.Howshouldbethewholesytax?
ImworkingonaBW7.4SP14andHANA1.00.112.01system.
Thanks!
TorstenKessler Postauthor
June10,2016at7:22pm
Hi,
1.==WhatcouldbethereasonthatIcantseethegeneratedprocedure
inFigure1.12?==
Youmean,youhadcreatedatransformationwithaSAPHANA
ExpertScriptandactivatedtheAMDPclassandthedatabase
procedure<<CLASSNAME>>=>PROCEDUREisnotinthefolder
PROCEDUREintheschemaSAP<SID>?
Inthatcaseyoucanfirsttrytoactivatethetransformation.Isthe
DBprocedurestillnotthere.OpenthereportRSDBGEN_AMDP
enteryourclassnameandchoosetheoptionCreatedatabase
objects.Butoptiontwoshouldnotbenecessary.
2.==Also,Itrytomapasamplefieldwithalookup.Howshouldbe
thewholesytax?==
First,ourrecommendationisusestandardtransformationfunctionifit
possible.Firstcheckifastandardrulelike(Masterdataread,read
fromclassicDSO,readfromadvancedDSO)usable.Wedenhanced
thelookuprulesothatyoualsocanmapfieldincasetheoriginal
InfoObjectsarenotinthesourcestructureavailable.SeeSAPHelp:
ReadfromDataStoreObject(advanced):
ToreadfromaDataStoreobject(advanced),thesystemfirstprovides
youwithaproposalforhowthefieldscanbeassigned.Thekeyfields
mustbeassignedtothesourcefieldsofthetransformation.When
assigningthefields,thenamesdonotneedtobeidentical.
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
22/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
Incasethestandardrulesdoesntfityoucanread(join)the
datafromatablewiththesourcedata(inTab).
ThefollowingsampleexplainshowIreadthefieldTK_VENDOR
formthetable/BIC/ATK_RAWMAT1andaddittotheoutTab.Todo
thatIJOINtheinTabwiththetable/BIC/ATK_RAWMAT1.
outTab=SELECTintab.MATERIAL,
intab.PLANT,
...
mat.TK_VENDOR,
...
RECORD
FROM:inTabasintab
JOIN/BIC/ATK_RAWMAT1asmat
ONintab.MATERIAL=mat.TK_MAT
MoreinformationabouttheJOINoperationcouldbefoundhere
AllaboutJoinsusingSQLinHANA
Hopethisishelpful
Regrads
Torsten
ErdemPekcan
June11,2016at5:10pm
HiTorsten,
Thanksforthedetailledexplanation.
WhatImeantwas,inFigure1.12theimage
markedwith3includesthefollowingline:
/BIC/5MDEH7I6TAI98T0GHIE3P69D1=>/BIC/ATK_
RAWMAT2#covw
Thepart#covwseemstobeageneratedsuffix,
right?
IsitgeneratedonceUSINGZTABLEisaddedand
acivatedwithinthescript?
Ifso,thatssomethingIcouldntfind.
Iwilltrythestandardoptionaslongaspossible.
Thanksagain.
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
23/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
TorstenKessler Postauthor
June13,2016at8:15am
Hi,
thatsrightthegeneratedobject
/BIC/5MDEH7I6TAI98T0GHIE3P69D1=>/BIC
/ATK_RAWMAT2#covw
isaview(notaprocedure)andcould
befindinthefolderview(notcolumn
view).
Torsten
AbyJacob
June13,2016at6:31am
ExcellentInfo
Thanks!!
VladimirKolodyazhny
June13,2016at12:05pm
HelloTorsten!
Wearecurrentlyfacingtheissuewithfilteringincomingdatabydtpfilters.
Inoticed,youreplanningsomearticlesabout
InputParameterinsideunderlyingHANAobjects
Maybeyoucanprovidesomeadditionalsourcestolookuponthistopics?
TorstenKessler Postauthor
June16,2016at12:16pm
HiVladimir,
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
24/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
Inoneofmynextblogs(generalrecommendations)Iwillprovidea
samplewhereIuseaCaclViewwithaninputvariable.TheCalcView
ispartofaCompositeProviderandtheCompositeProviderisasource
ofatransformation.
IllshowincasetheinputparameterismandatorythattheDTPfilter
isalsomandatory.
SorrybutIhavenofurthersourcematerialtoprovide.
Maybeyoucanexplainyourissueinmoredetailsorincaseofan
errorcreateanincident.
Torsten
VladimirKolodyazhny
June16,2016at12:52pm
HiTorsten!
IveopendiscussionInputparametersinHANA
DTPsfromCompositeProvider,VirtualProvideron
HANAViews.ErroroccurswhenItrytocheck
HANAExecutioninDTPparameters.
abilashn
June13,2016at3:32pm
ExcellentBlogTorsten..
withdetailexplanation,screenshots.Bookmarked
itascurrentlyImovedfromBWtoHANA.DefinitelyabigLikefrommy
end..(expectingwillbebacktobwonceHANAprojectiscompleted)
TorstenKessler Postauthor
July20,2016at12:34pm
ShortupdateAddedparagraph:
1.2.7Featurelistthatpreventsapushdown
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
25/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
JanEeckhaut
August25,2016at12:46pm
Hello,
Verygoodblog,thankyou!
Iseeinyourexamplethatyourefertotheactivetableifyouneedtoread
datafromanotherADSOinyourSQLscript.
TobeNLSsafe,wereadtheExternalSAPHANAview
(example:SELECT*FROMsystemlocal.bw.bw2hana::DADSO1).
WhatisyourideaaboutusingSQLscriptinBWandNLS?
Regards
TorstenKessler Postauthor
December12,2016at10:59am
Hi,
regardingyourNLSquestion,doyoumean
aNLSlocatedobjectassourceobjectofthetransformationor
doyouwanttoreaddatafromaNLSlocatedobjectinsidethe
SQLscript?
Torsten
JanEeckhaut
December15,2016at9:31am
HelloTorsten,
ImeantreadingdatafromaNLSlocatedobject
insidetheSQLscript.
Regards,
Jan
TorstenKessler Postauthor
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
26/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
December16,2016at1:52pm
Okay,Illcheckthisandcomebackto
you.
Becauseofyearsenditcouldtake
somedays.
Torsten
VasanthGutta
December12,2016at9:00am
NiceblogTorsten
IamwonderingifyoucanprovideussomesamplecodeforreadingainTab
intotemporarytableandanotherdsotablefromBWintoanothertemporary
tablewithlookupusingABAPtemporaryworkareastructureandupdating
usingloopfunctionstogetthefinalresult.
Sorryforaskinghelpinthiskindofcoding.Anyhelponsampletyposto
followinAMDPSQLscript?
suchashowweusedtowriteexpertABAProutinesasbelow.
LoopatSOURCE_PACKAGEintoworkarea_source_package.
readtable/BIC/Ablablabla
intoworkarea_looptable
withkeykey=workarea_source_package.
ifsysubrc=0.
wa_result_packagefield1=wokarea_sourcepackagefield1.
wa_result_packagefield2=worarea_looptablefield2.
wa_result_packagefield3=worarea_looptablefield4.
endif.
appendworkarea_result_packagetoRESULT_PACKAGE.
endloop.
TorstenKessler Postauthor
December12,2016at10:45am
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
27/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
Hi,
asIwroteabove:
However,therearedifferencesfromtheperspectiveof
implementationbetweenABAPandSQLScript.AnABAP
processedtransformationloopsoverthesourcedataand
processesthemrowbyrow.ASAPHANAExpertScriptbased
transformationtriestoprocessesthedatainoneblock(INSERT
ASSELECT).Togetthebestperformancebenefitofthepush
downitisrecommendedtousedeclarativeSQLScriptLogicto
implementyourbusinesslogicwithintheSAPHANAExpert
Script,seeblogGeneralrecommendations.
Thatmeansyouhavetoconsiderthatapushdown
transformationisprocessedinoneSQL(INSERTASSELECT)
statement.Thereforeageneralrecommendationistoavoid
statementslike:
LOOP,
IFTHEN,
WHILE,
likewearetypicalusinginABAP.
InaSQLScriptroutine(orAMDProutine)theparameterinTab
isthesameastheSOURCE_PACKAGEintheABAProutine.
IfyouwanttoselectsomedatafromtheinTabyoucancreatea
selectontheinTab:
tmpTable=SELECTCOLUMN_A,COLUMN_B,from:inTab
ToreaddatafromanactiveDSOtableyoucanalsocreatea
selectstatement:
tmpDSO=SELECTCOLUMN_X,COLUMN_Yfrom
/BIC/Ablablabla
NowyoucancreateaUNIONoraJOINbasedonbothtmp
table.ItisalsopossibletojoinoruniontheinTabdirectlywitha
databasetable.
Butkeepinmind,ifyoucreatetocomplexstatementsitis
sometimehardtoreadandunderstandthecodingifyousearch
foranerrororifyousearchingthereasonforerroneousdata.
Otherwise,compilingthewholelogicinonecomplexstatement
canincreasetheruntmie.
Sothegoalistofindawayinbetween,agoodruntimeand
codingthatcanbemaintained.
Torsten
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
28/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
VasanthGutta
December13,2016at12:19am
ThanksTorsten,
ThereasonIamaskingthetraditionalABAPwaybecausewehavelittlebit
differentsituation.Ihavetriedtodostraightselectstatementsbutitdoesnt
helptransformingthedata.Letmeexplainoursituationwithour
developments
Wehaveseveralhierarchiescomingfromseveralsources.Ihaveplannedto
loadthemusingBODSintoBWPSAandthentoaDSOwithoutany
transformations.FromthereweareagainloadingintoanotheraDSOfrom
flatteningithoweverthedataisnotasstraightasothertransformationfor
lookups.
Wehave5fieldsupto8levelsofhierarchy
1.Childhierarchycode
2.Levelno
3.Parenthierarchycode
4.Childhierarchycodeattribute1
5.Childhierarchycodeattribute2
MytargetaDSOislikebelow:
Lvl8CodeKey
Lvl8codeattr1
Lvl8codeattr2
Lvl7Code
Lvl7codeattr1
Lvl7codeattr2
Lvl6Code
Lvl6codeattr1
Lvl6codeattr2
Lvl5Code
Lvl5codeattr1
Lvl5codeattr2
Lvl4Code
Lvl4codeattr1
Lvl4codeattr2
Lvl3Code
Lvl3codeattr1
Lvl3codeattr2
Lvl2Code
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
29/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
Lvl2codeattr1
Lvl2codeattr2
Lvl1Code
Lvl1codeattr1
Lvl1codeattr2
NowIamtryingtotransformthedataandflattenitfrommakingthetailend
level8codebeingthekeyinaDSO.
Mylogicisasbelow:
source1=select*from:inTabwherelevel=8
source2=seelct*from:inTabwherelevel<>8
fromhereIamstuckhowtopreparetheresultdataflattenedwithoutloops.
SorryforaskingsuchadeepdivecauseIamstuckatthiswhereIhave
writtenmostoftheinABAPexpertroutinestomovetheproject.Anyhelp?
TorstenKessler Postauthor
December14,2016at9:04am
Hi,
youcanuseallSQLScriptfeature.Itisalsopossibletouse
loopsandconditions.
IdidntgetyourrequirementcompletebutIthinkitwouldbe
possibledogettherequestedresultwithastatementlike:
SELECTCASE(level=8)THEN
CASE(level=7)THEN
otherwiseyoucanimplementitinasamewayasinABAP.
Asexplainedintheblog,ifyouareusingdeclarative
programminglogicitwillbetranslatedintoL(LPop).
AndthisCAN(notmust)blogtheoptimizer!
Thegeneraldeclarationformthedevelopmentis:Itis
implausiblethataLPopisfasterthanapureSQLstatement!.
Torsten
VasanthGutta
December15,2016at3:00am
HiTorsten,
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
30/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
IhavefigureditoutandwrittentheAMDPscriptinSQLusingunionsand
joinsbutveryclumsy.IhavebeendoinglotofABAPandconvertingthatinto
HANAAMDPSQLscriptisnotthatstraightforwardbutmademethinkalot.
Ihavefinallywrittenandtestedthetransformationanddatasuccessfullybut
IcouldntfinddifferenceinperformancefromBWroutineworldtoHANA
AMDPworld.Ormaybeduetolessvolumeofdata.
Howeveritsmoreinterestingandchallengingtolearnnewcoding
techniques.IwentthroughHANAsqlguideandwrittentlinebylinefor3days
tofinishit.
Thisishowihavewritten:
definelvlint:=7
temp_source=selectfrom:inTabbyHLVLdesc,childasc
l_out=select
targetstructurewithNullsmostandrelevantfieldsforlevel8ofparentchild
hierarchywithattributesfromtemp_source
while:lvl=0DO
CASE(:lvl=7)
then
l_out=targetstructurewithNullsmostandrelevantfieldsforlevel7and8
ofparentchildhierarchywithattributesfroml_outasmaininnerjoin
temp_sourceaspart(main.parent=part.child)wheretemp_sourcelevel=
:lvl
CASE(:lvl=6)
then
l_out=targetstructurewithNullsmostandrelevantfieldsforlevel6,7and
8ofparentchildhierarchywithattributesfroml_outasmaininnerjoin
temp_sourceaspart(main.parent=part.child)wheretemp_sourcelevel=
:lvl
CASE(:lvl=5)
then
l_out=targetstructurewithNullsmostandrelevantfieldsforlevel5,6,7
and8ofparentchildhierarchywithattributesfroml_outasmaininnerjoin
temp_sourceaspart(main.parent=part.child)wheretemp_sourcelevel=
:lvl
CASE(:lvl=4)
then
l_out=targetstructurewithNullsmostandrelevantfieldsforlevel4,5,6,7
and8ofparentchildhierarchywithattributesfroml_outasmaininnerjoin
temp_sourceaspart(main.parent=part.child)wheretemp_sourcelevel=
:lvl
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
31/32
1/26/2017
HANAbasedBWTransformation|SAPBlogs
CASE(:lvl=3)
then
l_out=targetstructurewithNullsmostandrelevantfieldsforlevel3,4,5,
6,7and8ofparentchildhierarchywithattributesfroml_outasmaininner
jointemp_sourceaspart(main.parent=part.child)wheretemp_source
level=:lvl
CASE(:lvl=2)
then
l_out=targetstructurewithNullsmostandrelevantfieldsforlevel2,3,4,
5,6,7and8ofparentchildhierarchywithattributesfroml_outasmain
innerjointemp_sourceaspart(main.parent=part.child)where
temp_sourcelevel=:lvl
CASE(:lvl=1)
then
l_out=targetstructurewithNullsmostandrelevantfieldsforlevel1,2,3,
4,5,6,7and8ofparentchildhierarchywithattributesfroml_outasmain
innerjointemp_sourceaspart(main.parent=part.child)where
temp_sourcelevel=:lvl
endcase
lvl:=:lvl1
endwhile
outTab=selectfroml_outstructure
erorTab=selecterrorstuff
Privacy
TermsofUse
https://blogs.sap.com/2016/05/24/hanabasedbwtransformation/
LegalDisclosure
Copyright
Trademark
Sitemap
Newsletter
32/32