‎2006 Jun 28 3:34 PM
Hi,
Can any one Suggest me how to get total for Quantity field in ALV as Do_sum is not working.
And in my report there is no Unit field also.so i need to add all the quantities irrespective of unit.
I checked with Do_sum = 'X'.It is not working.
Thanks,
Suresh.
‎2006 Jun 28 3:41 PM
Hi,
then what about this.., here it is working for me just check it.
report ztest_alv_check message-id zz .
type-pools: slis.
data: x_fieldcat type slis_fieldcat_alv,
it_fieldcat type slis_t_fieldcat_alv,
l_layout type slis_layout_alv,
x_events type slis_alv_event,
it_events type slis_t_event.
data: begin of itab occurs 0,
vbeln like vbak-vbeln,
posnr like vbap-posnr,
<b>ZMENG like vbap-ZMENG,</b>
end of itab.
select vbeln
posnr
zmeng
from vbap
up to 20 rows
into table itab.
loop at itab.
itab-ZMENG = sy-tabix .
modify itab index sy-tabix.
endloop.
x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-seltext_l = 'VBELN'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 2.
append x_fieldcat to it_fieldcat.
clear x_fieldcat.
x_fieldcat-fieldname = 'POSNR'.
x_fieldcat-seltext_l = 'POSNR'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 3.
append x_fieldcat to it_fieldcat.
clear x_fieldcat.
<b>x_fieldcat-fieldname = 'ZMENG'.
x_fieldcat-seltext_l = 'ZMENG'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-do_sum = 'X'.
x_fieldcat-col_pos = 4.
append x_fieldcat to it_fieldcat.
clear x_fieldcat.</b>
data: sort type slis_sortinfo_alv,
it_sort type SLIS_T_SORTINFO_ALV.
sort-fieldname = 'VBELN'.
sort-up = 'X'.
sort-subtot = 'X'.
APPEND sort to it_sort.
l_layout-TOTALS_TEXT = 'total text'.
l_layout-SUBTOTALS_TEXT = 'subtotal text'.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = sy-repid
is_layout = l_layout
it_fieldcat = it_fieldcat
it_events = it_events
it_sort = it_sort
tables
t_outtab = itab
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.regards
vijay
‎2006 Jun 28 5:17 PM
hi suresh,
GIVE LIKE THIS...
<b>wa-fieldcat-datatype = 'QUAN'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.</b>
‎2006 Jun 28 5:20 PM
‎2006 Jun 28 5:29 PM
‎2006 Jun 28 5:23 PM
HI Suresh,
wa-fieldcat-datatype = 'QUAN'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
Regards,
Laxmi.
‎2006 Jun 28 5:25 PM
hi suresh,
here is a sample code . check this link:
http://sap.niraj.tripod.com/id64.html
regards,
keerthi.