SAP WEB计算视图-动态输入参数/变量

2020-09-10 23:59发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)嗨 我正在SAP HANA 2...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


我正在SAP HANA 2.0 Web IDE rev(35)中的日期维计算视图上工作,我创建了一个包含表中所有日期的视图。 现在,我需要创建一些动态日期,包括年初至今,本周和MTD。 我的想法是创建一个表函数,该表函数为我提供一个日期行(当前日期),并使用来自不同列的值来过滤主表格,因此我只能看到想要的日期。

例如

表函数包含以下列

YEAR_ID年

12.03.2019 2019

输入变量

VAR_DAY = 12.03.2019

VAR_Year = 2019

计算尺寸(YTD)

选择*

来自DIM_DATES

其中VAR_DAY

当我尝试使用user_input或变量时,系统提示Im在Web IDE中输入值。 如何强制基于input_variable或参数的过滤器?

最好的问候

Petter Huseby

6条回答
路亽曱_Ryan
2020-09-11 00:32

这是包含我所有列的完整的Table函数:

FUNCTION" test_db.db :: DATE_YTD"()返回表(" DAY_ID" DATE," UNIX_TIME" NVARCHAR(10)," DAY_CAPTION" NVARCHAR(10)," DAY_OF_CAL_YEAR" NVARCHAR(3)," DAY_OF_CAL_WEEK" NVARCHAR (1)," DAY_OF_WEEK" NVARCHAR(1)," DAY_NAME_ENG" NVARCHAR(9)," DAY_NAME_SHORT_ENG" NVARCHAR(3)," DAY_NAME_NOR" NVARCHAR(7)," DAY_NAME_SHORT_NO" NVARCHAR(3)," DAY_FIRST_DAY_WEEK" DATE DAY_LAST_DAY_WEEK" DATE," DAY_JULIAN_DATE" NVARCHAR(7)," WORKDAY_NOR" NVARCHAR(1)," WORKDAY_ENG" NVARCHAR(1)," WORKDAY_FREE_1" NVARCHAR(1)," WORKDAY_FREE_2" NVARCHAR(1)," DAY_TYPE_NOR" )," DAY_COMPARABLE_LASTYEAR"日期," WEEK_ID" NVARCHAR(6)," WEEK_CAPTION" NVARCHAR(8)," WEEK_NUM_ISO" NVARCHAR(3)," WEEK_NUM" NVARCHAR(2)," MONTH_ID" NVARCHAR(6)," MONTH_CAPTION" NVARCHAR(9)," DAY_OF_CAL_MONTH" NVARCHAR(2)," MONT_OF_YEAR" INTEGER," MONTH_OF_QUARTER" NVARCHAR(1)," CALENDAR_MONTH_NAME" NVARCHAR(9)," MONTH_NAME_SHORT_NO" NVARCHAR(4)," MONTH_DAYS_IN" " MONTH_START_DATE" DATE," MONTH_END_DATE" DATE," QUARTER_ID" NVARCHAR(5)," QUARTER_CAPTION" NVARCHAR(7)," DAY_OF_CAL_QUARTER" NVARCHAR(2)," QUARTER_NUM" NVARCHAR(1)," QUARTER_START_DATE" DATE," QUARTER_END_DATE" DATE," QUARTER_DESCRIPTIONS" TVARTER(14) NVARCHAR(2)," QUARTER_TIME_SPAN" NVARCHAR(2)," YEAR_ID" NVARCHAR(4)," YEAR_CAPTION" NVARCHAR(4)," YEAR_START_DATE" DATE," YEAR_END_DATE" DATE," YEAR_TIME_SPAN" NVARCHAR(10))语言SQLSCRIPT 以安全方式调用,返回" DAY_ID"," UNIX_TIME"," DAY_CAPTION"," DAY_OF_CAL_YEAR"," DAY_OF_CAL_WEEK"," DAY_OF_WEEK"," DAY_NAME_ENG"," DAY_NAME_SHORT_ENG"," DAY_NAME_NOR"," DAY_NAME" " DAY_LAST_DAY_WEEK"," DAY_JULIAN_DATE"," WORKDAY_NOR"," WORKDAY_ENG"," WORKDAY_FREE_1"," WORKDAY_FREE_2"," DAY_TYPE_NOR"," DAY_COMPARABLE_LASTYEAR"," WEEK_ID"," WEEK_CAPTION"," WEEK_NUMTION"," "," MONTH_CAPTION"," DAY_OF_CAL_MONTH"," MONT_OF_YEAR"," MONTH_OF_QUARTER"," CALENDAR_MONTH_NAME"," MONTH_NAME_SHORT_NO"," MONTH_DAYS_IN_MONTH", " MONTH_START_DATE"," MONTH_END_DATE"," QUARTER_ID"," QUARTER_CAPTION"," DAY_OF_CAL_QUARTER"," QUARTER_NUM"," QUARTER_START_DATE"," QUARTER_END_DATE"," QUARTER_DESCRIPTION"," QUARTER_S"," QUARTER_S" "," YEAR_START_DATE"," YEAR_END_DATE"," YEAR_TIME_SPAN"来自" test_db.db :: test.Entity_LOAD_DATE" WHERE DAY_ID <= current_date AND YEAR_ID = TO_NVARCHAR(CURRENT_DATE,'YYYY'); END;

一周热门 更多>