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: 

ALV SUB-TOTAL AND GROUP FIELD

Former Member
0 Kudos

Hi all,

add 1 to ls_sort-spos.

ls_sort-fieldname = 'kunrg'.

ls_sort-up = 'X'.

ls_sort-subtot = 'X'.

ls_sort-group = '*'.

append ls_sort to lt_sort.

CLEAR lt_SORT.

i write this type of code but i didn't get a sub total . and also didn't got a "KUNRG" field in group . here my table name is VBRK,

so please help me i face this problem from last 3 days. please help me out as soon as possible.

1 ACCEPTED SOLUTION

venkat_o
Active Contributor
0 Kudos

Hi Chauhan, <li> You need to set DO_SUM ='X'. for the quantity field while building fieldcatalog for which total and subtotal should be calculated. <li> Also you need to pass the below information through SORT table.

 wa_sort-spos      = 1.       " Sort position
 wa_sort-fieldname = 'BUKRS'.
 wa_sort-tabname   = 'IT_TAB'.
 wa_sort-up        = 'X'.     "Ascending order
 wa_sort-group     = '*'.     "Page break
 wa_sort-subtot    = 'X'.
 APPEND wa_sort TO it_sort.
 CLEAR wa_sort.
Let me know, if you need any further help. Thanks Venkat.O

4 REPLIES 4

Former Member
0 Kudos

Hi,

Please remember to use below statements.

While building the field catalog for the sub total fields, use

wa_fieldcat-do_sum = 'X'.

For SORT table,

lwa_sort-fieldname = c_matnr.

lwa_sort-tabname = c_t_final1.

lwa_sort-subtot = c_x.

lwa_sort-up = c_x.

lwa_sort-group = c_x.

APPEND lwa_sort TO lt_sort.

It will work.

Regards,

Santhosh.

venkat_o
Active Contributor
0 Kudos

Hi Chauhan, <li> You need to set DO_SUM ='X'. for the quantity field while building fieldcatalog for which total and subtotal should be calculated. <li> Also you need to pass the below information through SORT table.

 wa_sort-spos      = 1.       " Sort position
 wa_sort-fieldname = 'BUKRS'.
 wa_sort-tabname   = 'IT_TAB'.
 wa_sort-up        = 'X'.     "Ascending order
 wa_sort-group     = '*'.     "Page break
 wa_sort-subtot    = 'X'.
 APPEND wa_sort TO it_sort.
 CLEAR wa_sort.
Let me know, if you need any further help. Thanks Venkat.O

Former Member
0 Kudos

[]

check this thread..

please serach in forums before posting

Former Member
0 Kudos

Hi Keyur,

FOR TOTAL:

there is a property of fieldcatalog, that is do_sum.

wa_fieldcat-do_sum = 'X'.

APPEND wa_fieldcat TO i_fieldcat.

FOR SUB TOTAL:

decleare: i_sort type standard table of slis_sortinfo_alv,

wa_sort type slis_t_sortinfo_alv.

wa_sort-spos = '1'.

wa_sort-fieldname = 'field1'.

wa_sort-tablename = 'i_final'

wa_sort-subtot = 'X'.

wa_sort-group = 'X'.

append wa_tab to i_sort.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = it_fieldcat

it_sort = i_sort

Hope this can solve your pbs.

Regards,

Tutun