Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Need to have subtotal

Hi,

I am using 'ALV_GRID_DISPLAY'. i need to have a subtotal in the output based on two fields of my output (vendor and period).

any one help please

Thanks in advance.

Tags:
Former Member
Former Member replied

Hi,

In your fieldcat add this to your fields.

i_fieldcat-col_pos = '10'. " POSITION OF THE COLUMN.

i_fieldcat-fieldname = 'LFIMG'. " FIELD FOR WHICH CATALOG ID FILLED.

i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.

i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.

<b>i_fieldcat-do_sum = 'X'.</b> i_fieldcat-seltext_l = 'LFIMG'. " LONG TEXT FOR HEADER.

i_fieldcat-outputlen = 18. " SET THE OUTPUT LENGTH.

i_fieldcat-ref_tabname = 'LIPS'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.

append i_fieldcat to p_i_fieldcat.

In your layout write this,

i_layout-zebra = 'X'.

<b> i_layout-totals_text = 'Total'.

i_layout-subtotals_text = 'SubTotal'</b>.

i_layout-box_tabname = 'IT_FINAL'

Also add this in your sortinfo,

clear i_sortinfo.

i_sortinfo-spos = '1'.

i_sortinfo-fieldname = 'VBELN'.

i_sortinfo-tabname = 'IT_FINAL'.

i_sortinfo-up = 'X'.

i_sortinfo-group = 'UL'. " I.E UNDERLINE AFTER EVERY GROUP

<b>i_sortinfo-subtot = 'X'.</b>

Regards,

PRitha.

Reward if useful.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question