Application Development and Automation 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: 
Read only

Change Header Data in ALV Tree

Karan_Chopra_
Active Participant
0 Likes
2,973

I have a ALV Tree in which I hav the folowing requiment

Suppose I have a table

Prog          Standard                       effectivity
L                  ST1                          aaaaa
L                  ST1                          bbbbbb
L                  ST1                          vvvvvv
R                  ST1                           bbbbbb



But I hav to display it as 

-->L          ST1                                                (Header)
                                                  aaaaa
                                                  bbbbb
                                                  vvvvv
-->R         ST1                                  bbbbb          (Header)   --> as row has single value

Here ---> is the node

As u can see I hav to display first two colunms only in the header row

and next field in child but if row has one value as in case where Prog is R then all the fields are in header

Plz tll me how can I change header content

also in some case i hav to display *** in header for multiple values

I can only see in examples where Header contains Sum of numeric fields

1 ACCEPTED SOLUTION
Read only

Karan_Chopra_
Active Participant
0 Likes
2,205

Hi Nisha

I have already reffered to those programs in detail

but in them only calculations are updated in the header rows e.g adding of all subtree rows in header

but my case is different as u can see in the first post , my columns cannot be added they are alpanumerin and according to their values i have to update in the header.

 for example if my column has values 

            a
            b
            b
            d  
then header will be a/b/d
or 
            a
            b
            b
then header will be a//b

Or u can say it will have custom values and there is nothing like that in SAP code examples

I have a ALV Tree in which I hav the folowing requiment

Suppose I have a table

Prog          Standard                       effectivity
L                  ST1                          aaaaa
L                  ST1                          bbbbbb
L                  ST1                          vvvvvv
R                  ST1                           bbbbbb



But I hav to display it as 

-->L          ST1                                                (Header)
                                                  aaaaa
                                                  bbbbb
                                                  vvvvv
-->R         ST1                                  bbbbb          (Header)   --> as row has single value

Here ---> is the node

As u can see I hav to display first two colunms only in the header row

and next field in child but if row has one value as in case where Prog is R then all the fields are in header

Plz tll me how can I change header content

also in some case i hav to display *** in header for multiple values

I can only see in examples where Header contains Sum of numeric fields

14 REPLIES 14
Read only

Karan_Chopra_
Active Participant
0 Likes
2,205

Plz Help guys

is it that difficult??

Edited by: Karan Chopra on Jun 30, 2010 8:42 PM

Read only

Karan_Chopra_
Active Participant
0 Likes
2,205

Can any one help me out ????

Read only

0 Likes
2,205

you use collect statement in your header...???

show me ur code....!

Read only

Karan_Chopra_
Active Participant
0 Likes
2,205

I have not used collect statement

the thing is normally on expantion column values are displayed for every child row but I want to display all those values in header only and that is for the columns which are not included in Header Node ...

Read only

Karan_Chopra_
Active Participant
0 Likes
2,205

ht[http://tinypic.com/r/vxkrva/6|http://tinypic.com/r/vxkrva/6]

This is a link for reference here for first 2 columns values will be displayed in header and for rest it will have ** if it has multiple values and value if it has single value

Read only

former_member15255
Active Participant
0 Likes
2,205

Hello,

Please refer to this program BCALV_TEST_HIERSEQ_LIST this should help to solve your requirement of header and item

Please look at the exporting paramters which states the header and item level

i_tabname_header = 'GT_MASTER'

i_tabname_item = 'GT_SLAVE'

and subtotal based on the header data

regards

suresh nair

Read only

Karan_Chopra_
Active Participant
0 Likes
2,205

This is heirarchy List But i want tree alv

Read only

0 Likes
2,205

Hi Karan,

Check BCALV_TREE_* programs.

You will easily understand BCALV_TREE_01 program.

Regards,

Nisha Vengal.

Read only

Karan_Chopra_
Active Participant
0 Likes
2,205

How can I change the data for every header row column in tree ALV

You can see the example in first column.

Plz help ....

Edited by: Karan Chopra on Jul 7, 2010 10:35 AM

Read only

Karan_Chopra_
Active Participant
0 Likes
2,205

plz help

Edited by: Karan Chopra on Jul 8, 2010 9:36 AM

Read only

0 Likes
2,205

Hi Karan,

Did you check the program I referred?

Please try to understand how it works.

Let me know incase you dont understand some code.

In ALV tree, you can manipulate each row to be displayed.

All the rows displayed will be part of a internal table.

Depending on how you fill internal table, you can change your output display.

Regards,

Nisha Vengal.

Read only

Karan_Chopra_
Active Participant
0 Likes
2,206

Hi Nisha

I have already reffered to those programs in detail

but in them only calculations are updated in the header rows e.g adding of all subtree rows in header

but my case is different as u can see in the first post , my columns cannot be added they are alpanumerin and according to their values i have to update in the header.

 for example if my column has values 

            a
            b
            b
            d  
then header will be a/b/d
or 
            a
            b
            b
then header will be a//b

Or u can say it will have custom values and there is nothing like that in SAP code examples

Read only

0 Likes
2,205

Hi Karan,

Each row gets added because of this method call.

call method g_alv_tree->add_node

exporting

i_relat_node_key = p_relat_key

i_relationship = cl_gui_column_tree=>relat_last_child

i_node_text = l_node_text

is_outtab_line = ls_sflight

importing

e_new_node_key = p_node_key.

You have got the power to populate ls_sflight, in whichever way you want.

First, what you need to do is, you need to create an internal table with rows having data similar to your final display.

Then LOOP at that internal table, and add WORK AREA to ALV TREE.

So your internal table should be manipulated as:

Column 1 Column 2

Row 1 a/b/d orange/red/violet

Row 2 a orange

Row 3 b red

Row 4 d violet

You need to write code for getting row 1 (like in this case, write CONCATENATE).

If its to find TOTAL of rows, we have option to provide in fieldcatalog.

Since your case is to populate characters, you need to explicitly pass the header data.

Regards,

Nisha Vengal.

Read only

Karan_Chopra_
Active Participant
0 Likes
2,205

Hey Nisha

thanks a lot u solved my problem.....!!!

Although I did this yesterday but was doing it a wrong way ...

rewarded u all points ...!!!