You don't have any variables in your code.
You can check the CREATE FUNCTION syntax in here http://msdn.microsoft.com/es-es/library/ms186755%28v=sql.90%29.aspx
CREATE FUNCTION dbo.Example_function_name
(
@Parameter1 int
)
RETURNS TABLE
AS
RETURN
SELECT bb.level , 'Myvalue5' as'Table'
From BaseTable bb
Left Join dbo.a on (bb.col1 = a.col1)
UNION
SELECT bb.level , 'Myvalue4' as'Table'
From BaseTable bb
Left Join dbo.a on (bb.col1 = a.col1) ;