3.2.15a Export CL_GUI_ALV_TREE to the Excel (Org.unit hierarchy - each department placed on the its own worksheet)

The introduction

The example, as the previous one, demonstrates you how to insert an CL_GUI_ALV_TREE (CL_HRPAYNA_GUI_ALV_TREE) to the Excel-Form.

Let's bit complicate the previous example, so that each of top-level org.units (we call it department) will be located at its own Excel worksheet. Ubove the tree we place header, that displays a name and ID of the organizational unit.

To implement this, we create context as a table. Each row of the context refers to a new department, and therefore, it refers to the new worksheet in Excel. Thus, each row of the context will contain ALV-Tree (with department org. hierarchy), which we want to insert in the worksheet, as well as the Name/ID of organizational unit to display in the header.

Expected result:

Excel SAP ABAP ALV Tree download