// OData Model initialization
var oModel = new sap.ui.model.odata.v2.ODataModel("Service_URL");
// Array to hold create requests
var aBatchRequest = [];
// Add multiple create requests to the batch
aBatchRequest.push(oModel.createBatchOperation("/EntitySet1", "POST", {P1: V1}));
aBatchRequest.push(oModel.createBatchOperation("/EntitySet2", "POST", {P2: V2}));
aBatchRequest.push(oModel.createBatchOperation("/EntitySet3", "POST", {P3: V3}));
aBatchRequest.push(oModel.createBatchOperation("/EntitySet4", "POST", {P4: V4}));
// Execute the batch request
oModel.addBatchChangeOperations(aBatchRequest);
// Submit the batch request
oModel.submitBatch(function (oData, oResponse) {
// We will get data here for all read operations
}, function (error) {
// We can handle errors here
});
SAPUI5/SAP FIORI snippets and information
Thursday, 29 February 2024
Multiple create operations using batch in SAPUI5
Friday, 23 February 2024
Multiple read operations using batch in SAPUI5
// OData Model initialization
var oModel = new sap.ui.model.odata.v2.ODataModel("Service_URL");
// Array to hold read requests
var aBatchRequest = [];
// Add multiple read requests to the batch
aBatchRequest.push(oModel.createBatchOperation("/EntitySet1", "GET"));
aBatchRequest.push(oModel.createBatchOperation("/EntitySet2", "GET"));
aBatchRequest.push(oModel.createBatchOperation("/EntitySet3", "GET"));
aBatchRequest.push(oModel.createBatchOperation("/EntitySet4", "GET"));
// Execute the batch request
oModel.addBatchReadOperations(aBatchRequest);
// Submit the batch request
oModel.submitBatch(function (oData, oResponse) {
// We will get data here for all read operations
}, function (error) {
// We can handle errors here
});
Saturday, 5 September 2020
SAP Web IDE Trial Update
On November 13, 2020 the SAP Cloud Platform, Neo trial environment will be discontinued and as a result SAP Web IDE Full-Stack trial will also be discontinued.
If you have an existing Neo trial account, you can continue using it including SAP Web IDE Full-Stack until November 13, 2020. This can be done by opening the SAP Cloud Platform trial home page, scrolling down to the Environments section, and choosing “Access Neo Trial” Link. Then, under Services choose SAP Web IDE Full-Stack.
Before November 13, you must choose one of the following options:
1. Start using the SAP Business Application Studio trial as it is the next generation of SAP Web IDE Full-Stack. It offers a modern desktop-like experience in the cloud including new tools, capabilities, and much more. To learn more, please see this blog central blog with links to useful information, supported scenarios, migration guides and hands-on tutorials.
Monday, 23 March 2020
SAP Cloud Platform Business Rules- Part 3
SAP Cloud Platform Business Rules- Part 1
SAP Cloud Platform Business Rules- Part 2
In the Part-1 and Part-2, I have shown required configurations steps and BRM Rules project creation with all required components.In Part-3,I going to explain below point.Go through it and please let me know in case of any doubt/issue.
->How to use/call BRM project in SAPUI5/FIORI application
Advantages:
There are three drop-downs in this UI screen.All are mandatory fields here.
Select Quantity from third drop-down.
Select all the fields and click on "check" button for knowing the best offer.Based on the selections you will get offer from BRM Rules.
I have selected these options.Please find below the screenshot.
<f:SimpleForm editable="true" layout="ResponsiveGridLayout" labelSpanXL="3" labelSpanL="4" 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="Card Type" required="true"/>
<ComboBox placeholder="Select Card Type" id="cardTypId">
<core:Item key="SBI" text="SBI"/>
<core:Item key="HDFC" text="HDFC"/>
<core:Item key="TATA" text="TATA"/>
<core:Item key="CITI" text="CITI"/>
<core:Item key="ICICI" text="ICICI"/>
<core:Item key="AMERICAN EXPRESS" text="AMERICAN EXPRESS"/>
<core:Item key="IDFC" text="IDFC"/>
<core:Item key="RBL" text="RBL"/>
<core:Item key="BAJAJ" text="BAJAJ"/>
<core:Item key="AXIS" text="AXIS"/>
</ComboBox>
<Label text="Brand" required="true"/>
<ComboBox placeholder="Select Brand" id="brandTypId">
<core:Item key="SONY" text="SONY"/>
<core:Item key="LG" text="LG"/>
<core:Item key="SAMSUNG" text="SAMSUNG"/>
<core:Item key="SPYKAR" text="SPYKAR"/>
<core:Item key="ARROW" text="ARROW"/>
<core:Item key="MUFTI" text="MUFTI"/>
<core:Item key="LEVIS" text="LEVIS"/>
<core:Item key="MOCHI" text="MOCHI"/>
<core:Item key="MATROLA" text="MATROLA"/>
<core:Item key="NIKE" text="NIKE"/>
</ComboBox>
<Label text="Quantity" required="true"/>
<ComboBox placeholder="Select Quantity" id="quanTypId">
<core:Item key="1" text="1"/>
<core:Item key="2" text="2"/>
<core:Item key="3" text="3"/>
<core:Item key="4" text="4"/>
<core:Item key="5" text="5"/>
<core:Item key="6" text="6"/>
<core:Item key="7" text="7"/>
<core:Item key="8" text="8"/>
<core:Item key="9" text="9"/>
<core:Item key="10" text="10"/>
<core:Item key="11" text="11"/>
<core:Item key="12" text="12"/>
<core:Item key="13" text="13"/>
<core:Item key="14" text="14"/>
<core:Item key="15" text="15"/>
</ComboBox>
</f:content>
</f:SimpleForm>
<FlexBox alignItems="Center" justifyContent="Center">
<items>
<Button text="Reset" type="Reject" class="sapUiSmallMarginEnd" press="handleRest"/>
<Button text="Check" type="Accept" press="handleCheck"/>
</items>
</FlexBox>
<ObjectIdentifier title="**Festival Offers on credit cards" class="marginClass"/>
</content>
handleCheck: function () {
jQuery.sap.require("sap.m.MessageBox");
var cardId = this.byId("cardTypId"),
brandId = this.byId("brandTypId"),
QAId = this.byId("quanTypId"),
that = this;
if (!cardId.getSelectedKey()) {
sap.m.MessageToast.show("Select Card Type");
return;
}
if (!brandId.getSelectedKey()) {
sap.m.MessageToast.show("Select Brand");
return;
}
if (!QAId.getSelectedKey()) {
sap.m.MessageToast.show("Select Quantity");
return;
}
//Input(Entity/Structure name in business rules)....
//CardType,BrandType,Quantity(Properties names in business rules)....
var payLoad = {
"__type__": "Input",
// Date type is string in business rules....
"CardType": cardId.getSelectedKey(),
// Data type is string in business rules....
"BrandType": brandId.getSelectedKey(),
// Date type is number in business rules....
"Quantity": Number(QAId.getSelectedKey())
};
// First get the CSRF token....
$.ajax({
url:"/bpmrulesruntime/rules-service/v1/rules/xsrf-token",
method: "GET",
headers: {
"X-CSRF-Token": "Fetch"
},
success: function (result, xhr, data) {
var token = data.getResponseHeader("X-CSRF-Token");
// Then invoke the business rules service via public API....
$.ajax({
// DemoRules1(Project Name in business rules)....
// OfferRulesService(Service Name in business rules)....
url: "/bpmrulesruntime/rules-service/v1/rules/invoke?rule_service_name=DemoRules1::OfferRulesService",
method: "POST",
contentType: "application/json",
data: JSON.stringify(payLoad),
async: false,
headers: {
"X-CSRF-Token": token
},
success: function (result1, xhr1, data1) {
var dis = null,
cashBack = null,
title = "",
icon = null;
if (result1.__type__) {
dis = result1.Discount + "%";
cashBack = result1.Cashback + " INR";
title = "CONGRATULATIONS";
icon = sap.m.MessageBox.Icon.SUCCESS;
} else {
dis = "0%";
cashBack = "0 INR";
title = "INFORMATION";
icon = sap.m.MessageBox.Icon.INFORMATION;
}
sap.m.MessageBox.show("Discount = " + dis + "\n" + "CashBack = " + cashBack, {
icon: icon,
title: title,
actions: [sap.m.MessageBox.Action.OK],
onClose: function (oAction) {
that.handleRest();
}
});
}
});
}
});
},
// When users click on 'RESET' button then this method will fire....
handleRest: function () {
this.byId("cardTypId").setSelectedKey("");
this.byId("brandTypId").setSelectedKey("");
this.byId("quanTypId").setSelectedKey("");
}
Saturday, 21 March 2020
SAP Cloud Platform Business Rules- Part 2
SAP Cloud Platform Business Rules- Part 1
SAP Cloud Platform Business Rules- Part 3
->How to create Data Objects(Entity).
->How to create attribute.
->How to create service and vocabulary.
->How to deploy service on cloud.
Thursday, 11 April 2019
SAP Cloud Platform Business Rules- Part 1
SAP Cloud Platform Business Rules- Part 2
SAP Cloud Platform Business Rules- Part 3
Step 6- You will get below screen.
Congratulation!Now it is enabled.
Step 7- Click on "Configure Business Rules Repository" link.I have shown below in the screenshot.
Step 8- You will get below screen.
Select "RuleAdmin" and click on "Assign" button.
Step 9- You will get below screen.
Give your User Id and Click on "Assign" button.I have shown above in the screenshot.
User Id = I have marked above in the screenshot.
Step 10- You will get below screen.
Now Id has been assigned to "RoleAdmin".I have shown above in the screenshot.
Step 11- Go back.
Click on "Business Rules Editor".I have shown above in the screenshot.
Step 12- You will get below screen.