Skip to Content
avatar image
Former Member

SAP HANA Conversion functions(in Semantic node) - Remove Leading zero

Hi Experts

I am trying to use scalar function which i created to remove leading zero and wanted to use it in conversion function under semantic node but I can not find this function when i search it.

CREATE FUNCTION "AKHATTI".Remove_Leading_Zero (im_Var1 NVARCHAR(20)) 
	RETURNS result NVARCHAR(20)
	LANGUAGE SQLSCRIPT
	SQL SECURITY INVOKER AS
BEGIN
result := REPLACE(LTRIM(REPLACE(:im_Var1, '0', ' ')), ' ', '0');
END;

The function is working perfect when tested with Select query.

Also I read in another post that this can be achived by adding function in repository but not sure how to add this function to repository, need your help here.

Thank you.

1.png (20.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 25, 2017 at 08:40 AM

    You can follow the steps in tutorial Create a Scalar User-Defined Function to create a scalar function, which can be used as conversion function in a calc. view. Different from the tutorial you can create the function also without using a XS Project in the Eclipse based tooling. As you are using XS Classic, it is possible to add the function directly in the Eclipses based tooling via the Repositories view in the SAP HANA Development perspective or via the HANA web-based development workbench editor.

    Please consider the restriction, mentioned in the documentation, which describes that conversion functions are not supported by SAP analytic client tools at the moment. E.g. SAP BusinessObjects Lumira or even the data preview in the modeling environment will not consider the conversion functions.

    Regards,
    Florian

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Florian Pfeffer

      Hi Florian

      Due to cost we have only 2 bobj server(Qua,Prod) and sap S4hana have 3 server(Dev,Qua,Prod) :)

      I tried assigning those package privilege but was not successful, I will play around in security and figure it out..

      Thank you for help :)