2007 Mar 08 3:40 PM
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
2007 Mar 08 3:46 PM
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.
2007 Mar 08 3:46 PM
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.
2007 Mar 08 3:49 PM
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
2007 Mar 08 4:08 PM
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
2007 Mar 08 4:05 PM
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
2007 Mar 14 12:20 PM