Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

OData $links write support for navigation properties

$
0
0

Hello community,

 

I'm facing a trouble regarding the update of an entity. I have two entities: User and UserGroup (a Many-to-Many relationship, both entities PK are an Edm.Int32), what I want to do is add an User to a specific UserGroup. I don't know what is the best practice for doing that but I've read some articles and it seems I should use the navigation property UserGroups/Users (I think that's the right way, since from there is where I will query in a future), so I made myself an example with Apache Olingo and requested something like this:

 

ContentType is JSON

requestUri: "UserGroups(1)/$links/Users",

method: "PUT",

oData : {

     "uri" : "Users(1)"

}

 

That request successfully added the user to the user group collection (with Olingo), but now when I try to do the same thing with NW Gateway it throws the following error:

 

<?xml version="1.0" encoding="utf-8"?>

<error xmlns:xsi="http://www.w3.org/2001/XMLSchema-Instance">

  <code>HTTP/500/E/Internal Server Error</code>

  <message> Call of service /sap/opu/odata/sap/ZGW_COMMON_SRV/InternetUserGroups(&#39;000000000018&#39;)/$links/InternetUsers terminated because of an error. The following error text was processed in system DER : Specified value is not a valid value for the type of an XML document                                                                                                                                                                                           The error occurred on the application server LAB01SECC. The termination type was: RABAX_STATE.If the termination type is RABAX_STATE, you will find more information on the cause of termination in system DER in transaction ST22. If the termination type is ABORT_MESSAGE_STATE, you will find more information on the cause of termination on the application server LAB01SECC in transaction SM21. If the termination type is ERROR_MESSAGE_STATE, you can search for further information in the trace file for the work process in transaction ST11 on the application server LAB01SECC. You may also need to analyze the trace files of other work processes. If you do not yet have a user ID, contact your system adminmistrator. </message>

</error>

 

I am requesting it like this (from SAPUI5):

ODataModel(bJSON = true).update(

     "UserGroups(1)/$links/Users",

     {

          "uri" : "Users(2)"

     },

     null,

     function(o1, o2, o3) {

     },

     function(o1, o2, o3) {

           });

 

I wish you could help me out with this.

 

Danke


Viewing all articles
Browse latest Browse all 2823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>