Simple openUI5 application I. – How to create an OData model using SEGW transaction July 22, 2014 Peter Marcely OData , OpenUI5 / SAPUI5 Tutorial , SAP Netweaver gateway In this first part of tutorial, I am going to show how to prepare a data model using SEGW transaction. If you got stuck, you can try to look at this official document that describes the process in more details. Steps needed to create your first oData service 1. You need to prepare a database table that will be used for storing data. Below you can see the specific database table which is used in this example. 2. You need to run the transaction (t-code) SEGW and create your first project. 3. Click on Data Model > Import from DDIC structure. Follow all the steps using your created database table. At the end you should be able to see following table. Then select relevant keys and finish this process.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Simple openUI5 application I. – How to create an OData model using SEGW transaction
July 22, 2014 Peter Marcely OData, OpenUI5 / SAPUI5 Tutorial, SAP Netweaver gateway
In this first part of tutorial, I am going to show how to prepare a data model using SEGW transaction. If
you got stuck, you can try to look at this official document that describes the process in more details.
Steps needed to create your first oData service
1. You need to prepare a database table that will be used for storing data. Below you can see the
specific database table which is used in this example.
2. You need to run the transaction (t-code) SEGW and create your first project.
3. Click on Data Model > Import from DDIC structure. Follow all the steps using your created database
table. At the end you should be able to see following table. Then select relevant keys and finish this
var oTable = new sap.ui.table.Table({editable: false,toolbar: new sap.ui.commons.Toolbar({
items: [ new sap.ui.commons.Button({
text: "Create user", press: function() {
openCreateDialog();},
}),new sap.ui.commons.Button({
text: "Update user's data", press: function() {
var idx = oTable.getSelectedIndex();if (idx == -1) return;var rows = oTable.getRows();var user = rows[idx].getCells();openUpdateDialog(user);
}, }),new sap.ui.commons.Button({
text: "Delete user", press: function() {
var idx = oTable.getSelectedIndex();if (idx == -1) return;var rows = oTable.getRows();var user = rows[idx].getCells();openDeleteDialog(user[0].getValue());
}, })
]}),
}); oTable.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Email"}),template: new sap.ui.commons.TextField().bindProperty("value", "Email"),editable: false,sortProperty: "Email"
})); oTable.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Firstname"}),template: new sap.ui.commons.TextField().bindProperty("value", "Firstname"),sortProperty: "Firstname",editable: false,
})); oTable.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Lastname"}),template: new sap.ui.commons.TextField().bindProperty("value", "Lastname"),sortProperty: "Lastname",
label: new sap.ui.commons.Label({text: "Age"}),template: new sap.ui.commons.TextField().bindProperty("value", "Age"),sortProperty: "Age",editable: false,
})); oTable.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Address"}),template: new sap.ui.commons.TextField().bindProperty("value", "Address"),sortProperty: "Address",editable: false,
function openDeleteDialog(email) {var oDeleteDialog = new sap.ui.commons.Dialog();oDeleteDialog.setTitle("Delete user");var oText = new sap.ui.commons.TextView({text: "Are you sure to delete this user?"});oDeleteDialog.addContent(oText);oDeleteDialog.addButton(
new sap.ui.commons.Button({text: "Confirm", press:function(){