There are no secrets to success. It is the result of preparation, hard work, and learning from failure.

Saturday, 15 December 2018

Generate QR Code in SAPUI5

Click here and follow my SAP UI5/FIORI snippets and information Page
I am going to show you, how to generate QR code by using GOOGLE chart API in SAPUI5,below I have shown Application Structure,View Part,Controller Part,JSON,Application UI and Result.Go through it and please let me know in case of any issue/doubt.

QR Code : The QR Code is a two-dimensional version of the barcode, known from product packaging in the supermarket.QR Code has found its way into mobile marketing with the widespread adoption of smartphones. "QR" stands for "Quick Response", which refers to the instant access to the information hidden in the Code. QR Codes are gaining popularity because the technology is "open source", i.e. available for everyone. Significant advantages of QR Codes over conventional barcodes are larger data capacity and high fault tolerance.

How will you scan QR Code?
To scan a QR Code, you have to Install QR scanner app on your smartphone. 

Application Structure
View Part
<mvc:View controllerName="NS.QRCode.controller.S1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" displayBlock="true"
xmlns="sap.m" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core">
<App id="idAppControl">
<pages>
<Page title="{i18n>title}" class="sapUiSizeCompact">
<content >
<f:SimpleForm editable="true" layout="ResponsiveGridLayout" labelSpanXL="3" labelSpanL="3" labelSpanM="3" labelSpanS="12"
adjustLabelSpan="false" emptySpanXL="4" emptySpanL="4" emptySpanM="4" emptySpanS="0" columnsXL="1" columnsL="1" columnsM="1"
singleContainerFullSize="false">
<f:content >
<Label text="Product Id"/>
<Input id="ProductId" value="{/ProductId}"/>
<Label text="Product Name"/>
<Input value="{/ProductName}" id="ProductName"/>
<Label text="Product Description"/>
<TextArea value="{/ProductDes}" rows="3" id="ProductDesc"/>
<Label text="Company Name"/>
<Select selectedKey="CMP4" items="{/compDets}" id="cmpId">
<core:Item text="{compName}" key="{compCode}"/>
</Select>
<Button icon="sap-icon://generate-shortcut" text="Generate QR Code" type="Accept" press="handleGenerateQRCode">
<layoutData>
<l:GridData span="XL1 L2 M2 S4"/>
</layoutData>
</Button>
</f:content>
</f:SimpleForm>
<HBox>
<Image densityAware="false" id="imgId">
<layoutData>
<FlexItemData growFactor="1"/>
</layoutData>
</Image>
</HBox>
</content>
</Page>
</pages>
</App>
</mvc:View>

Controller Part
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function (Controller) {
"use strict";

return Controller.extend("NS.QRCode.controller.S1", {

onInit: function () {
//Json model....
var json = new sap.ui.model.json.JSONModel($.sap.getModulePath("NS/QRCode","/model/data.json"));
// Setting json model to view....
this.getView().setModel(json);
},
       // When user will click on 'Generate QR Code' button then this method will fire....
handleGenerateQRCode: function () {
var Arr = [];
// Google Chart API....
var baseURL = "http://chart.apis.google.com/chart?cht=qr&chs=250x250&chl=";
var allString = "";
Arr.push({
key: "Product-Id",
value: this.byId("ProductId").getValue()
});
Arr.push({
key: "Product-Name",
value: this.byId("ProductName").getValue()
});
Arr.push({
key: "Product-Desc",
value: this.byId("ProductDesc").getValue()
});
Arr.push({
key: "Company-Name",
value: this.byId("cmpId")._getSelectedItemText()
});
allString = escape(JSON.stringify(Arr));
var url = baseURL + allString;
// setting final URL to image,which I have taken in view....
this.byId("imgId").setSrc(url);
}

});
});

data.json
{
"ProductId": "PR-101",
"ProductName": "Product test name",
"ProductDes": "Product test description",
"compDets": [{
"compName": "Test Company1",
"compCode": "CMP1"
}, {
"compName": "Test Company2",
"compCode": "CMP2"
}, {
"compName": "Test Company3",
"compCode": "CMP3"
}, {
"compName": "Test Company4",
"compCode": "CMP4"
}, {
"compName": "Test Company5",
"compCode": "CMP5"
}]
}

Application UI


Result
You will get QR Code after clicking on "Generate QR Code" button

Friday, 30 November 2018

Export the Model Data to a PDF file in SAPUI5

Click here and follow my SAP UI5/FIORI snippets and information Page
I have made this example,below I have shown Application Structure,View Part,Controller Part,JSON,Application UI and Result.Go through it and please let me know in case of any issue/doubt.
Application Structure

View Part
<mvc:View controllerName="print.controller.S1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" displayBlock="true"
xmlns="sap.m" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core">
<App id="idAppControl">
<pages>
<Page title="{i18n>title}">
<content>
<IconTabBar class="sapUiSizeCompact">
<items>
<IconTabFilter text="Header Information">
<Panel class="sapUiSizeCompact" expandable="true" expanded="true" width="100%" height="auto">
<headerToolbar>
<Toolbar>
<Text text="Header Details"/>
<ToolbarSpacer/>
<SearchField width="40%"/>
<Button icon="sap-icon://refresh" type="Accept"/>
</Toolbar>
</headerToolbar>
<content>
<f:SimpleForm editable="true" layout="ResponsiveGridLayout" labelSpanXL="4" labelSpanL="4" labelSpanM="4" labelSpanS="12"
adjustLabelSpan="false" emptySpanXL="0" emptySpanL="3" emptySpanM="0" emptySpanS="0" columnsXL="2" columnsL="2" columnsM="1"
singleContainerFullSize="false">
<f:content>
<core:Title/>
<Label text="School Name"/>
<Input enabled="false" value="{genericAlias>/scName}"/>
<Label text="Owner Name"/>
<Input enabled="false" value="{genericAlias>/ownName}"/>
<Label text="Owner E-mail"/>
<Input enabled="false" value="{genericAlias>/ownMail}"/>
<core:Title/>
<Label text="Owner Mobile No."/>
<Input enabled="false" value="{genericAlias>/ownMobile}"/>
<Label text="Owner Staus"/>
<Input enabled="false" value="{genericAlias>/ownStatus}"/>
<Label text="Scholl Address"/>
<TextArea rows="3" enabled="false" value="{genericAlias>/scaddress}"/>
</f:content>
</f:SimpleForm>
</content>
</Panel>
<Table items="{genericAlias>/studentDetails}">
<columns>
<Column>
<Text text="Sudent Id"/>
</Column>
<Column demandPopin="true">
<Text text="Student Name"/>
</Column>
<Column demandPopin="true">
<Text text="Student Mobile No."/>
</Column>
<Column demandPopin="true">
<Text text="Student Email-ID"/>
</Column>
<Column demandPopin="true">
<Text text="Student Standard"/>
</Column>
</columns>
<ColumnListItem>
<cells>
<ObjectStatus text="{genericAlias>stuId}" state="Success"/>
<Text text="{genericAlias>stuName}"/>
<Text text="{genericAlias>stuMobNo}"/>
<Text text="{genericAlias>stuEmail}"/>
<Text text="{genericAlias>stuStand}"/>
</cells>
</ColumnListItem>
</Table>
</IconTabFilter>
<IconTabFilter text="Branch Information">
<Table items="{genericAlias>/branchDetails}">
<headerToolbar>
<Toolbar>
<ToolbarSpacer/>
<SearchField width="40%"/>
<Button icon="sap-icon://refresh" type="Accept"/>
</Toolbar>
</headerToolbar>
<columns>
<Column>
<Text text="Branch Code"/>
</Column>
<Column >
<Text text="Branch Principal Name"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="Location"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="Email-Id"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="Telephone No."/>
</Column>
</columns>
<ColumnListItem>
<cells>
<ObjectStatus text="{genericAlias>BRCode}" state="Success"/>
<Text text="{genericAlias>BRPRName}"/>
<Text text="{genericAlias>Location}"/>
<Text text="{genericAlias>Email}"/>
<Text text="{genericAlias>TelephoneNo}"/>
</cells>
</ColumnListItem>
</Table>
</IconTabFilter>
</items>
</IconTabBar>
</content>
<footer >
<Toolbar class="sapUiSizeCompact">
<ToolbarSpacer/>
<Button icon="sap-icon://print" text="Print" type="Accept" press="handlePrint"/>
<Button text="Verify" type="Accept"/>
</Toolbar>
</footer>
</Page>
</pages>
</App>
</mvc:View>

Controller Part
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function (Controller) {
"use strict";
return Controller.extend("print.controller.S1", {
onInit: function () {
// JSON model....
var json = new sap.ui.model.json.JSONModel($.sap.getModulePath("print", "/model/Data.json"));
// Setting model to view....
this.getView().setModel(json, 'genericAlias');
//Alias Name = genericAlias....
},
// When you click on 'Print' button then this method will call....
handlePrint: function (oEvent) {
var modelData = this.getView().getModel("genericAlias").getData();
var fullHtml = "";
//Calling method....
var header = this.getHeaderForm(modelData);
fullHtml += header;
//Making student table....
var headertable1 = "<table  border='1' style='margin-top:150px;width: 1000px;' align='center'>" +
"<caption style='color:green;font-weight: bold;font-size: large;'>Student Details</caption>" +
"<tr><th style='color:green'>Sudent Id</th>" +
"<th style='color:green'>Student Name</th>" +
"<th style='color:green'>Student Mobile No.</th>" +
"<th style='color:green'>Student Email-ID</th>" +
"<th style='color:green'>Student Standard</th></tr>";
            //Adding row dynamically to student table....
for (var i = 0; i < modelData.studentDetails.length; i++) {
headertable1 += "<tr>" +
"<td> " + modelData.studentDetails[i].stuId + "</td>" +
"<td>  " + modelData.studentDetails[i].stuName + "  </td>" +
"<td>  " + modelData.studentDetails[i].stuMobNo + "  </td>" +
"<td>  " + modelData.studentDetails[i].stuEmail + "  </td>" +
"<td>  " + modelData.studentDetails[i].stuStand + "  </td>" +
"</tr>";
}
headertable1 += "</table>";
fullHtml += headertable1;
// Making branch table....
var headertable2 = "<table  border='1' style='margin-top:50px;width: 1000px;' align='center'>" +
"<caption style='color:green;font-weight: bold;font-size: large;'>Branch Details</caption>" +
"<tr><th style='color:green'>Branch Code</th>" +
"<th style='color:green'>Branch Principal Name</th>" +
"<th style='color:green'>Location</th>" +
"<th style='color:green'>Email-Id</th>" +
"<th style='color:green'>Telephone No.</th></tr>";
           //Adding row dynamically to branch table....
for (var j = 0; j < modelData.branchDetails.length; j++) {
headertable2 += "<tr>" +
"<td> " + modelData.branchDetails[j].BRCode + "</td>" +
"<td>  " + modelData.branchDetails[j].BRPRName + "  </td>" +
"<td>  " + modelData.branchDetails[j].Location + "  </td>" +
"<td>  " + modelData.branchDetails[j].Email + "  </td>" +
"<td>  " + modelData.branchDetails[j].TelephoneNo + "  </td>" +
"</tr>";
}
headertable2 += "</table>";
fullHtml += headertable2;
// window.open(URL, name, specs, replace)
var wind = window.open("", "prntExample");
wind.document.write(fullHtml);
setTimeout(function () {
wind.print();
wind.close();
}, 1000);
},
//Returing header data(Called method).... 
getHeaderForm: function (modelData) {
var modulePath = $.sap.getModulePath("print", "/image/");
modulePath = modulePath + "logo.jpg";
     return "<Img src=" + modulePath + " style='margin-left:60rem' width='100px' height='80px'/>" +
"<hr/><div>" +
"<div style=float:left>" +
"<p>School Name        : " + modelData.scName + "</p>" +
"<p>Owner Name         : " + modelData.ownName + "</p>" +
"<p>Owner E-mail       : " + modelData.ownMail + "</p>" +
"</div><div style=float:right>" +
"<p>Owner Mobile No    : " + modelData.ownMobile + "</p>" +
"<p>Owner Staus        : " + modelData.ownStatus + "</p>" +
"<p>Scholl Address     : " + modelData.scaddress + "</p>" +
"</div></div>";
}
});
});

Data.json
{           "scName" : "Vikas Bal Vidya Mandir",
"ownMobile" : "2121212121",
        "ownName" : "Vikas singh",
"ownMail" : "info.vikask41@gmail.com",
"ownStatus":"Active",
"scaddress": "Opposite KPIT Cummins, IT Park, Phase 1, Hinjawadi, Pune, Maharashtra 411057",
"studentDetails":[{
"stuId":"101",
"stuName":"Nikhil Kumar",
"stuMobNo":"1111111111",
"stuEmail":"Nikhil@yahoo.com",
"stuStand":"10th"
},{
"stuId":"102",
"stuName":"Akash Kumar",
"stuMobNo":"2222222222",
"stuEmail":"Akash@gmail.com",
"stuStand":"7th"
},{
"stuId":"103",
"stuName":"Rahul Kumar",
"stuMobNo":"3333333333",
"stuEmail":"Rahul@yahoo.com",
"stuStand":"10th"
},{
"stuId":"104",
"stuName":"Nishant Kumar",
"stuMobNo":"4444444444",
"stuEmail":"Nishant@yahoo.com",
"stuStand":"5th"
},{
"stuId":"105",
"stuName":"Kunal singh Rajput",
"stuMobNo":"555555555",
"stuEmail":"Rajput@yahoo.com",
"stuStand":"10th"
}
],
"branchDetails":[{
"BRCode":"PSA001",
"BRPRName":"DR.Prashnat singh",
"Location":"Shivaji Chowk / Hinjawadi Chowk",
"Email":"ShivajiChowk@gmail.com",
"TelephoneNo":"2323232323"
},{
"BRCode":"PPCMCA002",
"BRPRName":"DR.vikas singh",
"Location":"Mahavir ChowkChinchwad, Pimpri-Chinchwad",
"Email":"ChowkChinchwad@gmail.com",
"TelephoneNo":"3434343434"
},{
"BRCode":"PWCEA003",
"BRPRName":"ER.Ashutosh Jha",
"Location":"Wakadkar Wasti Rd,Casa Imperia",
"Email":"CasaImperia@gmail.com",
"TelephoneNo":"4545454545"
},
{
"BRCode":"PSA004",
"BRPRName":"ER.Gopal singh",
"Location":"near Pune Junction railway station",
"Email":"punerailway@gmail.com",
"TelephoneNo":"6767676767"
}
]
}
Application UI



Result
You will get below screen after clicking on "Print" button,which is in footer.
Zoomed In view
 
  You will get below screen after clicking on "Save" button.
  Enter your desire name and save.
   Go to your saved folder and open the file.



Saturday, 10 November 2018

Base64 conversion of selected file in SAPUI5

Click here and follow my SAP UI5/FIORI snippets and information Page
I have made example of base64 conversion of any selected file,below I have shown Application Structure,View Part,Controller Part and Result.Go through it and please let me know in case of any issue/doubt.

Application Structure 
View Part
<mvc:View controllerName="Base64.controller.S1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" displayBlock="true"
xmlns="sap.m" xmlns:u="sap.ui.unified" xmlns:l="sap.ui.layout">
<App id="idAppControl">
<pages>
<Page title="{i18n>title}">
<content>
<l:VerticalLayout>
<u:FileUploader name="myFileUpload" tooltip="Upload your file to the local server" change="handleSelectFile"/>
</l:VerticalLayout>
</content>
</Page>
</pages>
</App>
</mvc:View>

Controller Part
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function (Controller) {
"use strict";
return Controller.extend("Base64.controller.S1", {
      
      // When user select the file then this method will call....
handleSelectFile: function (oEvent) {
var fileDetails = oEvent.getParameters("file").files[0];
sap.ui.getCore().fileUploadArr = [];
if (fileDetails) {
var mimeDet = fileDetails.type,
fileName = fileDetails.name;
// Calling method....
this.base64coonversionMethod(mimeDet, fileName, fileDetails, "001");
} else {
sap.ui.getCore().fileUploadArr = [];
}
},

// Base64 conversion of selected file(Called method)....
base64coonversionMethod: function (fileMime, fileName, fileDetails, DocNum) {
var that = this;
if (!FileReader.prototype.readAsBinaryString) {
FileReader.prototype.readAsBinaryString = function (fileData) {
var binary = "";
var reader = new FileReader();
reader.onload = function (e) {
var bytes = new Uint8Array(reader.result);
var length = bytes.byteLength;
for (var i = 0; i < length; i++) {
binary += String.fromCharCode(bytes[i]);
}
that.base64ConversionRes = btoa(binary);
sap.ui.getCore().fileUploadArr.push({
"DocumentType": DocNum,
"MimeType": fileMime,
"FileName": fileName,
"Content": that.base64ConversionRes,
});
};
reader.readAsArrayBuffer(fileData);
};
}
var reader = new FileReader();
reader.onload = function (readerEvt) {
var binaryString = readerEvt.target.result;
that.base64ConversionRes = btoa(binaryString);
sap.ui.getCore().fileUploadArr.push({
"DocumentType": DocNum,
"MimeType": fileMime,
"FileName": fileName,
"Content": that.base64ConversionRes,

});
};
reader.readAsBinaryString(fileDetails);
},
});
});
Result
See the property name 'Content' in console(developer tool),That is the Base64 converted string.


Tuesday, 30 October 2018

Loading local resources in Launchpad

Click here and follow my SAP UI5/FIORI snippets and information Page
I have made example for loading local image in Launchpad,below I have given small snippet.This is generic snippet for loading local image.Go through it and please let me know in case of any issue/doubt.     
                                
var modulePath=$.sap.getModulePath("PurDemo", "/image/"),
                                                logoId=this.byId('logo');
                                                logoId.setSrc(modulePath+"logo.png");

PurDemo=your component name
image=your image’s folder name

If we load image by XML view ,It will not work in Launchpad.It will only work in local server.
<Image id="logotooltip="Logowidth="100pxheight="55pxsrc="image/logo.png"/>

Sunday, 9 September 2018

Export the Model Data to a CSV/XLS excel file in SAPUI5

Click here and follow my SAP UI5/FIORI snippets and information Page
I have made Export Excel example,below I have shown Application Structure,View Part,Controller Part,JSON and Result.Go through it and please let me know in case of any issue/doubt.

Application Structure

View Part

<mvc:View controllerName="ExcelDownload.controller.S1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
displayBlock="true" xmlns="sap.m">
<App id="idAppControl">
<pages>
<Page title="Export Excel">
<content>
<Table items="{tabAlias>/Result}">
<columns>
<Column>
<ObjectIdentifier title="Name"/>
</Column>
<Column>
<ObjectIdentifier title="Mobile"/>
</Column>
<Column>
<ObjectIdentifier title="E-mail"/>
</Column>
<Column>
<ObjectIdentifier title="Address"/>
</Column>
</columns>
<ColumnListItem>
<cells>
<Text text="{tabAlias>name}"/>
<Text text="{tabAlias>mobile}"/>
<Text text="{tabAlias>mail}"/>
<Text text="{tabAlias>address}"/>
</cells>
</ColumnListItem>
</Table>
</content>
<footer>
<Toolbar>
<ToolbarSpacer/>
<Button type="Accept" press="handleExcelExport" text="Export Excel"/>
</Toolbar>
</footer>
</Page>
</pages>
</App>
</mvc:View>
Controller Part

sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/ui/core/util/Export",
"sap/ui/core/util/ExportTypeCSV",
"sap/ui/model/json/JSONModel"

], function (Controller, Export, exportCSV, jsonModel) {
"use strict";

return Controller.extend("ExcelDownload.controller.S1", {

onInit: function () {
//JSON model....
var json = new jsonModel("model/record.json");
//Setting model to view with alias name...
  //Alias name="tabAlias"....
this.getView().setModel(json, "tabAlias");
},

// When users click on Export Excel button then this method will call.... 
handleExcelExport: function () {
// getting model into oModel variable.
var oModel = this.getView().getModel("tabAlias");
var oExport = new Export({
exportType: new exportCSV({
// for xls....
fileExtension: "xls",
separatorChar: "\t",
charset: "utf-8",
mimeType: "application/vnd.ms-excel"

// for CSV....
/* charset: "utf-8",
fileExtension:"csv",
separatorChar:",",
mimeType:"application/csv" */
}),
models: oModel,

rows: {
path: "/Result"
},
columns: [{
name: "Name",
template: {
content: "{name}"
}
}, {
name: "Mobile",
template: {
content: "{mobile}"
}
}, {
name: "E-mail",
template: {
content: "{mail}"
}
}, {
name: "Address",
template: {
content: "{address}"
}
}]
});
oExport.saveFile().catch(function (oError) {
sap.m.MessageToast.show("Generate is not possible beause no model was set");
}).then(function () {
oExport.destroy();
});
}
});
});
record.json

{

 "Result": [{
   "name": "Vikas Singh",
   "mobile": 8828054345,
   "mail": "info.vikaskumar41@gmail.com",
   "address": "Bihar,INDIA"
  }, {
   "name": "Kunal Singh",
   "mobile": 3434343456,
   "mail": "info.kumalkumar@gmail.com",
   "address": "Bihar,INDIA"
  }, {
   "name": "Rajeev Singh",
   "mobile": 4568235678,
   "mail": "info.Rjeeev@gmail.com",
   "address": "Bihar,INDIA"
  }, {
   "name": "Senjeev Singh",
   "mobile": 2345678765,
   "mail": "senjeev41@gmail.com",
   "address": "Bihar,INDIA"
  }

 ]
}
Result
After clicking on 'Export Excel' button
    After opening data.xls file
   After clicking on Yes button.

Monday, 4 June 2018

Search in Table by using model filter

Click here and follow my SAP UI5/FIORI snippets and information Page
I have made Table search example by using model filter,below I have shown Application Structure,View Part,Controller Part,JSON and Result.Go through it and please let me know in case of any issue/doubt.

Application Structure

View Part

<mvc:View controllerName="SearchByFilters.controller.S1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
displayBlock="true" xmlns="sap.m" xmlns:l="sap.ui.layout">
<App>
<pages>
<Page title="{i18n>title}">
<content>
<l:Grid defaultSpan="L12 M12 S12">
<Table items="{/Result}" id="tabId">
<headerToolbar>
<Toolbar>
<ToolbarSpacer/>
<SearchField id="searchId" placeholder="Search by Name and E-mail" search="handleChangeSearch"/>
</Toolbar>
</headerToolbar>
<columns>
<Column>
<ObjectIdentifier title="Name"/>
</Column>
<Column>
<ObjectIdentifier title="Mobile"/>
</Column>
<Column>
<ObjectIdentifier title="E-mail"/>
</Column>
<Column>
<ObjectIdentifier title="Address"/>
</Column>
</columns>
<ColumnListItem>
<cells>
<Text text="{name}"/>
<Text text="{mobile}"/>
<Text text="{mail}"/>
<Text text="{address}"/>
</cells>
</ColumnListItem>
</Table>
</l:Grid>
</content>
</Page>
</pages>
</App>
</mvc:View>

Controller Part

sap.ui.define([
"sap/ui/core/mvc/Controller"
], function(Controller) {
"use strict";
return Controller.extend("SearchByFilters.controller.S1", {
onInit: function() {
//JSON model....
var json = new sap.ui.model.json.JSONModel("model/record.json");
//Setting model to view...
this.getView().setModel(json);
},

// When users click on search button then this method will call....
handleChangeSearch: function(oEvent) {
var tableId = this.byId("tabId");
var inputValue = oEvent.getParameter("query");
var trimValue = inputValue.trim();
var filterArr = [];
var items = tableId.getBinding("items");
var filter1 = new sap.ui.model.Filter("name", sap.ui.model.FilterOperator.Contains, trimValue);
var filter2 = new sap.ui.model.Filter("mail", sap.ui.model.FilterOperator.Contains, trimValue);
filterArr = [filter1, filter2];

var finalFilter = new sap.ui.model.Filter({
filters: filterArr,
and: false
});
items.filter(finalFilter);
}
});
});

 record.json

{
"Result": [{
"name": "Vikas Singh",
"mobile": 8828054345,
"mail": "info.vikaskumar41@gmail.com",
"address": "Bihar,INDIA"
}, {
"name": "Kunal Singh",
"mobile": 3434343456,
"mail": "info.kumalkumar@gmail.com",
"address": "Bihar,INDIA"
}, {
"name": "Rajeev Singh",
"mobile": 4568235678,
"mail": "info.Rjeeev@gmail.com",
"address": "Bihar,INDIA"
}, {
"name": "Senjeev Singh",
"mobile": 2345678765,
"mail": "senjeev41@gmail.com",
"address": "Bihar,INDIA"
}

]
}

Result

     Searched by vika
    Searched by info