Skip to Content
avatar image
Former Member

ALV Grid Total Text (OOPS)

Hi All,

I have a simple ALV Grid Report(OOPS), I would like to give a Text for Total Row. In REUSE_ALV_GRID we have the option of giving this text, but i am not able to figure it out how to get the same in OOPS.

Regards

Anup

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Apr 10, 2006 at 01:55 PM

    Hi Anup,

    While using ALV with OOP methodology, you can create an extra row for giving the sum of any field.

    In the field catalog, there is a component named 'DO_SUM', if set, will give the total value for the field.

    In the method where you fill the field catalog , just add this component.

    eg:

    form catalog_fill changing p_field_catalog.

    data ls_fcat type lvc_s_fcat .

    ls_fcat-fieldname = 'CARRID' .

    ls_fcat-inttype = 'C' .

    ls_fcat-outputlen = '20' .

    ls_fcat-coltext = 'Carrier ID' .

    ls_fcat-web_field = 'carrid_handle'.

    ls_fcat-edit = 'X'.

    *ls_fcat-emphasize = 'C310'. "needed for column coloring

    append ls_fcat to field_catalog .

    clear ls_fcat .

    ls_fcat-fieldname = 'FLDATE' .

    ls_fcat-ref_table = 'SFLIGHT' .

    ls_fcat-ref_table = 'FLDATE' .

    ls_fcat-outputlen = '20' .

    <b>ls_fcat-do_sum = 'X'.</b>

    ls_fcat-coltext = 'Flight Date' .

    ls_fcat-web_field = 'fldate_handle'.

    append ls_fcat to field_catalog .

    clear ls_fcat .

    ls_fcat-fieldname = 'PRICE' .

    ls_fcat-ref_table = 'SFLIGHT' .

    ls_fcat-ref_table = 'PRICE' .

    ls_fcat-outputlen = '20' .

    ls_fcat-coltext = 'Airfare' .

    append ls_fcat to field_catalog .

    endform.

    In this way, you can get the total of any field in ALV.

    Regards,

    SP.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Ravi,

      Thanks for the reply.

      Initially i didn't mention the sort criteria. i have just used the DO_SUM in the field catalog.

      Now I tried using SELTEXT (IT_SORT), but it is not displaying the Total Text. Are you sure whether it works for Grand Total text?

      Warm Regards

      Anup Varghese

  • Mar 09, 2009 at 05:59 PM

    Hi,

    I have the similar requirement to print the text "Grand Total" in the line that displays the sum of all the line itmes in the ALV Grid (using OOPS). Could you please let me know, if you were able to display the text "Grand Total" using ALV Grid (OOPS) ? If yes, can you please let me know, how you were able to achieve that requirement?

    Thanks,

    Manohar

    Add comment
    10|10000 characters needed characters exceeded