cancel
Showing results for 
Search instead for 
Did you mean: 

cannot read property DSV of Null. During calling Create on POST

Former Member
0 Kudos

http://scn.sap.com/thread/3823581

Getting error as cannot read property DSV of Null.

We are getting this error on calling create during POST. we have created a discussion in Fiori too.

Can some one help in resplving the issue.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hello,

how do you solved it?

I have the same issue.

BR

Marcel

AshwinDutt
Active Contributor
0 Kudos

Hello Rupesh,

This particular property is made as null-able in the GW Model ? If yes you need to send ' null ' as the input value when this property field is empty while firing the create request. Check this please.

What is the payload ? can u share it for which its giving this error ?

Regards,

Ashwin

Former Member
0 Kudos

Hi Ashwin,

Further info i want to add is if run my ODATA service from the /n/iwfnd/maint_service, it runs fine with POST.

Here is the payload that i use in /n/iwfnd/maint_service.


Content-Typeapplication/atom+xml;type=entry; charset=utf-8
X-CSRF-TokenDc8hPwgSI0lwUeXGA6k9RA==

    


<entry xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="http://****************/sap/opu/odata/sap/Z_FIORI_CREATE_EQUIPMENT_SRV/">
<id>http://********/sap/opu/odata/sap/Z_FIORI_CREATE_EQUIPMENT_SRV/Z_EquipmentCreateSet(Equipment='10000...>
<title type=
"text">Z_EquipmentCreateSet</title>
<updated>2015-11-10T10:14:53Z</updated>
<author>
<name/>
</author>
<link href=
"Z_EquipmentCreateSet" rel="self" title="Z_EquipmentCreateSet"/>

<content type=
"application/xml">
<m:properties xmlns:m=
"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<d:Manfacture>SAP</d:Manfacture>
<d:Descript>ODATA TEST</d:Descript>
<d:Maintplant>0001</d:Maintplant>
<d:Funcloc>ABCD-TER-RR-12</d:Funcloc>
<d:Equicatgry>M</d:Equicatgry>
<d:ExternalNumber>10000004</d:ExternalNumber>
<d:Objecttype/>
<d:Manmodel>asded-
1234 -344</d:Manmodel>
</m:properties>
</content>
</entry>

But problem is when we call it from our Fiori app, we get the above issue ,i will soon give you the Payload from the APP too in sometime.

former_member1129777
Participant
0 Kudos

In the below code oEntry is the payload from app frontend.

var oEntry = {};

     oEntry.Manfacture = this.getView().byId("Manufacturer");

    oEntry.Descript = this.getView().byId("Description");

    oEntry.Maintplant = this.getView().byId("MaintenancePlant");

    oEntry.Funcloc = this.getView().byId("FunctionalLocation");

    oEntry.Equicatgry = this.getView().byId("EquipCatid");

  oEntry.ExternalNumber = this.getView().byId("Equipment");

  oEntry.Objecttype = this.getView().byId("TechObjectType");

   oEntry.Manmodel = this.getView().byId("ModelNumber");

   var url = "/sap/opu/odata/sap/Z_FIORI_CREATE_EQUIPMENT_SRV";

    var oMod = new sap.ui.model.odata.ODataModel(url,true);

   this.getView().setModel(oMod);

    OData.request({

      requestUri : "/sap/opu/odata/sap/Z_FIORI_CREATE_EQUIPMENT_SRV/Z_EquipmentCreateSet",

      method : "GET",

      headers : {

        "X-Requested-With" : "XMLHTTPRequest",

        "Content-Type" : "application/atom+xml",

        "DataServiceVersion" : "2.0",

        "X-CSRF-Token" : "Fetch"

          }

       },

    function(data,response){

        var header_xcsrf_token = response.headers['x-csrf-token'];

        var oHeaders = {

        "X-Requested-With" : "XMLHTTPRequest",

        "Content-Type" : "application/atom+xml",

          "x-csrf-token" :  header_xcsrf_token,

          "Accept" : "application/xml; charset=utf-8"

        };

        OData.request({

          requestUri : "/sap/opu/odata/sap/Z_FIORI_CREATE_EQUIPMENT_SRV/Z_EquipmentCreateSet",

          method : "POST",

          headers : oHeaders,

          data : oEntry

       },

        function(data,request)

        {

          sap.m.MessageBox.show("Equipment created" + request);

          location.reload(true);

        },

        function(err){

          sap.m.MessageBox.show("Equipment creation Failed" + err );

        });

    },

   function(err)

        {

          var  request = err.request;

          var response = err.response;

          sap.m.MessageBox.show("Error in request "+ request +" Response " + response);

        });

},