Application Development and Automation 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: 
Read only

ALV grid Display

Former Member
0 Likes
916

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.

6 REPLIES 6
Read only

Former Member
0 Likes
831

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.

Read only

0 Likes
831

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...

Read only

Former Member
0 Likes
831

Hi Reddy,

Which method are you using to display ALV Grid?

Functional Module Methods or Object Oriented??

Regards

Madhu.

Read only

0 Likes
831

Function module method

Read only

Former Member
0 Likes
831

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

Read only

Former Member
0 Likes
831

Self answered