Professional Documents
Culture Documents
Table Functions in SAP HANA
Table Functions in SAP HANA
This inspired me to write the article about Table Functions and share my experience on that topic.
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 1/13
12/22/2020 Table Functions in SAP HANA – step by step guide - SAPSPOT
Table functions are used whenever the graphical views are not sufficient i.e. for loops, executing
custom functions or complex queries.
SQL Script gives much more functionality and flexibility (more functions available, complex logic
can be implemented in easier way, SQL can be combined with Application Function Library –
AFL giving even more functions for complex analysis)
Cons:
Maintenance is much more difficult (preserving order and data types of output columns; data
preview for part of code is not so straightforward comparing to previewing nodes in graphical
views; when changing output – both Table Function and view on top of it needs to be adjusted;
etc.)
Multiple-value input parameters are not supported (there is no easy way of passing multiple
values into single input parameter to Table Function, however there is workaround for that)
By definition graphical views provide better performance thanks to HANA’s optimizer
No GUI available – SQL Script knowledge is necessary
Generally Table Functions should are used in case if the logic cannot be covered by graphical view or
the logic is too complex to model it graphically.
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 2/13
12/22/2020 Table Functions in SAP HANA – step by step guide - SAPSPOT
Go to Repositories tab:
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 3/13
12/22/2020 Table Functions in SAP HANA – step by step guide - SAPSPOT
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 4/13
12/22/2020 Table Functions in SAP HANA – step by step guide - SAPSPOT
I. [Optional] Provide input parameters including data types. This is needed when you want to
parametrize Table Function.
III. [Optional] Provide default schema for the query. This is needed when you transport the function
between instances with different schemas i.e. in development system you are using “DEV” schema,
but on production all tables are placed in “PROD” schema. If you provide the default schema in the
definition of Table Function, then while transporting this schema will be automatically replaced with the
schema of target system (based on schema mapping). When applying default value for schema
mapping, in the query you should use table names without schemas i.e simply use “ORDERS” instead
of “DEV“.”ORDERS“.
IV. [Mandatory] Add RETURN phrase before the final select statement.
VI. [Optional] Apply input parameters in the WHERE clause. Add leading colons (“:”) when calling
each parameter.
VIII. [Mandatory] List all the output columns. Preserve the columns order, column names (case
sensitive) and their data types consistent with the select statement
After writing Table Function definition activate it and make sure that there is no error after activation.
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 5/13
12/22/2020 Table Functions in SAP HANA – step by step guide - SAPSPOT
Be aware that any of Data Definition (CREATE, ALTER, etc.) or Data Manipulation (INSERT, UPDATE
etc.) operators are not allowed in Table Functions.
If Table Function is using input parameters you need to recreate them also in the view. Go to
Parameters/Variables tab, click on Input Parameter Manage Mapping and select Data sources.
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 6/13
12/22/2020 Table Functions in SAP HANA – step by step guide - SAPSPOT
Click Auto Map By Name button to automatically copy input parameters from the Table Functions to
the view.
Now when previewing data on the view, there will be pop up with input parameters. Once values are
inputted they will be passed directly to the table function and results will be displayed.
There is a workaround for that limitation, which can help to fulfill requirement of passing multiple
values directly to the query.
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 7/13
12/22/2020 Table Functions in SAP HANA – step by step guide - SAPSPOT
(http://www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/).
Leave a Reply
Your email address will not be published. Required fields are marked *
Comment
Name *
Email *
Website
Post Comment
Search
Search...
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 8/13
12/22/2020 Table Functions in SAP HANA – step by step guide - SAPSPOT
(http://bit.ly/erpprep)
Ads
POPULAR RECENT
Seamless Big Data tiering with HANA, Hadoop and Vora…with a little help from DLM – Part 1
-vorawit (http://www.sapspot.com/seamless-big-data-tiering-hana-hadoop-vorawith-little-help-dlm-part-
hadoop
hana-
tiering-
data-
big-
less-
m/seam
spot.co
ww.sap
(http://w
part-1/)
dlm-
help-
h-little-
1/)
Jun 24, 2016
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 9/13
12/22/2020 Table Functions in SAP HANA – step by step guide - SAPSPOT
Jul 2, 2018
4hana/)
s-
in-sap-
setup-
partner-
ess-
m/busin
spot.co
ww.sap
(http://w
Employee Central – SAP ERP HCM prepackaged Integration: how to change the standard field
mapping (http://www.sapspot.com/employee-central-sap-erp-hcm-prepackaged-integration-
-standar change-standard-field-mapping/)
change
on-
integrati
aged-
prepack
hcm-
erp-
sap-
central-
oyee-
m/empl
spot.co
ww.sap
(http://w
g/)
mappin
d-field-
Jan 22, 2018
Archives
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 10/13
12/22/2020 Table Functions in SAP HANA – step by step guide - SAPSPOT
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 11/13
12/22/2020 Table Functions in SAP HANA – step by step guide - SAPSPOT
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 12/13
12/22/2020 Table Functions in SAP HANA – step by step guide - SAPSPOT
Copyright © 2018 SAPSPOT | Powered by Wordpress Theme by Colorlib (http://colorlib.com/wp/) Powered by WordPress
(http://wordpress.org/)
www.sapspot.com/table-functions-in-sap-hana-step-by-step-guide/ 13/13