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

ALV-Grid: How to display the number of lines that a sum consists of

Dear experts,

I'm dealing with the following user request:

in every total/subtotal line of an ALV-Grid the number of lines that went into the sum are supposed to be displayed.

In detail the question referred to a reports output, in which a currency related amount is displayed, automatically separated into the totals for every currency (generally around 10-15 different currencies). For every amount/currency combination the user would like to know how many single lines it consists of. I already tried to solve this with an artificial "counter"-field (INT4) which is initially set to "1" for every line, so that the user can do a sum on this field. In order to have those line counter sums for all the different currencies separately I added a reference to the currency field in the field catalogue (lvc_s_fcat-cfieldname). This seems to work so far, but now the linecounter value is displayed like a currency amount and apparently I cannot suppress that by setting lvs_s_fcat-NO_CONVEXT. This I cannot (respectively don't want to) offer to my customer. Does anybody know how to achieve this a bit more elegantly? Doesn't the ALV offer something for that? I couldn't find anything.

Thanks in advance


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 Oct 07, 2009 at 11:02 AM

    *....Suppose your final internal table is like this.

    Begin of itab occurs 0,





    end of itab.

    data: cnt(3) type n.

    sort itab1 by keyfield curr.

    *......loop at source internal table where actual data lies.

    loop at itab1.

    cnt = cnt + 1.

    at end of curr.


    move-corresponding itab1 to itab.

    itab-count = cnt.

    clear cnt.



    *.....finally display itab using ALV.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear Mr. Chandrasekhar,

      thanks for your appreciated input !

      I agreed with my customer to deliver the extra "linecounter"-field without a reference to the currency.

      Thus it requires to define an appropriate sort in order to get the figures (in my example case on the currency),

      but at least it is possible to get the desired information, properly formatted and without additional programming.

      I granted points for your answer and will set the question as answered.

      best regards


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.