sapdev logo background
sapdev logo sapdev logo
Comments

ABAP ALV Tree tutorial to create a fully working ALV Tree Control objects demo SAP program




The ALV tree report produces 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

<---Return to ALV tree menu




comments powered by Disqus