Thursday, 14 September 2017

How to align button to center in sap ui5 ?

<Bar>
<contentMiddle>
<Button text="Submit" press="onPresssubmitButton" />
</contentMiddle>
</Bar>

Thursday, 23 March 2017

How to add table to dialogue dynamically in sap ui 5 ?

addingtabledata_dynamic:function(){


                                         var oDialog1 = new sap.m.Dialog();

                                         var image1 = new sap.m.Image({
                                                src : "sap-icon://inventory",
                                                tap : [ function(oEvent) {
                                                       var control = oEvent.getSource();

                                                       oDialog1.close();
                                                }, this ]
                                         });

                                        
                                         var oTable = new sap.m.Table("oTable",{
                                               columns: [new sap.m.Column({
                                                   header: new sap.m.Label({
                                                     text: "Product"
                                                   })
                                                 }),
                                                 new sap.m.Column({
                                                   header: new sap.m.Label({
                                                     text: "Weight"
                                                   })
                                                 }),
                                                       new sap.m.Column({
                                                   header: new sap.m.Label({
                                                     text: "Add"
                                                   })
                                                 })
                                               ],
                                               items: {
                                                 path: '/value',
                                                 template: new sap.m.ColumnListItem({
                                                   cells: [new sap.m.Text({
                                                       text: "{OrderID}"
                                                     }),
                                                     new sap.m.Text({
                                                       text: "{OrderID}"
                                                     }),
                                                              new sap.ui.core.Icon({
                                                                     src:"sap-icon://add",
                                                                     press: function(oEvent){
                                                                       oController.onAdd();
                                                                     }
                                                              })
                                                   ]
                                                 })
                                               }
                                             });
                                        
                                        
                                         oTable.setModel(json_model);
                                        

                                      

                                         oDialog1.addContent(image);
                                        
                                         oDialog1.addContent(oTable);

                                         oDialog1.open();

}

How to allow only numbers in Input box of sap Ui5 ?


use Liveupdate="validateFunction" param for Input View


 validateFunction : function(oEvent) {

                                       

                                         var ovalid=oEvent.oSource;
                                         var newValue = oEvent.getParameter("value");
                                         if(isNaN(newValue)){
                                                                ovalid.setValueState(sap.ui.core.ValueState.Error);
                                                ovalid.setValue("");
                                                return false;
                                         }
                                         else
                                         {
                                                ovalid.setValueState(sap.ui.core.ValueState.None);
                                         }
 }

Friday, 17 March 2017

How to know the Index of the List ins sap Ui5 ?

                                     
presseventofListItem:function(oEvent){


                                       var oList = oEvent.getSource();
                                         var oItem = oEvent.getParameter("listItem");
                                         var sPath = oItem.getBindingContext().getPath();


}
                                    

How to develop sap ui5 apps in sap web ide in online ?

First Register /login the

https://account.hanatrial.ondemand.com/


after login ..

if you can open the Development Editor .

go to services (available in left hand side in your trail account)


we wil see many options select SAP web ide/innovation web IDE  (updation  version of Web ide).

you can create your application .


if anything you want to interact with the server with online web ide .

first we have to install the Web Ide connector in our local machine .

available here :

https://tools.hana.ondemand.com/#cloud





Complete Guide  step by step process Available Here :

https://blogs.sap.com/2015/02/11/set-up-your-sap-web-ide-on-hana-cloud-part-2/



How to develop the List as Table in sap ui5 ?



We can use the CustomListItem in the List  to show as table in sap ui5.


please follow the below link

how to add delete functionality to the Table in sap ui5 ?

XML:

       <Table id="sampletable">
                <columns>
                    <Column/>
                    <Column/>
                       <Column/>
                    <Column/>
                </columns>
            </Table>


CONTROLER:


Declare  json_model variable  in  oninit and asign the response object  to the JsonModel .




var oTable = this.getView().byId(this.createId("sampletable"));

                                          oTable.setModel(json_model);
                                          var controller = this;
                                         
                                          
                                          var mytemplate = new sap.m.ColumnListItem({
                                              cells : [
                                                       new sap.m.Text({
                                                           text : "{OrderID}"
                                                       }),
                                                       new sap.m.Text({
                                                           text : "{OrderID}",
                                                       }),
                                                       new sap.m.Button({
                                                           press : function(evt) {
                                                               if (evt.getSource().getParent().getParent().getItems().length > 0) {
                                                                   if (evt.getSource().getParent().getParent().getItems().length > 0) {
                                                                          var item = evt.getSource().getParent();
                                                                          var index = evt.getSource().getParent().getParent().indexOfItem(item);
                                                                          var newData = oTable.getModel().getData();
                                                                          console.log("called data is==="+newData+"===INDEX==="+index);
                                                                          var df= newData.value;
                                                                         
                                                                          console.log("called data is===vvvvv"+df);
                                                                          df.splice(index, 1);
                                                                          oTable.getModel().setData(newData);
                                                                      }
                                                               }
                                                           },
                                                       }),
                                                       new sap.m.Button({
                                                           icon : "sap-icon://add",
                                                           press : function(evt) {
                                                               controller.getView().byId(controller.createId("createDialog")).open();
                                                           }
                                                       })
                                                ],
                                          });
                                          oTable.bindAggregation("items", {
                                              path : "/value",
                                              template : mytemplate
                                          });
                                     

how to delete row from table in sap ui5 ?

XML:

       <Table id="sampletable">
                <columns>
                    <Column/>
                    <Column/>
                       <Column/>
                    <Column/>
                </columns>
            </Table>


CONTROLER:


Declare  json_model variable  in  oninit and asign the response object  to the JsonModel .




var oTable = this.getView().byId(this.createId("sampletable"));

                                          oTable.setModel(json_model);
                                          var controller = this;
                                         
                                          
                                          var mytemplate = new sap.m.ColumnListItem({
                                              cells : [
                                                       new sap.m.Text({
                                                           text : "{OrderID}"
                                                       }),
                                                       new sap.m.Text({
                                                           text : "{OrderID}",
                                                       }),
                                                       new sap.m.Button({
                                                           press : function(evt) {
                                                               if (evt.getSource().getParent().getParent().getItems().length > 0) {
                                                                   if (evt.getSource().getParent().getParent().getItems().length > 0) {
                                                                          var item = evt.getSource().getParent();
                                                                          var index = evt.getSource().getParent().getParent().indexOfItem(item);
                                                                          var newData = oTable.getModel().getData();
                                                                          console.log("called data is==="+newData+"===INDEX==="+index);
                                                                          var df= newData.value;
                                                                         
                                                                          console.log("called data is===vvvvv"+df);
                                                                          df.splice(index, 1);
                                                                          oTable.getModel().setData(newData);
                                                                      }
                                                               }
                                                           },
                                                       }),
                                                       new sap.m.Button({
                                                           icon : "sap-icon://add",
                                                           press : function(evt) {
                                                               controller.getView().byId(controller.createId("createDialog")).open();
                                                           }
                                                       })
                                                ],
                                          });
                                          oTable.bindAggregation("items", {
                                              path : "/value",
                                              template : mytemplate
                                          });
                                     

Friday, 10 March 2017

How to add third party libs in sap ui5 ?

In  index.html


  1. <script src="resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-libs="sap.ui.commons, sap.m" data-sap-ui-theme="sap_bluecrystal" > </script>

  2. //add like this <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

Tuesday, 24 January 2017

How to add the custom Header in sap ui5 ?

<Page showHeader="true" id="page_main" >
<customHeader>
<Bar class="custom-header header-background">
<contentLeft>
<Image src="images/logo.png" class="sidf-logo"></Image>
</contentLeft>
<contentMiddle class="custom-header">

<VBox class="Cont_Vbox">
<Label text="Customer service toll free No" class="Cont-heading"
design="Bold" />
<Label text="8001160004" class="Cont-No" />
</VBox>


</contentMiddle>
<contentRight class="custom-header-right">
<SearchField width="70%" class="Search-box" />

</contentRight>
</Bar>
</customHeader>
<content>
</content>
</Page>

Thursday, 5 January 2017

How to integrate WSDL services to SAP UI5 ?

var request = '<?xml version="1.0" encoding="UTF-8"?>'
+

'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.w3schools.com/xml/">'
+

'<SOAP-ENV:Body>' +

'<ns1:CelsiusToFahrenheit>' +

'<ns1:Celsius>10</ns1:Celsius>' +

'</ns1:CelsiusToFahrenheit>' +

'</SOAP-ENV:Body>' +

'</SOAP-ENV:Envelope>';

var url = 'proxy/http/www.w3schools.com/xml/tempconvert.asmx?WSDL';

var aData = jQuery.ajax({

url : url,

type : "POST",

dataType : "text",

data : request,

contentType : "text/xml; charset=\"utf-8\"",

success : function(data, textStatus, jqXHR) {

console.log("data" + data);

},

error : function()

{

console.log("ERROR");

}

});

How to Integrate soap services in sap ui5 ?


var request = '<?xml version="1.0" encoding="UTF-8"?>'
+

'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.w3schools.com/xml/">'
+

'<SOAP-ENV:Body>' +

'<ns1:CelsiusToFahrenheit>' +

'<ns1:Celsius>10</ns1:Celsius>' +

'</ns1:CelsiusToFahrenheit>' +

'</SOAP-ENV:Body>' +

'</SOAP-ENV:Envelope>';

var url = 'proxy/http/www.w3schools.com/xml/tempconvert.asmx?WSDL';

var aData = jQuery.ajax({

url : url,

type : "POST",

dataType : "text",

data : request,

contentType : "text/xml; charset=\"utf-8\"",

success : function(data, textStatus, jqXHR) {

console.log("data" + data);

},

error : function()

{

console.log("ERROR");

}

});