Table Function where to use exactly An actual scenario.
Hello Friends here comes my second technical article on Table Function etc. As you know all for Analytics SAP HANA now latest is HANA 2.0 XSA is must. Trust me SAP HANA is a powerful and by far the best in memory Database in the IT world. It is not good to call it as only DB and I always say it is an appliance. With modern big data world SAP HANA is equally can handle Big Data, Graph Data and Many more.
With evolution of SAP HANA 2.0 XSA we can also create applications on XSODATA which is kind of ODATA service URL to build a full stack applications on SAP UI5/Fiori and server side programming using NODE JS for business logics etc.
Modelling is by far the best in HANA with powerful graphical features and Calculation view of type Dimension and Cube with different nodes makes it even more intuitive.
Analytics is now again divided into operational or strategic. Operational being real time reporting and Strategic being near real time. Based on business need, cost etc many customers implement different solutions on Analytics.
Anyways much of a story. Table function when is the real need in HANA modelling. Here I am going to talk about a real world scenario where actually I used a TF and fed to a CV.
ECC or S/4 HANA tables are being replicated to HANA on a real time basis using SAP SLT.
Say Table PLKO Task Header Table which has fields PLNTY,PLNNR,PLNAL
The PLNTY+PLNNR_PLNAL = OBJEK of INOB table. There is a requirement to join these bunch of tables and create a CV for these.
INOB table has values of OBJEK say AZWATE 01 or TWAT 02 etc. When we do concat of PLNTY+PLNNR_PLNAL we may get values as AZWATE01 which is not going to work when we join with OBJEK of INOB table. OBJEK has length 50 in SAP ECC table and for PLNTY type A T E we have values length as 11. When there is operation need to be done record by record then we must use table function for sure.
Please see the code snipped.
Get the PLNNR_NEW and feed that to your calculation view. in your calculation view CONCAT this value with PLNTY and PLNAL so that the length is 11 and spaces are also maintained.
The joining condition will work perfectly to get desired result. Usage of Table functions are important in HANA Classic and 2.0 as well.
This is the base of modelling in HANA CVs where we need to Select operations from multiple tables or CVs where normal Graphical CV cannot do that.
Also we can use the query factoring concept such as WITH Clause to Improved response time see the code snippet below. These are called CDS type table functions etc. I will post these once I develop them in SAP HANA 2.0
Thanks,
Narasingha