ABAP ALV Tree tutorial to create a fully working ALVTree Control SAP dynpro program



The ALV tree report produced uses OBJECT METHOD functionality in-order to produce a tree structured ALV output. The creation of an ALVtree report first requires the creation of a simple program to build the ALV details such as the fieldcatalog and to call a screen which will be used to display the ALVTree. The screen should be created with a 'custom control' where you wish the ALVtree report to appear. For the following example it will have the name 'SCREEN_CONTAINER'.

Creation of Main Program code, Data declaration and screen call
Creation of 'INCLUDES' to store ALVtree code
Create Screen along with PBO and PAI modules for screen
Define OK CODE(SY-UCOMM) variable
Add screen control to PAI module(INCLUDE Z......I01)
Create pf-status

Once you have the main program code in place to call the screen which will display the ALVtree, you now need to setup the actual ALVtree and populate it. As this is screen based(dialog) the display coding will be performed within the PBO screen module. Therefor you need to add the following processes to the PBO(STATUS_0100) module of the screen.

Create Custom control

Create the following objects step by step

Create Container
Create Object in Container
Set ALVtree table for first display
Create ALV Tree Hierarchy
Add 'does tree already exist?' check

OR!!!!! Create the following objects in one step!

ABAP code listing of PBO(..O01) and FORM(..F01) includes should now look like this

Further development to add additional functionality for user interaction, but not required for ALV tree to execute.
Change Toolbar
Register Events


More ALV Tree lessons and tutorials
If you want to break this down into more manageble chunks or see tutorials on specific ALV Tree tasks such as add button, refresh, add user interaction etc.. please go to the main ALV tree menu


Related Articles

Activate user interaction within SAP ALV tree
Add button to SAP ALV tree toolbar using ABAP code
Create ALV Tree Custom control and add to sap dynpro screen
Final ABAP code for the ALV Tree PBO(..O01) and FORM(..F01) includes
Create SAP ALV Tree Container in ABAP dynpro screen container
Create Container and Object
Create ALV tree main program including Data & Event declaration
SAP ALV Tree fieldcatalog creation
Set SAP ALV tree table for first display and user interaction
Build SAP ALV tree Hierarchy
Build SAP ALV tree Hierarchy Header
Add alv tree already exists check to pbo module
Create all includes required for the ALV tree report
Full ABAP code listing of main ALV tree program
Module creation screen
Create SAP ALV Tree object within ABAP dynpro screen container/H1>
Create ok code to store ALV tree user interaction
Example Output from ALV tree display
Create screen control
Create Screen along with PBO and PAI modules
Create Pf-status(screen menu functionality)
Refresh ALVtree
Build Report Header(Title)
ALVtree toolbar processing
Implement user defined buttons to ALVtree toolbar
ALVtree user interaction processing
Implement ALVtree user interaction processing
Setup ALVtree variant
Main Steps to create ALV simple Tree(Using Objects)
Create Add Custom control to screen
Final code for the PBO(..O01) and FORM(..F01) includes
Create Container and Object
Create and register events for user interaction
Create ALVtree Hierarchy
Add already exists check!
Create Includes for ALVtree report
Full ABAP code listing of main program
Create Container and Object
Create screen control
Example Output from ALV simple tree display
Create screen control
Create Screen along with PBO and PAI modules
Create Pf-status(screen menu functionality)