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: 
amy_king
Active Contributor

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.

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
KONTYCost 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.
PROZSPercent AllocationPROZS[None]
KOSTLCost CenterKOSTLKOST
AUFNRInternal OrderAUFNRCOBL_EX_ORDE
PS_PSP_PNRWBS ElementPS_PSP_PNRCOBL_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_CENTERCost CenterKSKS
VARIANT_INTERNAL_ORDERInternal OrderOROR
VARIANT_WBSWBS ElementPRPR

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_EDITORACCOUNT_ASSIGNMENT.KOSTL
VARIANT_INTERNAL_ORDER_EDITORACCOUNT_ASSIGNMENT.AUFNR
VARIANT_WBS_EDITORACCOUNT_ASSIGNMENT.PS_PSP_PNR

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.

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.

Labels in this area