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

problem in ALV

Hi all,

I am having a problem in which suppose if i am getting duplicate records on the basis of vbeln and zposn, i have to sum up all the fields related to currency. and also there is field called zattnmnt which is numeric and the average of all duplicate records of this field should be displayed.

for eg., my records are


001 -10001-70 -----5000

001 -10001-100 ----4000

001 -10001-50 -----3000

the o/p should be displayed as

001 -10001-73 -----12000

help me in this context

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Oct 05, 2005 at 07:01 AM

    ALV cant condense rows, it can add summarizing rows. You have to code that for your own. See online help fot statement collect, this might by helpful.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 05, 2005 at 07:09 AM

    Hi Ateeq,

    You can do this inside the ALV itself using the SORT option. Here is that sample code.

    DATA: wa_layout TYPE slis_layout_alv,

    it_sort TYPE slis_t_sortinfo_alv,

    wa_sort TYPE slis_sortinfo_alv.

    CLEAR wm_sort.

    wm_sort-fieldname = 'MATNR'.

    wm_sort-tabname = 'IT_SORT'.

    wm_sort-up = 'X'.

    wm_sort-subtot = 'X'.

    APPEND wa_sort TO it_sort.



    i_callback_program = w_repid

    i_callback_top_of_page = 'ALV_TOP_OF_PAGE'

    i_callback_html_top_of_page = 'ALV_HTML_TOP_OF_PAGE'

    is_layout = wa_layout

    it_fieldcat = it_fieldcat

    it_events = it_events

    it_sort = it_sort

    i_default = 'X'





    Message was edited by: Vinod C

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Why dont you calculate your average in ABAP and then pass it to ALV.

      Create a new internal table


      ( Use Collect to populate this table . While collecting always sset count as '1'. After populating this table calculate average as ATTMNT / COUNT and modify this table. Loop at your original table, and modify individual lines by matching VBELN/VBPOS from second table).

      Then pass this table to ALV.


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.