SAP Service Layer Odata筛选器-检查起始日期和起始日期之间的日期

2020-09-13 16:12发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)大家好, 如何通过服务层中...

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

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


大家好,

如何通过服务层中的Odata过滤器在Date和To_Date之间过滤日期?

SomeTable 中选择*,其中 Col1 Col2之间的 EnteredDate

谢谢

Rahul Jain

3条回答
CPLASF-自律
2020-09-13 17:03 .采纳回答

你好拉胡尔,

为什么您从价值而不是财产开始? 尝试将其转换为

 $ filter = EnteredDate lt Col1和EnteredDate gt Col2 

收件人

 $ filter = Col1 gt EnteredDate和Col2 lt EnteredDate 

例如:

我通过请求查询发票(SBODEMOGB模式)

 https://地址:50000/b1s/v1/Invoices?$ select = CardCode,DocNum,DocDate,DocDueDate 

并获得以下信息:

 {
     " odata.metadata":" https://192.168.200.50:50000/b1s/v1/$metadata#Invoices",
     "值":[
         {
             " DocNum":1
             " DocDate":" 2006-01-22",
             " DocDueDate":" 2006-02-21",
             " CardCode":" C20000"
         },
         {
             " DocNum":2
             " DocDate":" 2006-01-27",
             " DocDueDate":" 2006-02-26",
             " CardCode":" C30000"
         },
         {
             " DocNum":3,
             " DocDate":" 2006-02-11",
             " DocDueDate":" 2006-04-11",
             " CardCode":" C40000"
         },
         ....
         {
             " DocNum":20,
             " DocDate":" 2006-06-11",
             " DocDueDate":" 2006-08-11",
             " CardCode":" C23900"
         }
     ],
     " odata.nextLink":"/img/b1s/v1/发票?$ select = CardCode,DocNum,DocDate,DocDueDate&$ skip = 20"
 } 

现在,如果我以您的方式应用过滤器:

 https://地址:50000/b1s/v1/Invoices?$ select = CardCode,DocNum,DocDate,DocDueDate&$ filter ='20060130'gt DocDate和'20060130'lt DocDueDate 

我得到一个空的答复:

 {
     " odata.metadata":" https://192.168.200.50:50000/b1s/v1/$metadata#Invoices",
     "值":[]
 }
 

但是如果我将其反转并首先设置属性:

 https://地址:50000/b1s/v1/Invoices?$ select = CardCode,DocNum,DocDate,DocDueDate&$ filter = DocDate lt'20060130'和DocDueDate gt'20060130'

我有两张发票:

 {
     " odata.metadata":" https://192.168.200.50:50000/b1s/v1/$metadata#Invoices",
     "值":[
         {
             " DocNum":1
             " DocDate":" 2006-01-22",
             " DocDueDate":" 2006-02-21",
             " CardCode":" C20000"
         },
         {
             " DocNum":2
             " DocDate":" 2006-01-27",
             " DocDueDate":" 2006-02-26",
             " CardCode":" C30000"
         }
     ]
 }
 

希望这是它对您不起作用的原因

一周热门 更多>

相关问答