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

CL_SALV_TREE Agregation

former_member184386
Active Participant
0 Likes
1,659

Hi guys, I have created an hierarchical ALV tree using CL_SALV_TREE but having problem when doing aggregation...

The hierarchy consists of the Org Unit and the Org Units below it, if no aggregation it will look something like this, no problem...

Org. Unit           No. of Emloyees

001                         10

    011                        5

    012                        2

002                            5

     021                       1

     022                       3

-----

Here's the problem, if aggregation is turned on, it will look something like this, it seems that the top Org Unit is overwritten with the total from the below Org Units and doesn't count the top level.

Org. Unit           No. of Emloyees

001                            7

    011                        5

    012                        2

002                            4

     021                       1

     022                       3

Any help is greatly appreciated.

Thanks!

1 ACCEPTED SOLUTION
Read only

former_member184386
Active Participant
0 Likes
1,487

Ok, sorry guys, I thought nobody has encountered this issue before and I thought the requirement was unique to our company.

Anyways, I sent an OSS message to SAP and explained that this could be bug with the ALV Tree system but they came back and said that it is the standard behavior and therefore not going to do anything, as always.

So what I did to resolve it is to append another record in the hierarchy with the same node and parent, so if the original hierarchy looks like this"

NodeParent
001
011001
012001

The new hierarchy will look like this (notice the new record added to the bottom of the table), but you only do this if the user selected or turn "ON" the aggregation, otherwise the above hierarchy is used:

Header 1Header 2
001
011001
012001
001001

This method will duplicate the parent node details but you can always control this in your code.

If you have any question just let me know.

Regards,

Ricky Orea

Hi guys, I have created an hierarchical ALV tree using CL_SALV_TREE but having problem when doing aggregation...

The hierarchy consists of the Org Unit and the Org Units below it, if no aggregation it will look something like this, no problem...

Org. Unit           No. of Emloyees

001                         10

    011                        5

    012                        2

002                            5

     021                       1

     022                       3

-----

Here's the problem, if aggregation is turned on, it will look something like this, it seems that the top Org Unit is overwritten with the total from the below Org Units and doesn't count the top level.

Org. Unit           No. of Emloyees

001                            7

    011                        5

    012                        2

002                            4

     021                       1

     022                       3

Any help is greatly appreciated.

Thanks!

8 REPLIES 8
Read only

former_member184158
Active Contributor
0 Likes
1,487

Hi Ricky,

if the Org. Unit as text/char, so it does the agregation 001 ,011,012,013,014   etc.

so I think, it should be numc, or integer .

just try this out to change the date element which has domain numc or integer,

Regrads

Ibr

Read only

0 Likes
1,487

Hi LBR, I was only referring to the "no. of employees" sorry for not specifying. I highlighted it in blue. Like what I said it's actually doing the aggregation but with an issue, please refer to the explaination above...Thanks...:)

Read only

former_member184386
Active Participant
0 Likes
1,487

Resolved it on my own...

Read only

0 Likes
1,487

Hi Ricky,

could you tell us please how?

Read only

0 Likes
1,487

You posted your question because you wanted the community to help you. Now you have resolved it, it is only fair that you share the answer with the community and help others.

This site is about helping on another - giving and receiving. Not just receiving.

Read only

0 Likes
1,487

Hi Ebrahim, I posted my reply on the original post...

Regards,

Ricky

Read only

0 Likes
1,487

Hi Matthew I posted my reply on the original post...

Regards,

Ricky

Read only

former_member184386
Active Participant
0 Likes
1,488

Ok, sorry guys, I thought nobody has encountered this issue before and I thought the requirement was unique to our company.

Anyways, I sent an OSS message to SAP and explained that this could be bug with the ALV Tree system but they came back and said that it is the standard behavior and therefore not going to do anything, as always.

So what I did to resolve it is to append another record in the hierarchy with the same node and parent, so if the original hierarchy looks like this"

NodeParent
001
011001
012001

The new hierarchy will look like this (notice the new record added to the bottom of the table), but you only do this if the user selected or turn "ON" the aggregation, otherwise the above hierarchy is used:

Header 1Header 2
001
011001
012001
001001

This method will duplicate the parent node details but you can always control this in your code.

If you have any question just let me know.

Regards,

Ricky Orea