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: 

Alternate row Addition in ALV

rajesh_akarte2
Active Participant
0 Kudos

HI friends,

I have come across a situation where I have to sum the alternate rows for a column in ALV display.

Can somebody help me to resolve this problem..

Thanks in Advance

Regards,

Rajesh

Edited by: Rajesh Akarte on May 16, 2008 10:16 AM

4 REPLIES 4

Former Member
0 Kudos

you do the calculation manually....

and either put the total at the end of itab.. as a line of itab..

or display the total in the footer

Former Member
0 Kudos

Before displaying the internale table in ALV, can you add it ?

If yes..then apply this logic.

CLEAR W_FLAG.

LOOP AT ITAB.

IF W_FLAG IS INITIAL..

W_SUM = ITAB-VALUE + W_SUM.

W_FLAG = 'X'.

ELSE.

CLEAR W_FLAG.

ENDIF.

ENDLOOP.

And while displaying ALV, add a last record with this value.

Edited by: Swastik Bharati on May 16, 2008 10:28 AM

0 Kudos

Hi friends,

Thanks for the reply..Yes even I had thought the same thing .But as I am doing both sub total and total.

So I may need to high light the sub total row..So that user can easily identify..

Is there any suggestion..plz guide me.

0 Kudos

ALV does not have such functionality to add alternate records. You do that programatically and add sub total and total records into internal table. Regarding coloring the rows, you can use ALV functionality to color the rows.