Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8372

annotations and oData model

$
0
0

Dear colleagues, please share your knowledge with me.

 

I have oData conent stored under this link:

/sap/opu/odata/sap/ZVAT2015_SRV/SFSet

These are like 'headers' of documents.

 

Fot them we have 'body' with many details under following link:

/sap/opu/odata/sap/ZVAT2015_SRV/SFSet(GENKEY=2,NUM_LINE='000000004')/MORE

 

 

What am I doing to it?

I have a page with 2 Views attached: Table with headers and Table with positions.

Table 1 and 2 are displayed over: .... oTable.bindRows("/SFSet");....  (same content so far, but some fields are missing in Table 2 as I need content from 'body')

 

My idea is following: I click on lines in the Table1 (headers) and Table2(body) content is changed depending on what line I've clicked (Table 1).

 

The controller for View1 (Table1) is following:

onInit: function() {
// URL of the OData service
var sServiceUrl = "/sap/opu/odata/sap/ZVAT2015_SRV/"; // initial for ODATA
// create OData model instance with service URL and JSON format
var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true, "user", "password"); // initial entry
//var oModel1 = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/ZVAT2015_SRV/"); //play entry, but working
//sap.ui.getCore().setModel(oModel1, 'details');
},


Now I'm trying to build controller for View2 (table2).

As far as I understand, I have to use annotations.

How can I use them?

How can I fetch data from the desired link? ( /sap/opu/odata/sap/ZVAT2015_SRV/SFSet(GENKEY=2,NUM_LINE='000000004')/MORE)

 

Currently I have:

onInit: function() {

     

// I will pass GENKEY and NUM_LINE later to this function. it is hard code now    

     var gen = "GENKEY=2";

     var gen = "NUM_LINE=2";

 

  var sServiceUrl = "/sap/opu/odata/sap/ZVAT2015_SRV/";

  var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, false, null, null, null,null,null,sURI);

 

  sap.ui.getCore().setModel(oModel);

},

 

but it is not working.

Please advise,

Thank you

Alex


Viewing all articles
Browse latest Browse all 8372

Trending Articles