Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Products
Products Industries
Industries Services Support
Services and Support Training
Training Community
Community Developer
Developer
Partner
Partner About
About
Ask a Question Write a Blog Post Login
Christian Jianelli
December 7, 2012 More than 30 minute read
This is the part 3 of 3 of this blog series. In this part we will see the creation of the user interface using SAPUI5.
Table of Contents
Part 1
Prerequisites
Overview
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 1/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
References
SAPUI5
SAPLink
Retrieving the request method and the parameters passed in the URL
Part 2
Part 3
Creating the BSPs to deploy the application and the SAPUI5 framework.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 2/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Create
Read
Update
Delete
Find
There is already a very good document published on SCN by Silke Arians that explains how to create a SAPUI5 MVC project from
scratch by using the SAPUI5 Application Development Tool.
How to build a SAP HTML5 application using MVC with the SAPUI5 Application Development Tool
http://scn.sap.com/docs/DOC-29890
Here we will skip the basic steps of creating a project and jump direct to the creation of the view components.
Our project will be called “scnblog2” and the view will be called “main”. The view will be created using Javascript (Development
Paradigm).
Inform the correct path of the “sap.ui.core.js” file in your server and add the required libraries “sap.ui.core” and “sap.ui.table” (see figure
below).
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 3/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
The application will be composed by only one view and this view will be composed by a Table control with five buttons in its toolbar. Its
final look is illustrated in the figure below.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 4/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
The table control will be created inside the “createContent” method of the main view.
Below is the code to create the table control and its toolbar.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 5/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
visibleRowCount: 10,
firstVisibleRow: 0,
selectionMode: sap.ui.table.SelectionMode.Single,
items: [
new sap.ui.commons.Button({
text: “Create”,
press: function() {
oController.Create();
}),
new sap.ui.commons.Button({
press: function() {
oController.Read();
}),
new sap.ui.commons.Button({
text: “Update”,
press: function() {
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 6/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
oController.Update();
}),
new sap.ui.commons.Button({
text: “Delete”,
press: function() {
oController.Delete();
}),
new sap.ui.commons.Button({
text: “Find”,
press: function() {
oController.Find();
})]
})
});
// Column E-mail
oTable.addColumn(new sap.ui.table.Column({
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 7/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
sortProperty: “email”,
filterProperty: “email”,
width: “50%”
}));
oTable.addColumn(new sap.ui.table.Column({
sortProperty: “lastname”,
filterProperty: “lastname”,
width: “25%”
}));
oTable.addColumn(new sap.ui.table.Column({
sortProperty: “firstname”,
filterProperty: “firstname”,
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 8/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
width: “25%”
}));
sap.ui.getCore().setModel(oModel);
oTable.bindRows(“/data”);
return [oTable];
Each button have the “press” event handler implemented by an anonymous function that calls the respective method of the controller (
oController.Create(), for example). At this point the controller’s methods are not implemented yet.
We are using an extended (custom) version of the sap.ui.model.json.JSONModel (check the References). The myJSONModel.js file is
avaliable at https://gist.github.com/4218856. To use it in our project We need to create a new folder named “js” and create the
myJSONModel.js file inside this folder. We need also to include a new <script> tag in the index.html file. See figures below.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 9/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Executing the application at this point we should see a screen like the one illustrated in the figure below.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 10/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Creating the BSPs to deploy the application and the SAPUI5 framework.
Before implement the controller’s methods we need to upload our application and the SAPUI5 framework into the ABAP Application
Server. We must do it because we want to avoid headaches caused by CORS (Cross Origin Resource Sharing) .
Go to SE80 transaction, select BSP Application,inform the name of the BSP Application we want to create (ZSCNBLOG2) and hit the
Yes button.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 11/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Right click the BSP Application name and select the menu option Create -> Page.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 12/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Delete the auto-generated code. Copy the index.html code from Eclipse and paste in the BSP page. Save and activate it.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 13/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
To import the .js files we will use the report BSP_UPDATE_MIMEREPOS. Provide the path of the BSP Application. Select the
WebContent folder and hit the Ok button.
Refresh the BSP Application structure. Select the META-INF and WEB-INF folders and the index.html, right click it and select the menu
option “Delete”.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 14/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Refresh the BSP Application structure again. The final structure should be like the one illustrated in the figure below.
Now we need to do the same with the SAPUI5 framework. Its very similar to the steps described above.
We need to:
3. Delete the code auto-generated. Copy and paste the index.html code from the SAPUI5 into the index.html
of the BSP.
The final structure should be like the one illustrated in the figure below.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 15/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
The final step before executing the first test of the ZSCNBLOG2 BSP Application is to adjust the path of the SAPUI5.
Now we can test our application. Open the Developer tools to check if all files were downloaded correctly.
Open the main.controller.js file in the Eclipse and implement the code below.
/**
* Called when the Controller is destroyed. Use this one to free resources and finalize activities.
*/
// onExit: function() {
//
// }
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 17/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Create: function() {
},
Read : function() {
},
Update : function() {
},
Delete : function() {
},
Find : function() {
});
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 18/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Create
Below is the code that we need to implement to handle the create method.
modal: true,
closed: function(oControlEvent){
sap.ui.getCore().getElementById(‘Dialog’).destroy();
});
oDialog.setTitle(“New Contact”);
columns: 2,
width: “100%”
});
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 19/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
tooltip: ‘E-mail’,
editable: true,
width: ‘200px’
});
text: ‘E-mail’,
labelFor: oTF
});
oLayout.createRow(oLabel, oTF);
// Repeat the same for the fields Last Name and First Name
editable: true,
width: ‘200px’
});
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 20/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
labelFor: oTF
});
oLayout.createRow(oLabel, oTF);
editable: true,
width: ‘200px’
});
labelFor: oTF
});
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 21/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
oLayout.createRow(oLabel, oTF);
oDialog.addContent(oLayout);
var oParameters = {
“email” : sap.ui.getCore().getElementById(‘tfEmail’).getValue(),
“lastname” : sap.ui.getCore().getElementById(‘tfLastName’).getValue(),
“firstname” : sap.ui.getCore().getElementById(‘tfFirstName’).getValue()
};
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 22/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
function handleSuccess(oData){
if(oData.success===’true’){
// If the global model has already any data then the models are merged
// If not, then the global model is populated with the new contact
if(jQuery.isArray(oData2.data)){
}else{
sap.ui.getCore().getModel().setData(oData2, false);
sap.ui.getCore().getElementById(‘Dialog’).close();
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 23/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
// Display message
sap.ui.commons.MessageBox.alert(oData.msg);
function handleError(){
// Display message
sap.ui.commons.MessageBox.alert(arguments[0].statusText);
}}));
Dialog.open();
},
Now let’s test. Open the BSP Application ZSCNBLOG2 and delete the main.controller.js file.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 24/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Go to the browser and refresh the page. Hit the “Create” button. Fill in all fields. Hit the “OK” button.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 25/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Read
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 26/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Below is the code that we need to implement to handle the read method.
function handleSuccess(oData){
if(oData.success===’false’){
// Display message
sap.ui.commons.MessageBox.alert(oData.msg);
function handleError(){
// Display message
sap.ui.commons.MessageBox.alert(arguments[0].statusText);
Let’s test it. Repeat the steps of deleting and importing the main.controller.js. Go to the browser and refresh the page. Hit the “Read
(All)” button.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 27/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Update
// Retrieve the selected index, i.e., the index of the selected row
var i = oTable.getSelectedIndex();
if(i>=0){
// Example: “../../../zscnblog2/contact/christianjianelli@gmail.com“
var oParameters = {
“email” : selectedRow.getCells()[0].getText(),
“lastname” : selectedRow.getCells()[1].getValue(),
“firstname” : selectedRow.getCells()[2].getValue()
};
}else{
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 29/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
function handleSuccess(oData){
// Display message
sap.ui.commons.MessageBox.alert(oData.msg);
function handleError(){
// Display message
sap.ui.commons.MessageBox.alert(arguments[0].statusText);
Let’s test it. Repeat the steps of deleting and importing the main.controller.js. Go to the browser and refresh the page. Hit the “Read
(All)” button, change the last and first names, select the row and hit the “Update” button.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 30/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Delete
Below is the code that we need to implement to handle the Delete method.
// Example: “../../../zscnblog2/contact/christianjianelli@gmail.com“
}else{
function handleSuccess(oData){
if(oData.success===’true’){
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 32/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
if(jQuery.isArray(oData2.data)){
});
sap.ui.getCore().getModel().setData(oData2, false);
// Display message
sap.ui.commons.MessageBox.alert(oData.msg);
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 33/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
function handleError(){
// Display message
sap.ui.commons.MessageBox.alert(arguments[0].statusText);
Let’s test it. Repeat the steps of deleting and importing the main.controller.js. Go to the browser and refresh the page. Hit the “Read
(All)” button, select the row and hit the “Delete” button.
Find
In fact, this method is the read method, but once our read method returns always all records, it is worthwhile to see how can we search
for specific contact.
Below is the code that we need to implement to handle the Find method.
modal: true,
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 34/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
closed: function(oControlEvent){
sap.ui.getCore().getElementById(‘Dialog’).destroy();
});
oDialog.setTitle(“Find Contact”);
columns: 2,
width: “100%”
});
tooltip: ‘E-mail’,
editable: true,
width: ‘200px’
});
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 35/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
text: ‘E-mail’,
labelFor: oTF
});
oLayout.createRow(oLabel, oTF);
// Repeat the same for the fields Last Name and First Name
editable: true,
width: ‘200px’
});
labelFor: oTF
});
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 36/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
oLayout.createRow(oLabel, oTF);
editable: true,
width: ‘200px’
});
labelFor: oTF
});
oLayout.createRow(oLabel, oTF);
oFirstDialog.addContent(oLayout);
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 37/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
var oParameters = {
“lastname” : sap.ui.getCore().getElementById(‘tfLastName’).getValue(),
“firstname” : sap.ui.getCore().getElementById(‘tfFirstName’).getValue()
};
// Example: “../../../zscnblog2/contact/christianjianelli@gmail.com“
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 38/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
function handleSuccess(oData){
if(oData.success===’false’){
// Display message
sap.ui.commons.MessageBox.alert(oData.msg);
}else{
sap.ui.getCore().getElementById(‘Dialog’).close();
function handleError(){
// Display message
sap.ui.commons.MessageBox.alert(arguments[0].statusText);
}}));
oFirstDialog.open();
Let’s test it. Repeat the steps of deleting and importing the main.controller.js. Go to the browser and refresh the page. Create two new
contacts. Refresh the page again. Hit the “Find” button, choose one of the 3 fields to find the contact and hit the “OK” button.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 39/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 40/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Christian Jianelli
Alert Moderator
Assigned tags
View more...
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 41/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Related Questions
65 Comments
Silke Arians
If you have the SAP NetWeaver AS ABAP 7.31 with the UI Add-On, we provide a UI5 Repository based on the
BSP Repository and an Eclipse-based SAPUI5 ABAP Team Provider tool to deploy it on the ABAP server.
Best regards
Silke
Like (0)
In fact, what I wanted to show here is that is possible to try SAPUI5 even without these tools. Of course, these
tools will make our life easier.
Best regards
Christian
Like (0)
Former Member
how some can deploy a third-party script with the abap team provider? for me it does not work?!
BR,
Alex
Like (0)
Mingzuo Shen
Question:
How to show all the rows when the page is rst loaded?
Only when I click on the ‘Read (All)’ button, then all the expected rows are shown.
Like (0)
You can use the onInit method of the Controller to call the Read method.
onInit: function() {
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 43/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
},
Regards,
Christian
Like (0)
Mingzuo Shen
Like (0)
Like (0)
Regards,
Christian
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 44/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Like (0)
You can try DOM insertion using JQuery selector and manipulation.
Please try the code below using the chrome developer tools in the Shell Example.
https://sapui5.netweaver.ondemand.com/sdk/content/Controls/UX3Controls/ShellExample.html
Regards,
Christian
Like (0)
Former Member
Regards,
JHYang.
Like (0)
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 45/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
It seems that the images were deleted for some reason. I will upload again soon.
Thanks,
Christian
Like (0)
Silke Arians
As an alternative for SAP Business Suite system of version 7.00 and higher – especially until 7.31 – you may
use the interactive ABAP report /UI5/UI5_REPOSITORY_LOAD
source code repository like git, Suberversion (SVN) etc. may be used.
to the report.
Kind regards
Silke
Like (0)
Former Member
Thank you very much for the quick reply Since I found the answer earlier I deleted the question.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 46/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Like (0)
Former Member
With your tutorial, i reached till end, now when i m working on my project I am getting the following error which
I am not able to resolve:
This is coming, when I am CREATING data in SAP backend using POST action. Code for the same is:
};
oModel2.loadData(“http://****:8000/sap/bc/zdservice?sap-client=***“,
Like (0)
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 47/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
I believe the error you are getting is because you are not using the correct JSONModel. In my blog I used an
extended (custom) version of the JSONModel.
Regards,
Christian
Like (0)
Former Member
Thanks for the blog. I am able to replicate the example but I get an error at the end when trying to get data. I
am trying the scenario for nd a customer by email. and I get the below errors in IE8.
The following problem occurred: parsererror – {success: “true”, msg: “”, data: [{email:……………..}], 200,ok
Below is another error on load of page and I am seeing this in Chrome. I am wondering if the sap.ui.core.js is
not initialized properly.
Failed to load resource: the server responded with a status of 404 ((BSP) Error)
x.extend.ajax sap-ui-core.js:25
a sap-ui-core.js:69
d sap-ui-core.js:69
properties sap-ui-core.js:69
l sap-ui-core.js:69
B sap-ui-core.js:69
a sap-ui-core.js:69
sap.ui.core.Core.getLibraryResourceBundle sap-ui-core.js:69
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 48/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
sap.ui.table.Table.init Table.js:7
sap.ui.base.EventProvider.extend.constructor sap-ui-core.js:69
sap.ui.core.Element.extend.constructor sap-ui-core.js:69
f sap-ui-core.js:69
b sap-ui-core.js:69
sap.ui.jsview.createContent myview.view.js:9
sap.ui.core.Element.runWithPreprocessors sap-ui-core.js:69
sap.ui.core.mvc.JSView.onControllerConnected JSView.js:6
sap.ui.core.mvc.View._initCompositeSupport View.js:6
sap.ui.base.EventProvider.extend.constructor sap-ui-core.js:69
sap.ui.core.Element.extend.constructor sap-ui-core.js:69
f sap-ui-core.js:69
f sap-ui-core.js:69
b sap-ui-core.js:69
sap.ui.view View.js:6
(anonymous function)
src=“……………./ZSAPUI5/resources/sap-ui-core.js”
I was wondering if the BSP error is causing the parsing error in JSON.
I am able to display the layout of the table which tells that the UI 5 librabry is loading but then I get the error
when I am searching.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 49/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Thanks!
Like (0)
Hope it helps.
Best regards,
Christian
Like (0)
Former Member
Like (0)
Frank Henrdz
Hi Christian , i’m just currently developing your Demo , but when i click in your link ‘with the necessary bug
xes’ the page is not active , where can i see the changes to do to the Z json class copy ? Regards Frank
Like (0)
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 50/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Former Member
Regards,
Praphull
Like (0)
It’s great to see that the blog is helpfull. Thanks for your feedback!
Best regards,
Christian
Like (0)
Former Member
Have you experimented this way of interfacing with SAP on Mobile Devices
I developed an application focused for Mobile devices and in my “HANDLE_REQUEST” method I handle a few
di erent “verbs” I have “GET” “NEW” and “SEND”. I then tested on di erent devices.
For Blackberry devices it seem the “VERB” is always “GET” when it reaches SAP. Have you or anyone else
experienced the same issue? Is there something di erent i need to do in the JSON model?
Christiaan
Like (0)
Why are you using these verbs? To be honest I never saw the use of “NEW” and “SEND” verbs. Actually I don’t
even know if they really exist. I would like to ask you to check the information in the following link:
http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods
Regards,
Christian
Like (0)
Former Member
Although you can use any descriptive name for your HTTP request method, it is not always supported supported. I quote from
you link “Any client can use any method and the server can be configured to support any combination of methods.“
http://www.mnot.net/javascript/xmlhttprequest/
Like (0)
Prabaharan Asokan
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 52/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Christian,
Prabaharan
Like (0)
Yes, there are too many les to upload, especially if you are uploading the demokit.
Regards,
Christian
Like (0)
I am having a problem in the last step. I implemented Create: function() in main.controller.js. When I click the
button, there is no response. It does not open dialog box. The same happens for nd button.
When I click read, update or delete, it shows “no raw selected” which is acceptable as there is no record on the
display.
From BSP Application, there is no response of any button. I created a sample button on index.html. Even that
button is not being displayed.
Even In Postman-chrome, I am not able to see data when I call any method. But When I call “Post”, data is
being uploaded in table. So method are supposed to be working. But display is not proper.
Thank you.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 53/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Meet Vajaria
Like (0)
In order to help you I really need detailed information about the error.
I suggest you to put an external breakpoint in the handle_request method to identify why the service is not
returning any data.
Best regards,
Christian
Like (0)
Thank you
Meet Vajaria
Like (0)
Holger Stumm
this is such a great blog. I have a lot of customers that are far away from 7.3, but still want to use this
technology.
Super Great!!
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 54/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
cheers
Holger
Like (0)
Regards,
Christian
Like (0)
Former Member
Regards,
Mateusz
Like (0)
http://scn.sap.com/community/developer-center/front-end
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 55/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Regards,
Christian
Like (0)
Former Member
Like (0)
Frank Henrdz
Hi Julio, in wich part of http://www.sapui5.org/sapui5blogs/tools-sdk/ are located the ui5 les to download
? Regards Frank
Like (0)
Frank Henrdz
Regards
Frank
Like (0)
Former Member
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 56/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
greate tutorial!
i develope with eclipse and the abap team provider toolkit, to submit my project on the server. i do exactly
what you wrote ( add a new folder “js” insert the script, which i have downloaded). but after upload, the le
/folder has not be uploaded. is there something else to do?
regards,
Alex
Like (0)
Thanks for your feedback. Sorry for the late reply but i didn’t see your question before. I use eclipse for sapui5
developments but i’m not using the abap team provider tool. Do you still have the problem or you already
managed to solve it?
Regards,
Christian
Like (0)
Martin English
Excellent work. I have used these blogs as the foundation (perhaps even most of) a DemoJam for this year’s
Melbourne SIT. Now, deploying SAPUI5 on an ABAP server implies (at the very least)
a) The system has the appropriate levels of other support packs (see note),
b) A Maintenance Certi cate so you can load the UI5 Add-on via he SAINT transaction,
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 57/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
I was able to create the web portion (the presentation layer, for want of a better word) using Eclipse, and
deploy it using Apache, all on my laptop, but my challenge is that I am ‘resting between engagements’, and
don’t have (legal / licensed) access to a full ABAP system.
Solving this has the bene t being that someone new to ABAP would also be able to experiment with UI5 with
the tools available to a stand-alone developer; I’m talking here about the sort of person who would not only not
have access to SAP licenses, but wouldn’t even have an S number to access the SAP Market Place, let alone
have the network or knowledge to access the UI5 Add-on, let alone install it.
The short version is that I downloaded OPEN UI, unzipped it to the le system of my NW702 SP06 Developers
edition and made the resulting le system available via HTPP by use of the icm/HTTP/ le_access_1 pro le
parameter. I imported my Eclipse project les into my ABAP server via cut-and-paste for the index.html, and
BSP_UPDATE_MIMEREPOS for the JS components and it works perfectly.
1. production landscapes where you can’t get access to SAINT (and Solution manager) to import the ABAP
runtime components
2. production landscapes that don’t meet the requirements of the SAP UI5 Add-on
3. and SAP Developer Editions, where you don’t get a maintenance certi cate.
There is also the implication that you can use the same technique for legacy systems (4.6 / 4.7); However, I
need access to such a system to test that.
hth
Like (0)
I’m really glad to see that this blog is being useful for you as much as it was for myself.
I didn’t know about the icm/HTTP/ le_access_1 pro le parameter. How does it works when you have multiple Web
Application Servers?
Regards,
Christian
Like (0)
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 58/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Martin English
two points;
First, I have only just realised I don’t need the icm/HTTP/ le_access_1 pro le parameter, because I don’t need
to access the OpenUI5 library on my server. I can ensure I’m using the latest library using
src=’https://openui5.hana.ondemand.com/resources/sap-ui-core.js‘
Say we install two ABAP systems on the same server (call the server martin). They will need di erent system
IDs (lets say N72 and N74). They will also need di erent system numbers, so lets install N72 as system number
00 and N74 as system number 10.
Using RZ10, looking at the instance pro le (which will be N72_DVEBMGS00_MARTIN and
N74_DVEBMGS10_MARTIN depending on which system you are logged on to), we will see that the
icm/server_port_0 setting is the default PROT=HTTP,PORT=80$$. The $$ is a placeholder for the system
number.
if you have
icm/HTTP/ le_access_1 =
PREFIX=/N72ui5/,DOCROOT=E:\usr\sap\openui5,BROWSEDIR=2,CACHECTRL=0
icm/HTTP/ le_access_1 =
PREFIX=/N74ui5/,DOCROOT=E:\usr\sap\openui5,BROWSEDIR=2,CACHECTRL=0
the following URLS will access the same le system on the server
http://martin.<domain-name>.<tld>:8000/N72ui5/ and
http://martin.<domain-name>.<tld>:8010/N74ui5/
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 59/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
HTH
Like (0)
Like (0)
Martin English
Like (0)
Regards,
Christian
Like (0)
Former Member
Can i suggest for the “Read” method, that the cache be set to false?
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 60/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
I was having issues getting the latest records after an update/delete/creation operation as the browser still caches
the old records.
Like (0)
Yes, sure, suggestions are always welcome. I had the same issues .
But instead of passing all these parameters I decided to change the loadDataNew method by setting the default
value of the parameter bCache to false.
bCache = false;
Regards,
Christian
Like (0)
Former Member
I tested your sample. But I can’t consume the REST service directly:
Old.
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 61/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
New.
Regards,
Roger
Like (0)
Sorry, but I didn’t get what is wrong. Please provide more information about the error. You can get it using the
developer tools of your browser. It can be a CORS (Cross-Origin Resource Sharing) issue.
Regards,
Christian
Like (0)
Former Member
I want to use directly the SAP url REST service in my HTML5 application. It means :
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 62/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Regards.
Roger
Like (0)
Ok, but what I need to know is why you can’t do that. The only di erence is that you are using an absolute URL
while I used a relative URL. The only thing that can prevent you from calling your REST service using the
absolute URL is CORS (if your web application is hosted in server that is not the same of the service).
Like (0)
thanks a lot for all the hard work you´ve done to create these series in a didatic form.
It really takes a lot of time to upload the ui5 les to the mime repository but it is worth the e ort.
Best regards!
Like (0)
Yes, it takes a lot of time but if you have access to the operating system and permission to change the system
pro le, you can do what Martin English did in his blog to make UI5 available on the server.A Simple UI5
application running against ABAP without the SAP UI5 Add-on
Best regards,
Christian
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 63/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Like (0)
thanks again for referring to Martin´s tutorial. I do not know much about basis so I have never heard about
using pro le parameter icm/HTTP/ le_access_1. But it is very practical and useful to reuse the ui5 library
through the WAS.
Best Regards.
Like (0)
Former Member
Super blog…I am getting time out error in ICF call. We have change the Keep Alive to 240 and Proc.Timeout to 900 but still we are
getting time out error. Please suggest.
Regards,
Sid
Like (0)
Have you tried to access another service or bsp application of your system? Have you tried to put an external
breakpoint to make sure that the timeout is not being caused by your code?
Regards,
Christian
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 64/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Like (0)
Former Member
Front end is dot Net. There is no error log with time out in st22 so please con rm whether time out error will be
logged in st22 or not.
Regards,
Sid
Like (0)
I believe that ICM timeouts are not logged in ST22. I suggest you to put an external breakpoint for the user that
you are using to connect to the service to make sure that the HTTP calls are reaching it.
Regards,
Christian
Like (0)
Former Member
I already tried, http call is reaching the service but we are getting timeout error before the service is executed
completely.
Regards,
Sid
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 65/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Like (0)
Ok, have you tried to increase the timeout on the client side?
Like (0)
Former Member
It’s working now. We changed the timeout to – 1(in nite ie till we get response ) in front end. Thanks for your
support.
Regards,
Sid
Like (0)
Former Member
With your tutorial, i reached till end, now when i m working on my project I am getting the following error which I am not able to
resolve:
Like (0)
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 66/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
Vadim Zaripov
Hi Christian,
There seems to be an error in Create function, the Dialog call should be “oDialog.open();” not “Dialog.open();”.
Thanks, Vadim.
Like (0)
Former Member
headers : {
“X-Requested-With” :
“XMLHttpRequest”,
“Content-Type” :
“application/atom+xml”,
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 67/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
}
},
header_xcsrf_token =
response.headers[‘x-csrf-token’];
oHeaders = {
};
OData.request({
},
function(data,request) {
// loadAttachment();
},
function(err){
sap.m.MessageToast.show(“Couldn’t Deleted due to following
exception : “+ err);
});
},
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 68/70
3/27/2019 Building a CRUD Application with SAPUI5 and ICF REST/JSON Service – Part 3 | SAP Blogs
function(err) {
});
Regards,MBR
Like (0)
Former Member
A question, erroja me this message when I run the program and pressed the Create button in Chrome:
Uncaught Error: “true” is of type string, expected boolean for property “modal” of Element
sap.ui.commons.Dialog#Dialog
Like (0)
Matthias Schmalz
these instructions are really outdated and not recommended. Since years there’s a better mechanism for this,
e.g. see https://sapui5.hana.ondemand.com/#/topic/a560bd6ed4654fd1b338df065d331872
Best regards
Matthias
Like (0)
Sitemap Newsletter
https://blogs.sap.com/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service-part-3/ 70/70