1

I have the following problem. I have an Function import where I have two date fields. SEGW Function import

here is how i call the function 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)
        });

If i enter the dates, everything works fine. But in a few cases i don't have to input any date. If i don't enter any date i get the following error message in gateway: Invalid function import parameter OData Error message

If i add the date Property as emtpy (oProperty.ProdDate = "";) then i get this error message: Deformed URI literal syntax OData error message

Do you have an idea how i can call the function import with empty date fields?

EDIT: Here is how the request looks like if i set the date field to "":

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=''&ProdDate=&BestBeforeDate= 

And like this if i don't set any values:

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=''
Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
Gander
  • 11
  • 1
  • 5
  • pass null as default value and check. – santhosh Dec 10 '19 at 02:29
  • @santosh: i already tried undefined and null and both did not work. – Gander Dec 10 '19 at 06:22
  • Thanks Marc i used this as a workaround but i thougth there have to be a better option. – Gander Dec 10 '19 at 06:24
  • 1
    I found this answer in a blog post. Seems like the column `NULLABLE` is simply hidden for FunctionImports but can be made visible: https://blogs.sap.com/2017/12/14/implementing-optional-parameters-in-the-function-import/#comment-480658 – Marc Dec 10 '19 at 15:16
  • thanks marc. I found the same and postet the answer but i gets deletet by Admin? – Gander Dec 11 '19 at 08:07

0 Answers0