首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >SAP URL编码ODATA过滤器(API_PRODUCT_SRV)

SAP URL编码ODATA过滤器(API_PRODUCT_SRV)
EN

Stack Overflow用户
提问于 2020-08-11 11:57:18
回答 1查看 181关注 0票数 2

使用SDK (@ SAP - Cloud -sdk/核心版本1.26.1,@sap/cloud-sdk service版本1.19.0),ODATA过滤器不会在URL查询部分编码百分比。

示例:(假设存在描述为"ä_description“的产品)

以下示例不检索此产品说明:

代码语言:javascript
代码运行次数:0
运行
复制
const term = 'ä_description';
const destination = getDestinationInformation(); //get destination information from somewhere
const results = await ProductDescription.requestBuilder()
   .getAll()
   .filter(ProductDescription.PRODUCT_DESCRIPTION.equals(term))
   .execute(destination);

此片段生成以下请求URL:

代码语言:javascript
代码运行次数:0
运行
复制
"https://<host>/sap/opu/odata/sap/API_PRODUCT_SRV/A_ProductDescription?$format=json&$filter=(ProductDescription eq 'ä_description')"

当对搜索项(const term = encodeURIComponent('ä_description');)执行百分比编码时,将生成以下请求URL:

代码语言:javascript
代码运行次数:0
运行
复制
"https://<host>/sap/opu/odata/sap/API_PRODUCT_SRV/A_ProductDescription?$format=json&$filter=(ProductDescription eq '%C3%A4_description')"

这将返回预期的结果。

我没有检查,但这也可能影响到其他VDM包。

SDK本身还是SDK用户应该执行URL编码?我想避免双重编码。

提前谢谢你,

乌杰

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-08-24 08:21:35

1.27.0版本已于上周发布。SDK处理此版本的url编码。请试试看。参见发行说明这里

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63357636

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档