03-19-2008 2:44 PM
HI experts,
I have ALV grid display with subtotals and grandtotols by company code BUKRS.
But My requirment is.
How to have subtotals.
separtely at end of layout.
It fine to have same layout or other layout on same page.
All company codes should appear at one place to see subtotals.
Kindly help.
Thanks.
03-19-2008 2:47 PM
Hi,
Please refer the code below and for summation use gs_fieldcat-do_sum = 'X':
ALV data declarations
data: it_sortcat type slis_sortinfo_alv occurs 1,
wa_sort like line of it_sortcat.
perform build_sortcat.
&----
*& Form build_sortcat
&----
Build Sort catalog
----
FORM build_sortcat .
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'.
wa_sort-SUBTOT = 'X'. "subtotals any totals column by this field
gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
wa_sort-spos = 2.
wa_sort-fieldname = 'EBELP'.
gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
ENDFORM. " build_sortcat
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_sort = it_sortcat
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
Thanks,
Sriram Ponna.
03-19-2008 2:50 PM
sriram.
Thanks for your reply.
But I have done those.
But i need to save sperately at botoom of the layout.
or different layout at bottom of main layout.
ex:
BUKRS1 = 1,234.
BUKRS2 = 2.233.
etc...
03-19-2008 2:49 PM
Hi Reddy,
Which method are you using to display ALV Grid?
Functional Module Methods or Object Oriented??
Regards
Madhu.
03-19-2008 2:51 PM
03-19-2008 2:52 PM
Hi,
To display sub-totals in ALV , Use SORT Tables of TYPE Slis_sortinfo_alv.
x_sort-fieldname = 'BUKRS'.
x_sort-spos = '1'.
x_sort-up = 'X'.
x_sort-group = '*'.
x_sort-subtot = 'X'.
APPEND x_sort TO t_sort.
To display Sub-total lines only , use TOTLINES_ONLY in the fieldcatalog to 'X'.
<REMOVED BY MODERATOR>
Regards
Rose
Edited by: Alvaro Tejada Galindo on Mar 19, 2008 5:04 PM
07-20-2011 9:07 AM