In whatever schema you specify on the front of the function name. For example in the following SAP_HANA_EPM_NEXT is the schema where the function will be created:
FUNCTION "SAP_HANA_EPM_NEXT"."sap.hana.democontent.epmNext.functions::apply_discount" (
im_price decimal(15,2),
im_discount decimal(15,2))
RETURNS result decimal(15,2)
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER AS
BEGIN
/*****************************
Write your function logic
*****************************/
result := :im_price - ( :im_price * :im_discount );
END;
Please note that the new hdbscalarfunction is a new feature in SP7. If you are seeing this I assume you are an SAP employee and already have access to SP7.