Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Date 带日期的SAPUI5函数导入_Date_Odata_Sapui5_Sap Gateway - Fatal编程技术网

Date 带日期的SAPUI5函数导入

Date 带日期的SAPUI5函数导入,date,odata,sapui5,sap-gateway,Date,Odata,Sapui5,Sap Gateway,我有以下问题。 我有一个函数导入,其中有两个日期字段。 下面是我如何调用函数import的: this.getView().getModel("odata").callFunction("/SavePos", { method: "GET", urlParameters: oProperty, success: function(oData, response) { jQue

我有以下问题。 我有一个函数导入,其中有两个日期字段。

下面是我如何调用函数import的:

        this.getView().getModel("odata").callFunction("/SavePos", {
            method: "GET",
            urlParameters: oProperty,
            success: function(oData, response) {
                jQuery.sap.delayedCall(500, this, function() {
                    this.getView().byId("idI_HuCount").focus();
                }); 
                sap.m.MessageToast.show(this.getView().getModel("i18n").getResourceBundle().getText("DATA_SAVED"));
                this.setBusy(false);
            }.bind(this), // callback function for success
            error: function(oError) {
                sap.m.MessageToast.show(this.getErrorMessageFromOdataError(oError));
                this.setBusy(false);
            }.bind(this)
        });
如果我输入日期,一切正常。 但在一些情况下,我不必输入任何日期。 如果我没有输入任何日期,我会在网关中收到以下错误消息: 无效的函数导入参数

如果将date属性添加为emtpy(opProperty.ProdDate=“”;),则会收到以下错误消息: 变形的URI文本语法

你知道我如何用空的日期字段调用函数import吗

编辑: 如果我将日期字段设置为“”,则请求的外观如下:

如果我不设置任何值,就像这样:

GET SavePos?sap-client=200&Docno='00000000000000000000000410000003293'&Itemno='0000000020'&HuTopTyp='E1'&QuanTopHu=2m&Productid=guid'005056bc-ebf7-1eda-81aa-812468f4d0ee'&QuanProHu=5m&HuSubTyp='%20'&QuanSubHu=0m&Sample=''

AFAIK函数导入不支持可选参数。因此,您必须始终提供一个值。也许你可以添加一个默认日期(01-01-1970)或创建第二个只包含一个(或没有)日期参数的FunctionImport?将null作为默认值传递并检查。@santosh:我已经尝试了undefined和null,但两者都不起作用。谢谢Marc,我将其用作解决方法,但我认为必须有更好的选择。我在一篇博客文章中找到了这个答案。似乎列
NULLABLE
对于FunctionImports只是隐藏的,但可以使其可见:AFAIK FunctionImports不支持可选参数。因此,您必须始终提供一个值。也许你可以添加一个默认日期(01-01-1970)或创建第二个只包含一个(或没有)日期参数的FunctionImport?将null作为默认值传递并检查。@santosh:我已经尝试了undefined和null,但两者都不起作用。谢谢Marc,我将其用作解决方法,但我认为必须有更好的选择。我在一篇博客文章中找到了这个答案。对于FunctionImports,列
NULLABLE
似乎只是隐藏的,但可以使其可见:
GET SavePos?sap-client=200&Docno='00000000000000000000000410000003293'&Itemno='0000000020'&HuTopTyp='E1'&QuanTopHu=2m&Productid=guid'005056bc-ebf7-1eda-81aa-812468f4d0ee'&QuanProHu=5m&HuSubTyp='%20'&QuanSubHu=0m&Sample=''