cancel
Showing results for 
Search instead for 
Did you mean: 

ALV: how to display only subtotals lines in theoutput

Former Member
0 Kudos

hi

in the alv list output

if we display subtotals based on 3 feilds out of 10

we see subtotals (sum) based on the end of each field

now i want to display only the lines which are displayed as subtotals in the output

we have parameter

totals_only(1) type c, " show only totals

in the structrure slis_layout_alv

i have used it but i can see no change in the output

Accepted Solutions (0)

Answers (3)

Answers (3)

p244500
Active Contributor
0 Kudos

hai

data : GT_SORT TYPE SLIS_T_SORTINFO_ALV,

  • ABAP List Viewer

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = G_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

I_STRUCTURE_NAME = 'ITAB1'

IS_LAYOUT = GS_LAYOUT

IT_FIELDCAT = GT_FIELDCAT[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

IT_SORT = GT_SORT[]

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = GT_EVENTS[]

  • IT_EVENT_EXIT =

IS_PRINT = GS_PRINT

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = ITAB1

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

ENDFORM.

  • DATA SORTING AND SUBTOTAL

DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.

CLEAR GS_SORT.

GS_SORT-FIELDNAME = 'FIELD1'.

GS_SORT-SPOS = 1.

GS_SORT-UP = 'X'.

GS_SORT-SUBTOT = 'X'.

APPEND GS_SORT TO GT_SORT.

CLEAR GS_SORT.

GS_SORT-FIELDNAME = 'FIELD2'.

GS_SORT-SPOS = 2.

GS_SORT-UP = 'X'.

*GS_SORT-SUBTOT = 'X'.

APPEND GS_SORT TO GT_SORT.

ENDFORM.

regard

nawa

Former Member
0 Kudos

You can use the subtotal text in ALV.

Before using the subtotal,. you have to sort the List using the field for which total has to be calculated.

DATA: lt_sort TYPE slis_t_sortinfo_alv.

DATA: lw_sort TYPE slis_sortinfo_alv.

CONSTANTS:

lc_value_x TYPE ebstyp VALUE 'X'.

v_repid = sy-repid.

lw_sort-fieldname = fieldname.

lw_sort-up = lc_value_x.

lw_sort-subtot = lc_value_x.

lw_sort-stext = 'Subttotal'.

APPEND lw_sort TO lt_sort.

*call function to display the report

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

i_callback_top_of_page = 'TOP_OF_PAGE'

it_fieldcat = ut_fieldcattab

it_sort = lt_sort

TABLES

t_outtab = ct_output_values_tab

EXCEPTIONS

program_error = 1

OTHERS = 2.

Regards,

Yogesh

Former Member
0 Kudos

Hi,

Do like this,

DATA: it_sort TYPE slis_t_sortinfo_alv,

wa_sort-spos = '0'.

wa_sort-fieldname = 'Field for which you want subtotal in CAPITAL'.

wa_sort-tabname = 'Internal Table In capital.

wa_sort-up = 'X'.

wa_sort-subtot = 'X'.

APPEND wa_sort TO it_sort.

Pass this table to ALV fm.

Reward if helpful.

Regards

Azad.

Former Member
0 Kudos

I AM GETTING THE OUTPUT

I AM GETTING THE SUBTOTALS

BUT I WANT TO DISPLAY ONLY THE

SUBTOTALS ROWS ONLY

SUBTOTALS ROWS ONLY

SUBTOTALS ROWS ONLY

SUBTOTALS ROWS ONLY

SUBTOTALS ROWS ONLY