Hello Fellow SCNers,

In this blog, I will demo the usage of Smart Table control including OData Metadata development and Front End application code.

Smart Table uses Vocabulary based annotations in OData.

Backend

Data Structure and Data preparation

Step 1: Go to SE11 and create a table as shown below.

Step 2: Populate the data and check.


Service Creation


Step 3: Import the highlighted vocabulary(ies) in SEGW(Project Builder Transaction). (This is a one time activity)

Step 4: Create a Service with Vocabulary Based Annotation as

Step 5: Create an Entity – SmartTable and corresponding EntitySet. These are standard steps and I am ignoring them here, though I have attached screenshot of the same.

Properties –

Step 6: Import the vocabulary in the Service as –

Step 7: Create the Line Item Annotation which is the most important one for Smart table as it will help the UI5 framework to create table structure.

Choose the line item column and then click on Create Annotation.


Step 8: Click on ‘Append Row/Create’


Step 9: Choose the highlighted type for property

Step 10: One column is created as shown below –


Do the above step for all 4 columns.

Step 11: Now the service will look like –

Step 12: Implement the Getter for Smart Table Entityset too –


Now the metadata should look like below

/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName=’%2FIWBEP%2FVOC_UI’,Version=’0001′,SAP__Origin=’LOCAL’)/$value“>

/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName=’%2FIWBEP%2FVOC_CORE’,Version=’0001′,SAP__Origin=’LOCAL’)/$value“>

/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName=’%2FIWBEP%2FVOC_COMMUNICATION’,Version=’0001′,SAP__Origin=’LOCAL’)/$value“>

Front End Code

Step 13: For sake of simplicity I have put the Smart Table in Index.html file and run it.

 

 

Smart Table

 

 

 

 

 

 

 

Final Output –

PS: You may get some errors like one shown below but it is dependent on the SAPUI5 Version. I have used 1.33.0-SNAPSHOT version but it works on 1.28 also.

I would like to thank Santhosh Gowda whose blog gave me inspiration to test this control and Arshdeep Singh for his help.

I would request you all to provide feedback and ask questions to enhance everyone’s learning.

BR,

Ankit Maskara.

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !