Launch an XLSX Workbench, and create a new form with name ORGUNIT_HIERARCHY_1 .
Assign a context CL_HRPAYNA_GUI_ALV_TREE to the form.
When an automatically creation of the Form structure will be prompted, you should press the button
to create a structure manually.
Markup an Excel-template as shown below :
Go to Excel menu: Data > Outline and uncheck the checkboxes in the popup-window (if they are set):
Add the component «Tree» under the component «Sheet»:
Assign component «Tree» to the marked-up area of Excel-template :
Assign component «Tree» to the context root node :
Form is ready to use.
This example explains that, it is enough a single component «Tree» to insert an CL_GUI_ALV_TREE into the Printing form.
You only need to assign «Tree» to the the template area and assign «Tree» to the CL_HRPAYNA_GUI_ALV_TREE (CL_GUI_ALV_TREE) of context.
There are many formatting options available in the Properties tab for the «Tree» component :
ALV Tree Excel SAP ABAP