Tree ALV in ABAP
Report REPORT zab_rp_tree_alv . TABLES : vbak . DATA : gt_node TYPE TABLE OF snodetext , gs_node TYPE snodetext . SELECT-OPTIONS : s_vbeln FOR vbak - vbeln . IF s_vbeln IS INITIAL . MESSAGE ' Please select sale document ' TYPE 'E' . ELSE . SELECT a ~ vbeln , b ~ posnr , b ~ matnr , b ~ kwmeng , b ~ vrkme , c ~ maktx FROM vbak AS a LEFT OUTER JOIN vbap AS b ON a ~ vbeln = b ~ vbeln INNER JOIN makt AS c ON b ~ matnr = c ~ matnr INTO TABLE @DATA ( lt_final ) WHERE a ~ vbeln IN @s_vbeln . ENDIF . gs_node - type = 'T' . gs_node - name = 'Sale Document' . gs_node - tlevel = '1' . gs_node - nlength = '20' . gs_node - color = '3' . APPEND gs_node TO gt_node . CLEAR : gs_node . LOOP AT lt_final INTO DATA ( lr_final ) . gs_node - name = 'VBELN' . gs_node - tlevel = '2' . gs_node - nlength = '20' .