Skip to Content
Author's profile photo Amy King

Using Cell Variants to Dynamically Assign Search Helps in a Table

Overview

The TableStandardCell UI element can be used to create table cell variants so that a different table cell is displayed in a column for each row depending upon a dynamic condition. This ability is particularly useful for displaying a different search help in a table cell according to a user selection in another field.

Scenario

The user may enter account assignment using any combination of three cost object types, Cost Center, Internal Order or WBS Element, and you need to provide an appropriate search help in the cost object field according to the selected cost object type.

cellvariant_initial.PNG

Procedure

1.0 Define a Context Node

Define a context node ACCOUNT_ASSIGNMENT with Cardinality 1..n and Selection 0..1. Add the following five attributes.

Attribute Name Attribute Description Suggested Type Assignment Dictionary Search Help
KONTY Cost Object Type

ZKONTY*

*In this example, we have used a custom Type Assignment, ZKONTY, whose underlying domain contains a fixed value set for use by the table cell’s DropDownByKey, but you may use any appropriate Type Assignment, e.g., KONTY.
PROZS Percent Allocation PROZS [None]
KOSTL Cost Center KOSTL KOST
AUFNR Internal Order AUFNR COBL_EX_ORDE
PS_PSP_PNR WBS Element PS_PSP_PNR COBL_EX_PRPM

2.0 Create a Table UI Element

Create in the view a Table with the following UI elements.

2.1 Create TableColumn TABLE_KONTY, and insert into the column a cell editor, TABLE_KONTY_EDITOR, of type DropDownByKey. Bind its selectedKey property to context attribute ACCOUNT_ASSIGNMENT.KONTY.

2.2 Create TableColumn TABLE_COST_OBJECT, and assign its selectedCellVariant property to context attribute ACCOUNT_ASSIGNMENT.KONTY. Insert into the column three TableStandardCell elements, one for each of the cost object types Cost Center, Internal Order and WBS Element. For each TableStandardCell, assign its variantKey property according to the KONTY value that corresponds to the cost object type. For example,

TableStandardCell ID Cost Object Type Corresponding KONTY Value TableStandardCell variantKey
VARIANT_COST_CENTER Cost Center KS KS
VARIANT_INTERNAL_ORDER Internal Order OR OR
VARIANT_WBS WBS Element PR PR

cellvariant_variantkey.PNG

2.3 Insert into each TableStandardCell an InputField editor. Bind the value property of each InputField to the corresponding attribute of context node ACCOUNT_ASSIGNMENT.

TableStandardCell Editor ID Value Property Binding
VARIANT_COST_CENTER_EDITOR ACCOUNT_ASSIGNMENT.KOSTL
VARIANT_INTERNAL_ORDER_EDITOR ACCOUNT_ASSIGNMENT.AUFNR
VARIANT_WBS_EDITOR ACCOUNT_ASSIGNMENT.PS_PSP_PNR

cellvariant_varianteditor.PNG

2.4 Create TableColumn TABLE_PROZS, and insert into the column a cell editor, TABLE_PROZS_EDITOR, of type InputField. Bind its value property to context attribute ACCOUNT_ASSIGNMENT.PROZS.

3.0 Trigger Cell Variant Assignment

The final step is to create an action that will assign the corresponding cell variant when the user selects a cost object type from the DropDownByKey field. In the TABLE_KONTY_EDITOR DropDownByKey element, create a new action, ASSIGN_CELL_VARIANT, for the onSelect event. The method ONACTIONASSIGN_CELL_VARIANT may be left blank, however it is necessary to trigger an action in order for the cost object type selected by the user to prompt assignment of the appropriate TableStandardCell variant.

cellvariant_onselect.PNG

Result

Now when the user selects a cost object type from the DropDownByKey field, the corresponding cell variant is displayed in the Cost Object column along with the appropriate search help for each cost object type.

cellvariant_costcenter.PNGcellvariant_intorder.PNGcellvariant_wbs.PNG

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.