Skip to Content

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

Jan 24, 2017 at 07:28 PM


avatar image
Former Member

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)) 
result := REPLACE(LTRIM(REPLACE(:im_Var1, '0', ' ')), ' ', '0');

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Florian Pfeffer
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.


Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Florian

As always appreciate for your time & help on this.

I was able to add scalar function into repository and now i can add same in semantic node but looks like it is not working in Analysis for office as mentioned by you, hopefully SAP will add this feature in future.

I have one more silly question just for my knowledge - I did above step in Dev system and when I tried to do in Quality I was not able to(as shown in screenshot)..Is this object can only be transported or something I missed in Quality.(I am doing lot of HANA modeling in Quality for some reason)

Thank you once again.

3.png (12.7 kB)

Not knowing your setup and not understanding the "some reasons" why modeling on QA is necessary :-), I would assume that you do not have the required package privileges (e.g. REPO.EDIT_NATIVE_OBJECTS, REPO.ACTIVATE_NATIVE_OBJECTS, REPO.MAINTAIN_NATIVE_PACKAGES in case of native objects/packages and/or REPO.EDIT_IMPORTED_OBJECTS, REPO.ACTIVATE_IMPORTED_OBJECTS, REPO.MAINTAIN_IMPORTED_PACKAGES in case of imported objects/packages).

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 :)