Skip to Content
author's profile photo Former Member
Former Member

ALV - sum for same value in other few columns

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 21, 2008 at 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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.