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: 

Regarding ALV Report

sreeramkumar_madisetty
Active Contributor
0 Kudos
98

Hi Gurus/Experts

I am doing the alv report and my requirement is as follows:

Net Value | Sales Unit

10 | pc

10 | pc

20 | kg

5 | kg

15 | gm

At the end of the report it has to be displayed as :

60 | and

20 | pc

25 | kg

15 | gm

means it has to be display the grand total and sales unit wise totals.

Please let me know the procedure .

It's little bit urgent.

Points definetely given for correct and helpful answers.

Please understand the requirement first and give the appropiate answers only.

Thanks in advance.

Regards,

Kumar

1 ACCEPTED SOLUTION

Former Member
0 Kudos
77
sort itab by netvalue salesunit.

loop at itab.
 at end of netvalue.
 read table itab index sy-tabix.
 sum.
 write : / itab-netvalue , itab-salesunit.
 endat.
 at last.
write : / itab-netvalue , itab-salesunit.
   write 
 endat.

endloop.

5 REPLIES 5

Former Member
0 Kudos
78
sort itab by netvalue salesunit.

loop at itab.
 at end of netvalue.
 read table itab index sy-tabix.
 sum.
 write : / itab-netvalue , itab-salesunit.
 endat.
 at last.
write : / itab-netvalue , itab-salesunit.
   write 
 endat.

endloop.

0 Kudos
77

Hi

Thanks for your reply.

I am using ALV report and i have nearly 8 columns with the same requirement.

Please suggest me.

Regards,

kumar

0 Kudos
77

Hi,

populate the sort table based on "unit". then use subtotal...

data: i_sort type SLIS_T_SORTINFO_ALV,

wa_sort type SLIS_SORTINFO_ALV.

wa_sort-fieldname = 'quantity'.

wa_sort-up = 'X'.

wa_sort-subtotal = 'X'.

append wa_sort to i_sort.

regards,

madhu

Former Member
0 Kudos
77

hi

did u use <b>collect</b> ,i am giveing sample code pls try this,modify this code into ur requirement fields,i think it may be usefull

REPORT zcollect.

TYPES:BEGIN OF t_mytype,

key_c(10) TYPE c,

key_n(10) TYPE n,

key_i TYPE i,

number TYPE i,

END OF t_mytype.

DATA:gi_mytable TYPE SORTED TABLE OF t_mytype

WITH NON-UNIQUE KEY key_c key_n key_i,

wa_mytable TYPE t_mytype.

START-OF-SELECTION.

CLEAR wa_mytable.

wa_mytable-key_c = '10'.

wa_mytable-key_n = '25'.

wa_mytable-key_i = 5.

wa_mytable-number = 400.

COLLECT wa_mytable INTO gi_mytable.

CLEAR wa_mytable.

wa_mytable-key_c = '10'.

wa_mytable-key_n = '25'.

wa_mytable-key_i = 5.

wa_mytable-number = 500.

COLLECT wa_mytable INTO gi_mytable.

CLEAR wa_mytable.

wa_mytable-key_c = '11'.

wa_mytable-key_n = '30'.

wa_mytable-key_i = 6.

wa_mytable-number = 200.

COLLECT wa_mytable INTO gi_mytable.

CLEAR wa_mytable.

wa_mytable-key_c = '11'.

wa_mytable-key_n = '30'.

wa_mytable-key_i = 6.

wa_mytable-number = 900.

COLLECT wa_mytable INTO gi_mytable.

CLEAR wa_mytable.

wa_mytable-key_c = '11'.

wa_mytable-key_n = '30'.

wa_mytable-key_i = 7.

wa_mytable-number = 100.

COLLECT wa_mytable INTO gi_mytable.

END-OF-SELECTION.

LOOP AT gi_mytable INTO wa_mytable.

WRITE: / wa_mytable-key_c,

wa_mytable-key_n,

wa_mytable-key_i,

wa_mytable-number.

ENDLOOP.

regards

satya

sreeramkumar_madisetty
Active Contributor
0 Kudos
77

solved