Acorel
To Acorel.nl
Acorel background

Adding a calculated field to the screen using the AET

Pieter Rijlaarsdam, 14 September 2011
A couple of weeks ago the new features of the Application Enhancement Tool (AET) in SAP CRM 7.0 EhP1 have been listed in this blog. One of these new features is the possibility to add a calculated field to the screen using the AET.

Adding a calculated field to the screen works the same way you would add a ‘normal’ field in the AET. The following example demonstrates adding a formatted address field to the account overview screen. This formatted address field will contain the combination of the street and the house number.
Obviously, there are easier and probably better ways to define a formatted address in SAP CRM, but this example is just created to demonstrate the features of a calculated field. 
The AET tool was started from the account overview screen. From there, you choose to create a new field. After selecting the appropriate object and part, a popup is displayed where the details of the new field can be entered. Notice the ‘Calculated (read-only)’ checkbox on the top left position of the Details assignment block. This is a new option in SAP CRM 7.0 EhP1.
Define the field label, field type and length for the new field as shown in the previous screen shot and select the ‘Calculated (read-only)’ checkbox. Selecting this checkbox will open a new assignment block ‘Calculated Field Value’ in the same popup screen. 
This assignment block shows the formula of the calculated field on the top. A formula will consist of the combination of operations and variables. The available operations are shown on the left side, directly below the formula. A number of operations is provided by the standard SAP delivery. These operations are grouped by logical operation types, such as mathematical or character string functions. The variables (basically BOL attributes) are available on the right side. Again, a large number of these variables is provided by the standard SAP delivery, others can be added in customizing. Finally, a check option is provided to check the formula before actually saving it. 
The formula in this example uses the following operations: 
GET_FIRST_STRING – Return the string value of the first record of a table. This operation retrieves the first string value for both the street and the house number, as these fields are derived from the address relations of this account (Note: as multiple addresses are saved for an account, retrieving the first record might not always result in the preferred address, it will simply pick the first address record that is found). 
CONCATENATE – Concatenates two character strings. This operation is used twice in this example. At first, it is used to combine the house number with a leading space. Secondly, it is used to combine the street name with the result of the previous concatenation. 
Once the formula is completed and checked, go back to open the configuration screen and save/generate the new field. Add the new field to an assignment block in the view configuration for your role configuration key and the calculated formatted address is shown on the account overview screen. 

Pieter Rijlaarsdam

Read all my blogs

Receive our weekly blog by email?
Subscribe here: