cancel
Showing results for 
Search instead for 
Did you mean: 

UI5 and OData using RFC

Former Member
0 Kudos

Hello,

Scenario:

I am a newbie to SAPUI5 and I am creating a simple report using SAPUI5 in which I am using ODATA which consumes an RFC which has some input parameters which I'll be giving from the front-end itself and getting the output based on the RFC itself. So for that to achieve, I have created 2 views and 2 controllers.

VIEW1:  I have created a form which is taking 6 input parameters. One is drop-down list, one is text box and remaining are date, time (from,two).  and a search button.

CONTROLLER 1: After hitting search button, I am retrieving my inputs using  sap.ui.getCore().getElementById('myid').getValue(); within the search function and then forwarding my app to view 2 using  app.to("idview2");

CONTROLLER 2: Here, I have created a model using ODATA web service

VIEW2: In my view 2, I just have a table (11 columns) which will be having different outputs based on the inputs and I want to show the data using.

             var oTable = sap.ui.table.Table("tableid",{

             visibleRowCount: 100,

            editable: false

            });

           oTable.addColumn(new sap.ui.table.Column({

            label: new sap.ui.commons.Label({text:"User Name"}),

            visible: true,

           template: new sap.ui.commons.TextView({text:"{}"})

            }));

and binding at the end like oTable.bindRows("CHNG>/changeSet");

Questions: 


  • How the ODATA Model should look like, right now it is having 2 entities (i/p,o/p) by importing the RFC
  • How to pass the parameters which i am getting in the controller 1 to my model and where to pass those. Or do I have to create a new model after passing those input parameters.
  • Syntax to get the output? is it the same which I have written in view 2.

I am really stuck and could't find anything.

Accepted Solutions (1)

Accepted Solutions (1)

kedarT
Active Contributor
0 Kudos

Hi Saumil,

Here is a pointer for Function Import to create oData -

To pass parameters from view 1 to view 2 you can use routing more info here - SAPUI5 SDK - Demo Kit

Binding on the table looks good.

Hope this helps.

Former Member
0 Kudos

Kedar,

            Thank you so much for the reply. Could you please help me with the syntax of passing inputs             to the service?

Regards,

Saumil Sharma

kedarT
Active Contributor
0 Kudos

Hi Saumil,

You can use filters to pass data in your odata service calls. Here is more info - SAPUI5 SDK - Demo Kit

Example - SAPUI5 SDK - Demo Kit

Hope this helps.

Answers (0)