on 06-09-2014 5:51 AM
Hi experts,
I have developed a new Odata service from a BAPI . and it has two values as input parameters. I was able to perform a filter operation and check the values in the browser XML with the generated odata service in service builder . Please let me know how the input values can be passed in the UI5 layer ro the odata service and check the output.
Hi David
You can basically bind the data model to the front end UI elements. You will have to take care of the structure which you are binding. What exactly do you want to achieve?
Nabheet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is how my odata service URL
http://GatewayHostname/sap/opu/odata/sap/ZSALESORDER_SRV/SalesOrderset/?$filter=DocNumber eq '0000004973'
Please let me know how to bind the Data model to front end UI elements , to develop a UI5 application from odata service ?
Hi David
I am assuming you have created your UI elements and you want to make an Odata call.
Please check this below mentioned code. ID/DESC are my two UI Elements which have some value on UI. I am reading it and then whatever the data in this case items it is passing back via ODATA call i have binded that to front end UI element which is table POHDR.
var sServiceUrl = "http://DEF.ad.ABC.com:8001/sap/opu/odata/sap/ZTMP_ABV"; |
var oModel = new sap.ui.model.odata.ODataModel( sServiceUrl , true, "<User name>", "<Pass word>"); | ||
sap.ui.getCore().setModel(oModel); | ||
var oFilter = new Array(); | ||
var ID = sap.ui.getCore().getElementById('ID').getValue(); | ||
var Desc = sap.ui.getCore().getElementById('Desc').getValue(); | ||
oFilter[0] = new sap.ui.model.Filter("ID", sap.ui.model.FilterOperator.EQ,"HELP" ); |
//oFilter[1] = new sap.ui.model.Filter("DESC", sap.ui.model.FilterOperator.EQ, ""); |
sap.ui.getCore().getElementById('POhdr).bindRows({
path: '/<entity set to bound>/',
filters: oFilter
Nabvheet
Thanks Nabheet, for detail reply.
I have created an UI5 project as in screenshot with Ui5 plgin in eclipse. PLease let me know how to create the Odata Ui elements in the project . I came across the SAPUI5 SDK - Demo Kit guide , but very confused how and where to add ui input for the Po number and display the details as a result.
Hi David
Even i have started working on UI5 around 1.5 months back and its fun. I would recommend you to go through this wonderful document and complete all exercises. It will help you in understanding how to create front end element and get your hands on.
This example uses local File data but once you are done you will be able to integrate both
Nabheet
thanks will give a try. Are there pre requisites to be installed in SAP ECC to work with these exercises and UI5.
In the link you mentioned ,
Below are my eclipse Plugin details
I have xampp installed in my local system .
I have followed the document and got some good information from it.
but the data in the project is hardcoded in model and being referenced every time , but for me should get from Odata . Odata can return in json format also. but how to achieve this dynamically ?
with value from input text box . and then navigate to next screen.
PLease let me know how to achieve this ?
PLease check and suggest if i am doing it in correct way or missing something.
I replaced the Fiori exercise 0 files in my newly created UI5 project . and changing the master.view .xml and master.controller.js as below
master.view.xml
<core:View
controllerName="sap.ui.demo.myFiori.view.Master"
xmlns="sap.m"
xmlns:core="sap.ui.core" >
<Page
title="~MasterPage~" >
<subHeader>
<Bar>
<contentLeft>
<SearchField
search="handleSearch"
width="100%" >
</SearchField>
</contentLeft>
</Bar>
</subHeader>
<Button id="MyButton" text="Get Sales Order Status" press="doIt"/>
</Page>
</core:View>
master.controller.js
sap.ui.controller("sap.ui.demo.myFiori.view.Master", {
doIt : function(oEvent) {
var sServiceUrl = "http://DEF.ad.ABC.com:8001/sap/opu/odata/sap/ZTMP_ABV";
var oModel = new sap.ui.model.odata.ODataModel( sServiceUrl , true, "<User name>", "<Pass word>");
sap.ui.getCore().setModel(oModel);
var oFilter = new Array();
var ID = sap.ui.getCore().getElementById('ID').getValue();
var Desc = sap.ui.getCore().getElementById('Desc').getValue();
oFilter[0] = new sap.ui.model.Filter("ID", sap.ui.model.FilterOperator.EQ,"HELP" );
//oFilter[1] = new sap.ui.model.Filter("DESC", sap.ui.model.FilterOperator.EQ, "");
sap.ui.getCore().getElementById('POhdr').bindRows({
path: '/<entity set to bound>/',
filters: oFilter
})
}
});
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.