
CREATING A TABLE

enter the info
here we will create field and we will give data element.





Table

enhancement of data


select data class

table entries

table data

project created

now your project will look like this



Select table name and click next


runtime artifacts generated


Fill like this.

Now project look like this .


Write this code in execute_action method.


open vs code--- click on view---then command palette---then explore and install generator.

install all generator

select basic


json model

Here “data” is named model.
<mvc:View xmlns:core="sap.ui.core" controllerName="functionimport.controller.Home"
xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m">
<App >
<Page id="page" title="{i18n>title}">
<customHeader>
<Bar >
<contentLeft>
<Label />
<Title text="Designation"/>
<Select selectedKey="SELECT" id="designationsearchid" change="onPress">
<items>
<core:Item text="-----Select one------" key="SELECT"></core:Item>
<core:Item text="DEVELOPER" key="DEVELOPER"></core:Item>
<core:Item text="TESTER" key="TESTER"></core:Item>
</items>
</Select>
</contentLeft>
</Bar>
</customHeader>
<content>
<Table items="{data>/}">
<columns>
<Column >
<Text text="NAME"></Text>
</Column>
<Column >
<Text text="EMAIL"></Text>
</Column>
<Column >
<Text text="PHONE"></Text>
</Column>
<Column >
<Text text="AGE"></Text>
</Column>
<Column >
<Text text="DESIGNATION"></Text>
</Column>
</columns>
<items>
<ColumnListItem >
<cells>
<Text text="{data>Name}"></Text>
</cells>
<cells>
<Text text="{data>Email}"></Text>
</cells>
<cells>
<Text text="{data>Phone}"></Text>
</cells>
<cells>
<Text text="{data>Age}"></Text>
</cells>
<cells>
<Text text="{data>Designation}"></Text>
</cells>
</ColumnListItem>
</items>
</Table>
</content>
</Page>
</App>
</mvc:View>
onPress:function(){
debugger
var selectedKey=this.getView().byId("designationsearchid").getSelectedKey()
var oModel=this.getView().getModel('data')
var oContext=this;
var oDataModel=this.getOwnerComponent().getModel()
var arr=new Array();
oDataModel.callFunction(
"/ZAP_FunctionDemo", {
method:"GET",
urlParameters:{
DESIGNATION:selectedKey
},
success:function(oData,response){
arr=oData.results
oModel.setData(arr)
oContext.getView().setModel(oModel);
debugger
},
error:function(oError)
{
}
}
);
}
});

output view

on select of developer

on select of tester
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 26 | |
| 25 | |
| 21 | |
| 20 | |
| 19 | |
| 14 | |
| 14 | |
| 14 | |
| 14 | |
| 10 |