Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

add heading for every line in cl_salv_tree=>factory in sap abap

former_member917803
Discoverer
0 Kudos

Hi,

I am using cl_salv_tree=>factory method, I have 3 line items with different structures and different fields. Is it possible to display field names in header for every line.

HDRFLD1 HDRFLD2 HDRFLD3

EX: header 01 12 13 14

ITMFLD1 ITMFLD2 ITMFLD3

ITEM1 AA BB CC

ITEM2 DD EE FF

2 REPLIES 2

former_member751591
Participant
0 Kudos

Welcome and thanks for visiting SAP Community to get answers to your questions. Check out our tutorial to get started in SAP Community.

By adding a picture to your profile you encourage readers to respond to your question. Learn more about your Profile here.

Sandra_Rossi
Active Contributor

ALV Tree (CL_SALV_TREE) is a grid which contains a hierarchy in the left column, plus additional columns which are common to all the lines. You cannot customize it.

|- root 1              AAAAAAAA BBBBBB CCCCCCCCCCCCC
|  |- child 1.1        AAAAAAAA BBBBBB CCCCCCCCCCCCC
|  |  |- child 1.1.1   AAAAAAAA BBBBBB CCCCCCCCCCCCC
|  |- child 1.2        AAAAAAAA BBBBBB CCCCCCCCCCCCC
|- root 2              AAAAAAAA BBBBBB CCCCCCCCCCCCC
|  |- child 2.1        AAAAAAAA BBBBBB CCCCCCCCCCCCC

ALV Hierarchical-Sequential List (CL_SALV_HIERSEQ_TABLE) can be used to display maximum two different structures, coming from two internal tables, one "leading" and one "subordinate", and you indicate which fields are used to join the 2 internal tables. You can't have 3 internal tables.

|- leading 1 AAAAAAAA BBBBBB CCCCCCCCCCCCC
|  |- subordinate 1.1  DDDDDDDD EEEEEEE FFFFFFFFF
|  |- subordinate 1.2  DDDDDDDD EEEEEEE FFFFFFFFF
|- leading 2 AAAAAAAA BBBBBB CCCCCCCCCCCCC
|  |- subordinate 2.1  DDDDDDDD EEEEEEE FFFFFFFFF
|  |- subordinate 2.2  DDDDDDDD EEEEEEE FFFFFFFFF

The List Tree control can be used to display fields as you want, but you don't benefit of ALV features:

|- root 1 AAAAAAAA BBBBBB CCCCCCCCCCCCC
|  |- leaf 1.1  DDDDDDDD EEEEEEE FFFFFFFFF
|  |  |- leaf 1.1.1  GGG HHHHHH IIIIIIIIIII JJJJJJJJJJJJ
|  |- leaf 1.2  KKKKKK LLLLLLLLLLL
|- root 2 MMMMMMM NNNNNNNNNN
|  |- leaf 2.1  OOOOOO PPPPPPPPPPPPPP
|  |- leaf 2.2  QQQQQQQQQ RRRRRR SSSSSSSSSSSSS