01-21-2008 10:21 AM
Hi ,
I need to show the o/p in ALV format.but I have to show the sum for column WRBTR, MENGE,DMBTR for same LIFNR, BUDAT.
how to do it in ALV, pls help me with the code.
01-21-2008 10:27 AM
Hi,
for 3 fields u have to pass do_sum = 'X' append that fileds then u have to pass that field catalog to FM then u will get the SUM for 3 fileds. See bellow example it will very help full.
If it is help full reward me points.
fieldcat1-fieldname = 'WRBTR'.
i_fieldcat1-seltext_m = WRBTR.
i_fieldcat1-do_sum = 'X'.
APPEND i_fieldcat1 TO i_fieldcat1.
CLEAR i_fieldcat1.
i_fieldcat1-fieldname = 'MENGE,'.
i_fieldcat1-seltext_m = MENGE,.
i_fieldcat1-do_sum = 'X'.
APPEND i_fieldcat1 TO i_fieldcat1.
CLEAR i_fieldcat1.
fieldcat1-fieldname = 'DMBTR'.
i_fieldcat1-seltext_m = DMBTR.
i_fieldcat1-do_sum = 'X'.
APPEND i_fieldcat1 TO i_fieldcat1.
CLEAR i_fieldcat1.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
it_fieldcat = i_fieldcat1[]
i_callback_top_of_page = 'TOP_OF_PAGE'
i_callback_user_command = 'USER_COMMAND1'
it_events = i_events
TABLES
t_outtab = i_vbup1
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
prveen