Skip to Content
0

SAP HANA Calculation view Conversion Function Doesn't work in Semantics

Sep 28, 2017 at 06:09 PM

379

avatar image

Hi All,

I wrote the scalar function to trim leading zeros using the process mentioned in SAP HANA Modeling Guide (https://help.sap.com/http.svc/rc/fb8f7a9f7860468b84a07eab0a7d0a98/2.0.02/en-US/SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en.pdf) Page 148.

I used this in the semantics layer of a calculation view in the conversion functions column. Defined it as an Internal to external conversion but it doesn't seem to work.

Can you please help me understand why this doesn't work?

Thanks,

Shyam

FUNCTION "<packagepath>::LeadingZeroTrim" (POLineNumber NVARCHAR(100)) 
	RETURNS TrimmedValue NVARCHAR(100)
	LANGUAGE SQLSCRIPT
	SQL SECURITY DEFINER AS
BEGIN
/***************************** 
	Write your function logic
 *****************************/
 
 select ltrim(:POLineNumber,'0') into TrimmedValue from dummy;
 
 
END;
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Florian Pfeffer
Sep 29, 2017 at 05:02 AM
0

Have you read the following two notes in the chapter?

1) This feature is currently not supported by SAP analytic client tools. You can convert attribute values through external or customer applications that read column meta data from the BIMC_DIMENSION_VIEW.

2) These functions are not applied in the database layer. It is used for providing hints to analytic clients on how to convert values before displaying them in the client user interface (UI).


So if your conversion function will be applied is depending if the client supports that, as the function is not executed on DB layer. If you have tested your calc. view e.g. in HANA Studio the conversion will not be applied, because HANA Studio does not support that. Also (as the first note says) other SAP analytic client tools will not support that too.

Maybe it is an option for you - if you do not have a client which supports the conversion - to add an additional calculation view on top of your existing calculation view as a kind of consumption view. The additional calculation view can provide the required data format via calculated columns.

Regards,
Florian

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Florian,

Thanks for the reply. I did read those notes but was hoping that there would be a way to directly apply these functions on the columns. Just like we did conversions in BW info objects. Would have been a cool feature.

I have a requirement where we need to remove leading zeroes from fields like Material numbers, Purchase order lines, cost centers, GL accounts. Could have been a life saver to have just that function applied at the semantics.

Shyam

0