SAP HANA Eclipse语法错误。 ";" 不正确或放错位置。 SERIES_GENERATE_DATE

2020-09-12 08:20发布

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

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


我的代码:-

PROCEDURE" AFS_BASE"。" AFS_BASE.KPI.DASHBOARD :: PR_REV_CTRL_BOX_ORDER_BY_STAGE_V1"

在TT_INPUT" OPS_SCHEMA"。" AM.OPS.CORE.TABLETYPES :: GTT_INPUT",

OUT TT_DASHBOARD" OPS_SCHEMA"。" AM.OPS.CORE.TABLETYPES :: GTT_GENERIC_DASHBOARD"

语言SQLSCRIPT

SQL安全调用程序

默认模式AFS_BASE

AS

LV_TAB NVARCHAR(50);

lv_measure nvarchar(50);

lv_report_date日期;

LV_UID NVARCHAR(255);

LV_SUB_HEADING NVARCHAR(255);

LV_START_DATEDATE:='2010-01-01';

LV_END_DATEDATE:='2031-01-01';

LV_WEEKEND NVARCHAR(10):='星期五';

/**************************************

由Junaid在2017年5月13日创建

****************************************/

开始

DECLARE REPORT_WEEK_INIT整数:= ABS(WEEKDAY(LV_START_DATE)-4);

从:TT_INPUT WHERE VARIABLE ='UID'中选择LV_UID值;

从:TT_INPUT WHERE VARIABLE ='TAB'中选择值到LV_TAB中;

SELECT IFNULL(NULLIF(VALUE,''),: LV_START_DATE)从LV_START_DATE到:TT_INPUT,其中VARIABLE ='START_DATE';

选择IFNULL(NULLIF(VALUE,''),: LV_END_DATE)到LV_END_DATEFROM:TT_INPUT其中VARIABLE ='END_DATE';

开始

SQL_ERROR_CODE 1299的DECARE退出处理程序

LV_SUB_HEADING:='';

选择LV_SUB_HEADINGFROM中的值:TT_INPUT WHERE VARIABLE ='SUB_HEADING';

END;

TT_HDR =选择不同的序列号

FROM" AFS_BASE"。" AFS_BASE.TRENDS.TABLES :: OPV_KPI_MEASURES"

在:LV_START_DATE和:LV_END_DATE之间的MEASURE_DATE;

TT_ZOOM =选择" ATTRIBUTE"作为ZOOM_TYPE,

Z.ATTRIBUTE AS ZOOM_ATTRIBUTE,

Z.ATTRIBUTE_VALUE AS ZOOM_ATTRIBUTE_VALUE

FROM" BASE_SCHEMA"。" AM.BASE.TABLES :: DB_TAB_ZOOM_VALUES"

Z.TAB_NAME =:LV_TAB

AND Z.SCENARIO_NUMBER = SESSION_CONTEXT('$ vssod_scenario')

AND Z.SESSION_ID = SESSION_CONTEXT('$ vssod_sid')

AND Z.USER_NAME = SESSION_USER

和Z.ATTRIBUTE IN(从" BASE_SCHEMA"中选择属性。" AM.BASE.TABLES :: DB_CONFIG_ATTRIBUE"

客户所在位置= SESSION_CONTEXT('客户')和显示='Y')

全部联盟

选择" TAG"作为ZOOM_TYPE,

Z.ATTRIBUTE AS ZOOM_ATTRIBUTE,

Z.ATTRIBUTE_VALUE AS ZOOM_ATTRIBUTE_VALUE

从" BASE_SCHEMA"开始。" AM.BASE.TABLES :: DB_TAB_ZOOM_VALUES"

WHERE TAB_NAME =:LV_TAB

AND Z.SCENARIO_NUMBER = SESSION_CONTEXT('$ vssod_scenario')

ANDZ.SESSION_ID = SESSION_CONTEXT('$ vssod_sid')

AND Z.USER_NAME = SESSION_USER

和Z.ATTRIBUTE IN(从" BASE_SCHEMA"中选择TAG_NAME。" AM.BASE.TABLES :: DB_CONFIG_TAGS"

客户所在位置= SESSION_CONTEXT('CLIENT')AND DISPLAY ='Y');

呼叫" AFS_BASE"。" AFS_BASE.TRENDS.CORE/PR_KPI_FILTER_WITH_ZOOM"(:TT_INPUT,:T​​T_ZOOM,:TT_HDR,TT_FSN);

TT_SERIES =

(选择

GENERATED_PERIOD_START(截至REPORT_DATE)

案例,当周(GENERATED_PERIOD_START)> 4 THEN

ADD_DAYS(GENERATED_PERIOD_START,WEEKDAY(GENERATED_PERIOD_START)+

在星期几(GENERATED_PERIOD_START)= 5 THEN 1 ELSE -1 END的情况下

ELSE

ADD_DAYS(GENERATED_PERIOD_START,4-WEEKDAY(GENERATED_PERIOD_START))

按周END_END

从SERIES_GENERATE_DATE("间隔1天",:LV_START_DATE,COALESCE(:LV_END_DATE,CURRENT_DATE)));

插入bhavya.DB_WEEK_SERIES2(REPORT_DATE,REPORT_WEEK,WEEK_END)

选择REPORT_DATE,WEEK(WEEK_END),WEEK_END

从:TT_SERIES;

从虚拟对象中选择SUBSTR_AFTER(:lv_uid,':')成lv_measure;

从dummy中选择SUBSTR_BEFORE(:lv_uid,':')成lv_report_date;

如果:LV_UID ='ALL'THEN

TT_INVOICED =选择0作为序列号,将Week_end作为REPORT_DATE,将SUM(MEASURE_AMOUNT)作为INV_AMT

FROM" AFS_BASE"。" AFS_BASE.TRENDS.TABLES :: OPV_KPI_MEASURES" K

内部联接:TT_SERIES TS

在TS.REPORT_DATE = K.MEASURE_DATE

MEASURE ="已开具发票"

和k.serial_number输入(从:TT_FSN中选择不同的序列号)

GROUP BYweek_end;

TT_INVOICE =选择REPORT_DATE,"开具发票"作为度量,SUM(INV_AMT)作为AMT

从:TT_INVOICEDI

按报告日期分组;

TT_REMAINING =选择0作为SERIAL_NUMBER,ts.week_end作为REPORT_DATE,MEASURE,SUM(MEASURE_AMOUNT)作为AMT

FROM" AFS_BASE"。" AFS_BASE.TRENDS.TABLES :: OPV_KPI_MEASURES" K

INNER JOIN:TT_week_end TS

在TS.WEEK_END在K.VALID_FROM_DATE和K.VALID_TO_DATE之间

其中k.MEASURE IN("选择中","生产中","运输中","后期","未涵盖","在手","直接开船")

和k.serial_number输入(从:TT_FSN中选择不同的序列号)

按TS.week_end进行分组,测量;

TT_DATA =选择报告日期,度量,SUM(AMT)作为TOT_AMT,1个来自:TT_INVOICE的排序

按REPORT_DATE进行测量的组

全部联盟

选择REPORT_DATE,度量,SUM(AMT)作为TOT_AMT,2作为来自:TT_REMAINING的排序

在REPORT_DATE之前进行分组,度量;

ELSEIF:lv_measure ='已开具发票'然后

TT_DRILLDOWN =选择K.serial_number,week_end作为REPORT_DATE,k.measure,SUM(MEASURE_AMOUNT)作为AMT

FROM" AFS_BASE"。" AFS_BASE.TRENDS.TABLES :: OPV_KPI_MEASURES" K

INNERJOIN:TT_SERIES TS

在TS.REPORT_DATE = K.MEASURE_DATE

和ts.week_end =:lv_report_date

MEASURE ="已开具发票"

和k.serial_numberin(从:TT_FSN中选择不同的序列号)

GROUPBYweek_end,k.measure,K.serial_number;

ELSEIF:lv_measure <>"已开具发票"然后

TT_DRILLDOWN = SELECTk.SERIAL_NUMBER,:lv_report_dateasREPORT_DATE,MEASURE,SUM(MEASURE_AMOUNT)ASAMT

FROM" AFS_BASE"。" AFS_BASE.TRENDS.TABLES :: OPV_KPI_MEASURES" K

wherek.MEASURE =:lv_measure

和:lv_report_dateBETWEENK.VALID_FROM_DATEANDK.VALID_TO_DATE

andk.serial_numberin(来自:TT_FSN的selectdistinctserial_number)

GROUPBYMEASURE,K.serial_number;

ENDIF;

/* TT_WEEKLY = SELECT REPORT_DATE,COALESCE(ADD_DAYS(LAG(REPORT_DATE,1)OVER(ORDER BY REPORT_DATE),1),:LV_START_DATE)AS PREV_REPORT_DATE

FROM(从:TT_SERIES WHERE DAYNAME(REPORT_DATE)='FRIDAY'中选择REPORT_DATE); */

如果:LV_UID ='ALL'THEN

TT_DASHBOARD = SELECTREPORT_DATEAS" NAME",

NULLAS" HEADING",

" GRAPH"为" SUB_HEADING",

MEASUREAS" SUB_CAT1",

NULLAS" SUB_CAT2",

SORTAS" SORT1",

NULLAS" SORT2",

ROUND(TOT_AMT/1000000,2)AS" VALUE",

NULLAS" SERIAL_NUMBER",

NULLAS" UNIT",

TO_CHAR(REPORT_DATE)|| ':'|| measureAS" UID",

NULLASFREQUENCY,

'DRILL_DOWN'AS" HYPER_LINK",

'$ POST = M $; $ Y = M $中的值" AS" AI,

NULLAS" TYPE",

NULLASSIZE

从:TT_DATA

ORDERBYREPORT_DATE;

ELSE

TT_DASHBOARD = SELECTNULLAS" NAME",

NULLAS" HEADING",

NULLAS" SUB_HEADING",

NULLAS" SUB_CAT1",

NULLAS" SUB_CAT2",

NULLAS" SORT1",

NULLAS" SORT2",

NULLAS" VALUE",

SERIAL_NUMBERAS" SERIAL_NUMBER",

NULLAS" UNIT",

NULLAS" UID",

NULLASFREQUENCY,

NULLAS" HYPER_LINK",

NULLAS" AI",

NULLAS" TYPE",

NULLASSIZE

从:TT_DRILLDOWNORDERBYAMTDESC

LIMIT 10000;

ENDIF;

END;

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

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


我的代码:-

PROCEDURE" AFS_BASE"。" AFS_BASE.KPI.DASHBOARD :: PR_REV_CTRL_BOX_ORDER_BY_STAGE_V1"

在TT_INPUT" OPS_SCHEMA"。" AM.OPS.CORE.TABLETYPES :: GTT_INPUT",

OUT TT_DASHBOARD" OPS_SCHEMA"。" AM.OPS.CORE.TABLETYPES :: GTT_GENERIC_DASHBOARD"

语言SQLSCRIPT

SQL安全调用程序

默认模式AFS_BASE

AS

LV_TAB NVARCHAR(50);

lv_measure nvarchar(50);

lv_report_date日期;

LV_UID NVARCHAR(255);

LV_SUB_HEADING NVARCHAR(255);

LV_START_DATEDATE:='2010-01-01';

LV_END_DATEDATE:='2031-01-01';

LV_WEEKEND NVARCHAR(10):='星期五';

/**************************************

由Junaid在2017年5月13日创建

****************************************/

开始

DECLARE REPORT_WEEK_INIT整数:= ABS(WEEKDAY(LV_START_DATE)-4);

从:TT_INPUT WHERE VARIABLE ='UID'中选择LV_UID值;

从:TT_INPUT WHERE VARIABLE ='TAB'中选择值到LV_TAB中;

SELECT IFNULL(NULLIF(VALUE,''),: LV_START_DATE)从LV_START_DATE到:TT_INPUT,其中VARIABLE ='START_DATE';

选择IFNULL(NULLIF(VALUE,''),: LV_END_DATE)到LV_END_DATEFROM:TT_INPUT其中VARIABLE ='END_DATE';

开始

SQL_ERROR_CODE 1299的DECARE退出处理程序

LV_SUB_HEADING:='';

选择LV_SUB_HEADINGFROM中的值:TT_INPUT WHERE VARIABLE ='SUB_HEADING';

END;

TT_HDR =选择不同的序列号

FROM" AFS_BASE"。" AFS_BASE.TRENDS.TABLES :: OPV_KPI_MEASURES"

在:LV_START_DATE和:LV_END_DATE之间的MEASURE_DATE;

TT_ZOOM =选择" ATTRIBUTE"作为ZOOM_TYPE,

Z.ATTRIBUTE AS ZOOM_ATTRIBUTE,

Z.ATTRIBUTE_VALUE AS ZOOM_ATTRIBUTE_VALUE

FROM" BASE_SCHEMA"。" AM.BASE.TABLES :: DB_TAB_ZOOM_VALUES"

Z.TAB_NAME =:LV_TAB

AND Z.SCENARIO_NUMBER = SESSION_CONTEXT('$ vssod_scenario')

AND Z.SESSION_ID = SESSION_CONTEXT('$ vssod_sid')

AND Z.USER_NAME = SESSION_USER

和Z.ATTRIBUTE IN(从" BASE_SCHEMA"中选择属性。" AM.BASE.TABLES :: DB_CONFIG_ATTRIBUE"

客户所在位置= SESSION_CONTEXT('客户')和显示='Y')

全部联盟

选择" TAG"作为ZOOM_TYPE,

Z.ATTRIBUTE AS ZOOM_ATTRIBUTE,

Z.ATTRIBUTE_VALUE AS ZOOM_ATTRIBUTE_VALUE

从" BASE_SCHEMA"开始。" AM.BASE.TABLES :: DB_TAB_ZOOM_VALUES"

WHERE TAB_NAME =:LV_TAB

AND Z.SCENARIO_NUMBER = SESSION_CONTEXT('$ vssod_scenario')

ANDZ.SESSION_ID = SESSION_CONTEXT('$ vssod_sid')

AND Z.USER_NAME = SESSION_USER

和Z.ATTRIBUTE IN(从" BASE_SCHEMA"中选择TAG_NAME。" AM.BASE.TABLES :: DB_CONFIG_TAGS"

客户所在位置= SESSION_CONTEXT('CLIENT')AND DISPLAY ='Y');

呼叫" AFS_BASE"。" AFS_BASE.TRENDS.CORE/PR_KPI_FILTER_WITH_ZOOM"(:TT_INPUT,:T​​T_ZOOM,:TT_HDR,TT_FSN);

TT_SERIES =

(选择

GENERATED_PERIOD_START(截至REPORT_DATE)

案例,当周(GENERATED_PERIOD_START)> 4 THEN

ADD_DAYS(GENERATED_PERIOD_START,WEEKDAY(GENERATED_PERIOD_START)+

在星期几(GENERATED_PERIOD_START)= 5 THEN 1 ELSE -1 END的情况下

ELSE

ADD_DAYS(GENERATED_PERIOD_START,4-WEEKDAY(GENERATED_PERIOD_START))

按周END_END

从SERIES_GENERATE_DATE("间隔1天",:LV_START_DATE,COALESCE(:LV_END_DATE,CURRENT_DATE)));

插入bhavya.DB_WEEK_SERIES2(REPORT_DATE,REPORT_WEEK,WEEK_END)

选择REPORT_DATE,WEEK(WEEK_END),WEEK_END

从:TT_SERIES;

从虚拟对象中选择SUBSTR_AFTER(:lv_uid,':')成lv_measure;

从dummy中选择SUBSTR_BEFORE(:lv_uid,':')成lv_report_date;

如果:LV_UID ='ALL'THEN

TT_INVOICED =选择0作为序列号,将Week_end作为REPORT_DATE,将SUM(MEASURE_AMOUNT)作为INV_AMT

FROM" AFS_BASE"。" AFS_BASE.TRENDS.TABLES :: OPV_KPI_MEASURES" K

内部联接:TT_SERIES TS

在TS.REPORT_DATE = K.MEASURE_DATE

MEASURE ="已开具发票"

和k.serial_number输入(从:TT_FSN中选择不同的序列号)

GROUP BYweek_end;

TT_INVOICE =选择REPORT_DATE,"开具发票"作为度量,SUM(INV_AMT)作为AMT

从:TT_INVOICEDI

按报告日期分组;

TT_REMAINING =选择0作为SERIAL_NUMBER,ts.week_end作为REPORT_DATE,MEASURE,SUM(MEASURE_AMOUNT)作为AMT

FROM" AFS_BASE"。" AFS_BASE.TRENDS.TABLES :: OPV_KPI_MEASURES" K

INNER JOIN:TT_week_end TS

在TS.WEEK_END在K.VALID_FROM_DATE和K.VALID_TO_DATE之间

其中k.MEASURE IN("选择中","生产中","运输中","后期","未涵盖","在手","直接开船")

和k.serial_number输入(从:TT_FSN中选择不同的序列号)

按TS.week_end进行分组,测量;

TT_DATA =选择报告日期,度量,SUM(AMT)作为TOT_AMT,1个来自:TT_INVOICE的排序

按REPORT_DATE进行测量的组

全部联盟

选择REPORT_DATE,度量,SUM(AMT)作为TOT_AMT,2作为来自:TT_REMAINING的排序

在REPORT_DATE之前进行分组,度量;

ELSEIF:lv_measure ='已开具发票'然后

TT_DRILLDOWN =选择K.serial_number,week_end作为REPORT_DATE,k.measure,SUM(MEASURE_AMOUNT)作为AMT

FROM" AFS_BASE"。" AFS_BASE.TRENDS.TABLES :: OPV_KPI_MEASURES" K

INNERJOIN:TT_SERIES TS

在TS.REPORT_DATE = K.MEASURE_DATE

和ts.week_end =:lv_report_date

MEASURE ="已开具发票"

和k.serial_numberin(从:TT_FSN中选择不同的序列号)

GROUPBYweek_end,k.measure,K.serial_number;

ELSEIF:lv_measure <>"已开具发票"然后

TT_DRILLDOWN = SELECTk.SERIAL_NUMBER,:lv_report_dateasREPORT_DATE,MEASURE,SUM(MEASURE_AMOUNT)ASAMT

FROM" AFS_BASE"。" AFS_BASE.TRENDS.TABLES :: OPV_KPI_MEASURES" K

wherek.MEASURE =:lv_measure

和:lv_report_dateBETWEENK.VALID_FROM_DATEANDK.VALID_TO_DATE

andk.serial_numberin(来自:TT_FSN的selectdistinctserial_number)

GROUPBYMEASURE,K.serial_number;

ENDIF;

/* TT_WEEKLY = SELECT REPORT_DATE,COALESCE(ADD_DAYS(LAG(REPORT_DATE,1)OVER(ORDER BY REPORT_DATE),1),:LV_START_DATE)AS PREV_REPORT_DATE

FROM(从:TT_SERIES WHERE DAYNAME(REPORT_DATE)='FRIDAY'中选择REPORT_DATE); */

如果:LV_UID ='ALL'THEN

TT_DASHBOARD = SELECTREPORT_DATEAS" NAME",

NULLAS" HEADING",

" GRAPH"为" SUB_HEADING",

MEASUREAS" SUB_CAT1",

NULLAS" SUB_CAT2",

SORTAS" SORT1",

NULLAS" SORT2",

ROUND(TOT_AMT/1000000,2)AS" VALUE",

NULLAS" SERIAL_NUMBER",

NULLAS" UNIT",

TO_CHAR(REPORT_DATE)|| ':'|| measureAS" UID",

NULLASFREQUENCY,

'DRILL_DOWN'AS" HYPER_LINK",

'$ POST = M $; $ Y = M $中的值" AS" AI,

NULLAS" TYPE",

NULLASSIZE

从:TT_DATA

ORDERBYREPORT_DATE;

ELSE

TT_DASHBOARD = SELECTNULLAS" NAME",

NULLAS" HEADING",

NULLAS" SUB_HEADING",

NULLAS" SUB_CAT1",

NULLAS" SUB_CAT2",

NULLAS" SORT1",

NULLAS" SORT2",

NULLAS" VALUE",

SERIAL_NUMBERAS" SERIAL_NUMBER",

NULLAS" UNIT",

NULLAS" UID",

NULLASFREQUENCY,

NULLAS" HYPER_LINK",

NULLAS" AI",

NULLAS" TYPE",

NULLASSIZE

从:TT_DRILLDOWNORDERBYAMTDESC

LIMIT 10000;

ENDIF;

END;

付费偷看设置
发送
1条回答
路亽曱_Ryan
1楼-- · 2020-09-12 08:54

嗨,我可以知道您能够解决此问题吗? 我遇到了同样的问题。感谢您的快速回复。

此致

Pradeep

一周热门 更多>

点击此处---> EasySAP.com 一起学习S4 HANA ...

相关问答