Skip to Content
0
Former Member
Dec 26, 2015 at 08:17 AM

Total and subtotals

18 Views

Hello Experts,

Im executing an ALV report for subtotal and total for Sales order a given sales order range but im not getting any output. For my knowledge everything is ok in the code. Could you help me wheres the wrong in the code.

Type-Pools: SLIS.

Tables: VBAP.

Types: begin of St_VBAP,

Vbeln type vbap-vbeln,

posnr type vbap-posnr,

matnr type vbap-matnr,

Netwr type vbap-netwr,

End of st_vbap.

Data: it_vbap type table of st_vbap,

wa_vbap type st_vbap.

Data: it_fieldcat type SLIS_T_Fieldcat_ALV,

Wa_fieldcat type SLIS_Fieldcat_ALV.

Data: it_sort type SLIS_T_SORTinfo_alv,

wa_sort type slis_sortinfo_alv.

select-options: s_vbeln for vbap-vbeln.

start-of-selection.

Select VBELN POSNR MATNR NETWR from vbap into table it_vbap where vbeln in s_vbeln.

wa_fieldcat-fieldname = 'vbeln'.

wa_fieldcat-seltext_m = 'SNO.'.

append wa_fieldcat to it_fieldcat.

wa_fieldcat-fieldname = 'posnr'.

wa_fieldcat-seltext_m = 'ITEMNO.'.

append wa_fieldcat to it_fieldcat.

wa_fieldcat-fieldname = 'matnr'.

wa_fieldcat-seltext_m = 'MATERIALNO'.

append wa_fieldcat to it_fieldcat.

wa_fieldcat-fieldname = 'Netwr'.

wa_fieldcat-seltext_m = 'NETPRICE'.

wa_Fieldcat-DO_SUM = 'X' .

append wa_fieldcat to it_fieldcat.

WA_SORT-FIELDNAME = 'VBELN '.

WA_SORT-UP = 'X'.

WA_SORT-SUBTOT = 'X '.

APPEND WA_SORT TO It_SORT .

Call function 'Reuse_ALV_GRID_DISPLAY'

Exporting

it_fieldcat = it_fieldcat

It_sort = it_sort

Tables

t_outtab = it_vbap

.

Regards,

Vivek