Skip to Content
Technical Articles
Author's profile photo Shilpa Basavaraj

Simple Annotation in OData to get the ID and the corresponding description in the same column of UI5 Smart Table

Introduction:

Annotation in ABAP OData is a characteristic which adds additional feature to the metadata element such as entity, property,etc.. Here in this blog post you are going to learn about the ‘Text’ annotation which brings more look and feel and value added service to the UI Smart Table.

 

Points to Note:

  1. OData project should be of type – Service with Vocabulary-Based Annotations
  2. Import the vocabulary in the OData – Right click on Data Model -> Import -> Vocabulary

In this list, select the vocabulary /IWBEP/VOC_COMMON

  1. Import the DDIC structure and the properties which must be in your Entity.

Follow the below steps:

Step 1: Firstly, the Smart table looks like as in the below screenshot, with a normal entity called in the UI.

 

Step 2: Now let’s add an annotation in OData:

Go to Properties of the entity -> Annotations -> Select com.sap.vocabularies.Common.v1

 

Step 3: It will go to the below screen. Here select the Text for User ID property and click on Create Annotation.  Select ‘Path’ under Expression Kind and enter the description required for User_ID i.e., USER_NAME property in the entity.

 

Step 4: Save the project and Generate Runtime Objects.

Now your Smart Table data looks like as below with the User ID and the User Name appearing in a single column

 

Conclusion:

Displaying the User ID and the User Name in the same column of the Smart table gives the user new look an feelNow you can hide the User Name column in the smart table, as the User ID field shows the User Name too, in the format User_Name(User_ID).

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Wang Tao
      Wang Tao

      it's usefully,thanks.

      Author's profile photo Rudramani Pandey
      Rudramani Pandey

      It worked for me too. Thanks!

      Author's profile photo Aditi Bhargava
      Aditi Bhargava

      Hi Shilpa,

       

      very useful blog. Can you please share the final metadata ( annotations) that were generated.

      Author's profile photo kinryou bu
      kinryou bu

      Hi Shilpa,

      Very useful Can you share how to use OData metadata to generate fiori images Appreciate it