将输入参数传递给ODATA v4实体(强调计算视图)

2020-08-27 09:16发布

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

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


尊敬的专家,

我对如何将输入参数传递到ODATA v4中的计算视图有疑问。

有一个计算视图,其中包含两个输入参数(IP_FROM_DATE和IP_TO_DATE)。 计算视图的列如下-

DEVICE_ID,DTMSTMP,ID,SRNO

我创建了一个具有如下视图元数据的实体-

@ cds.persistence.exists

实体CV_ONOFFDEVICE_REPORT {

键DEVICE_ID:字符串(100);

键DTMSTMP:时间戳;

ID:字符串(50);

SRNO:字符串(100);

}

我已经在cat_service.cds中创建了如下服务

代码-

服务offline_device_report {

实体CV_OFFLINEDEVICE_REPORT_SRV @(

title:'{ONOFF DEVICE REPORT}',

说明:" {OFFLINE DEVICE REPORT}",

功能:{InsertRestrictions:{Insertable:False},UpdateRestrictions:{Updatable:False},DeleteRestrictions:{Deletable:False}})

作为CV_ONOFFDEVICE_REPORT上的投影;

当我尝试将输入参数(IP_FROM_DATE和IP_TO_DATE)传递到URL中以查看数据时

https://asz728nvte502vufex-njs-alerts-srv.cfapps.eu10.hana.ondemand.com/offline_device_report /CV_OFFLINEDEVICE_REPORT_SRV('IP_FROM_DATE'='2019-07-23T00:00:00.000Z','IP_TO_DATE'='2019-07-23T00:00:00.000Z')

出现以下错误-

在'CV_OFFLINEDEVICE_REPORT_SRV('IP_FROM_DATE'='2019-07-23T00:00:00.000Z','IP_TO_DATE'='2019-07-23T00:00:00.000Z'中找不到预期的uri令牌'ODataIdentifier' )"在位置29

日志信息-

 GET/offline_device_report/CV_OFFLINEDEVICE_REPORT_SRV('IP_FROM_DATE'%20=%20'2019-07-23T00:00:00.000Z',%20'IP_TO_DATE'%20=%20'2019-07-23T00:00:00.000  Z')
 #2.0#2019 08 02 06:44:23:211#+ 00:00#ERROR#/AppController/Dispatcher ################ PLAIN ## ['Error:WebSocket is 未打开:在WebSocket.send(/home/vcap/app/appcontroller.7705909036560120120/AppController/node_modules/ws/lib/websocket.js:314:19)中的readyState 3(CLOSED)\\ n在Object.sendEvent中 (/home/vcap/app/appcontroller.7705909036560120399/AppController/node_modules/applicationcontroller/controller/appStatusWebsocketServer.js:151:19)\\n在EventEmitter.eventEmitter.onAppControllerEvent(/home/vcap/app/app/appcontroller.7705909036560120399/AppController /node_modules/applicationcontroller/server.js:37:18)\\n在emitOne(events.js:121:20)\\ n在EventEmitter.emit(events.js:211:7)\\ n在EventEmitter.eventEmitter  .sendAppControllerEvent(/home/vcap/app/appcontroller.7705909036560120399/AppController/node_modules/applicationcontroller/utils/internalEventCreator.js:7:7)\\n在LogReader._transform(/home/vcap/app/app/appcontroller.7705909036560120399/AppController/node_modules/ap  plicationcontroller/utils/appLogReader.js:52:31)\\ n在LogReader.Transform._read(_stream_transform.js:186:10)\\ n在LogReader.Transform._write(_stream_transform.js:174:12)\\  n在doWrite(_stream_writable.js:396:12)\\ n在writeOrBuffer(_stream_writable.js:382:5)\\ n在LogReader.Writable.write(_stream_writable.js:290:11)\\ n在套接字。  ondata(_stream_read.js:639:20)\\ n在emitOne(events.js:116:13)\\ n在Socket.emit(events.js:211:7)\\ n在addChunk(_stream_visible.js:  263:12)']#
 [2019-08-02T06:44:23.210Z | 警告|  1280452]:在'CV_OFFLINEDEVICE_REPORT_SRV('IP_FROM_DATE'='2019-07-23T00:00:00.000Z','IP_TO_DATE'='2019-07-23T00:00:00.000Z'中找不到预期的uri令牌'ODataIdentifier'  )'在位置29
 asz728nvte502vufex-njs-alerts-srv.cfapps.eu10.hana.ondemand.com-[2019-08-02T06:44:23.203 + 0000]" GET/offline_device_report/CV_OFFLINEDEVICE_REPORT_SRV('IP_FROM_DATE'%20 =%20'2019-07  -23T00:00:00.000Z',%20'IP_TO_DATE'%20 =%20'2019-07-23T00:00:00.000Z')HTTP/1.1" 400 0 393"-"" Mozilla/5.0(Windows NT 10.0  ; Win64; x64)AppleWebKit/537.36(KHTML,例如Gecko)Chrome/75.0.3770.142 Safari/537.36""-"" 10.0.139.23:61035" x_forwarded_for:"-" x_forwarded_proto:" https" vcap_request_id:" d473384c-5b16-  4a26-4fc3-6c9cfd9dcec8" response_time:0.010153265 app_id:" 7aa6886e-fdee-462b-a593-a502e0b80650" app_index:" 0" x_correlationid:"-" tenantid:"-" x_b3_traceid:"​​ bf230d55fd6313"  -" b3:" bf230d55fd631ce4-bf230d55fd631ce4" 

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

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


尊敬的专家,

我对如何将输入参数传递到ODATA v4中的计算视图有疑问。

有一个计算视图,其中包含两个输入参数(IP_FROM_DATE和IP_TO_DATE)。 计算视图的列如下-

DEVICE_ID,DTMSTMP,ID,SRNO

我创建了一个具有如下视图元数据的实体-

@ cds.persistence.exists

实体CV_ONOFFDEVICE_REPORT {

键DEVICE_ID:字符串(100);

键DTMSTMP:时间戳;

ID:字符串(50);

SRNO:字符串(100);

}

我已经在cat_service.cds中创建了如下服务

代码-

服务offline_device_report {

实体CV_OFFLINEDEVICE_REPORT_SRV @(

title:'{ONOFF DEVICE REPORT}',

说明:" {OFFLINE DEVICE REPORT}",

功能:{InsertRestrictions:{Insertable:False},UpdateRestrictions:{Updatable:False},DeleteRestrictions:{Deletable:False}})

作为CV_ONOFFDEVICE_REPORT上的投影;

当我尝试将输入参数(IP_FROM_DATE和IP_TO_DATE)传递到URL中以查看数据时

https://asz728nvte502vufex-njs-alerts-srv.cfapps.eu10.hana.ondemand.com/offline_device_report /CV_OFFLINEDEVICE_REPORT_SRV('IP_FROM_DATE'='2019-07-23T00:00:00.000Z','IP_TO_DATE'='2019-07-23T00:00:00.000Z')

出现以下错误-

在'CV_OFFLINEDEVICE_REPORT_SRV('IP_FROM_DATE'='2019-07-23T00:00:00.000Z','IP_TO_DATE'='2019-07-23T00:00:00.000Z'中找不到预期的uri令牌'ODataIdentifier' )"在位置29

日志信息-

 GET/offline_device_report/CV_OFFLINEDEVICE_REPORT_SRV('IP_FROM_DATE'%20=%20'2019-07-23T00:00:00.000Z',%20'IP_TO_DATE'%20=%20'2019-07-23T00:00:00.000  Z')
 #2.0#2019 08 02 06:44:23:211#+ 00:00#ERROR#/AppController/Dispatcher ################ PLAIN ## ['Error:WebSocket is 未打开:在WebSocket.send(/home/vcap/app/appcontroller.7705909036560120120/AppController/node_modules/ws/lib/websocket.js:314:19)中的readyState 3(CLOSED)\\ n在Object.sendEvent中 (/home/vcap/app/appcontroller.7705909036560120399/AppController/node_modules/applicationcontroller/controller/appStatusWebsocketServer.js:151:19)\\n在EventEmitter.eventEmitter.onAppControllerEvent(/home/vcap/app/app/appcontroller.7705909036560120399/AppController /node_modules/applicationcontroller/server.js:37:18)\\n在emitOne(events.js:121:20)\\ n在EventEmitter.emit(events.js:211:7)\\ n在EventEmitter.eventEmitter  .sendAppControllerEvent(/home/vcap/app/appcontroller.7705909036560120399/AppController/node_modules/applicationcontroller/utils/internalEventCreator.js:7:7)\\n在LogReader._transform(/home/vcap/app/app/appcontroller.7705909036560120399/AppController/node_modules/ap  plicationcontroller/utils/appLogReader.js:52:31)\\ n在LogReader.Transform._read(_stream_transform.js:186:10)\\ n在LogReader.Transform._write(_stream_transform.js:174:12)\\  n在doWrite(_stream_writable.js:396:12)\\ n在writeOrBuffer(_stream_writable.js:382:5)\\ n在LogReader.Writable.write(_stream_writable.js:290:11)\\ n在套接字。  ondata(_stream_read.js:639:20)\\ n在emitOne(events.js:116:13)\\ n在Socket.emit(events.js:211:7)\\ n在addChunk(_stream_visible.js:  263:12)']#
 [2019-08-02T06:44:23.210Z | 警告|  1280452]:在'CV_OFFLINEDEVICE_REPORT_SRV('IP_FROM_DATE'='2019-07-23T00:00:00.000Z','IP_TO_DATE'='2019-07-23T00:00:00.000Z'中找不到预期的uri令牌'ODataIdentifier'  )'在位置29
 asz728nvte502vufex-njs-alerts-srv.cfapps.eu10.hana.ondemand.com-[2019-08-02T06:44:23.203 + 0000]" GET/offline_device_report/CV_OFFLINEDEVICE_REPORT_SRV('IP_FROM_DATE'%20 =%20'2019-07  -23T00:00:00.000Z',%20'IP_TO_DATE'%20 =%20'2019-07-23T00:00:00.000Z')HTTP/1.1" 400 0 393"-"" Mozilla/5.0(Windows NT 10.0  ; Win64; x64)AppleWebKit/537.36(KHTML,例如Gecko)Chrome/75.0.3770.142 Safari/537.36""-"" 10.0.139.23:61035" x_forwarded_for:"-" x_forwarded_proto:" https" vcap_request_id:" d473384c-5b16-  4a26-4fc3-6c9cfd9dcec8" response_time:0.010153265 app_id:" 7aa6886e-fdee-462b-a593-a502e0b80650" app_index:" 0" x_correlationid:"-" tenantid:"-" x_b3_traceid:"​​ bf230d55fd6313"  -" b3:" bf230d55fd631ce4-bf230d55fd631ce4" 
付费偷看设置
发送
3条回答
一只江湖小虾
1楼-- · 2020-08-27 09:53

是的。 请检查
https://cap.cloud.sap/docs/advanced/hana/#views-with-parameters

和URL
/catalog/service(IP_NO ='1')/Set

wang628962
2楼-- · 2020-08-27 09:31

您是否找到了解决方案?

Haoba3210
3楼-- · 2020-08-27 09:35

您找到解决方案了吗?

一周热门 更多>