Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

In the following post we are going to see how to use the table UI element with cell variant. The purpose of cell variant is to determine what is the cell editor supposed to be displayed in a particular column of the cell. If you ask me is it possible whether in particular column of the table can a first row be displayed as button UI element and the second row to be displayed as link to action UI element my answer would be yes we could do it with the help of cell variant. 

Scenario :  Let us consider that there is a requirement where in you want to display the link to action only to certains rows of the column based upon a condition.  Before starting to develop the component let us discuss a bit on how the cell variant works. If you have worked with table UI element before you must be aware of how the table is created with its no of columns.

1

Now you must be clear that the type of UI element the cell editor holds will be displayed on the screen. Now for our requirement we need two types of UI element(Link to action and text view) to be the cell editor out of which one has to be simultaneously displayed as the table cell based upon the condition.  To do that we need to create a cell variant to the column and assign a type of UI element to the variant.

2

Step 1 : Go to the Tcode SE80 and create a webdynpro component.

3

Assign the component to the package or save it in the local object.  Step 2: In the context tab of the view controller create the context node  of cardinality 0..N

with the attributes as shown below.

4

Step 3: Go to the layout tab of the view controller and insert a table UI element as shown below.

5

Right click on the tab UI element and create binding as shown below.

6

Step 4: In the properties of the Table column bind the attribute variant to the selected cell variant property.

6.1

Right click on the table column and select insert cell variant.

7

Enter the ID and the type for the cell variant.

8

Right click on the variant and insert editor to add the cell editor.

8.1

Specify the UI element type and press enter.

8.2

Bind the text property of the Link to action UI element to the field1 attribute as shown below and create an action for the link to action UI element.

8.3

8.4

Provide  variant key for the cell variant. When the context attribute binded to the selected cell variant property of the table column contains this value entered

in the table colum then the system displays the UI element(Link to action) specified in the variant.

9

Step 5: Go to the methods tab of the view controller and in the doinit method initialize the values for the context attributes.  Set the context node as table operation.

10

Code will be generated as below.

11

Note: I have removed the unwanted codes.  Modify the code as below. Passing the variant to the cell makes the difference.

12

Save and activate the whole component.  Step 6: Create an webdynpro application to test the component.

13

Output:

14

Labels in this area