Applying sorting and subtotaling to table fields

In this recipe, we will see how we can sort a given table within the Smart Form and calculate totals based on a particular field as the sort criterion. In this recipe, we will use an example of employees and their allowances and amounts.

Getting ready

For this recipe, we define a structure in the database ZST9_EMPLOYEES comprising three fields PERNR, ALLOWANCE, and AMOUNT. We define a table type also based on this structure, as shown in the following screenshot:

Getting ready

A table EMPLOYEE_TABLE (based on the defined dictionary table type) is included in the TABLES tab of the Smart Form interface, and a corresponding ...

Get SAP ABAP Advanced Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.