Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Sum of a field in ALV List

Former Member
0 Kudos

Hello Guys,

I'm using 'REUSE_ALV_GRID_DISPLAY' in my prog.

There is a field in output table which is of type P(8) Decimals 3.

When I'm trying to get the sum of this field in ALV Display it gives the message " Desired operation cannot be performed for column 'Converted Quantity' ".

I have also tried do_sum = 'X'.

But it is not working. Please help guys.

Regards,

Abhinav

1 ACCEPTED SOLUTION

rainer_hbenthal
Active Contributor
0 Kudos

You have to fill these components


         quantity(3)    type c,
         qfieldname     type slis_fieldname, " field with quantity unit
         qtabname       type slis_tabname,   " and table

in your fieldcatalog for this field.

9 REPLIES 9

rainer_hbenthal
Active Contributor
0 Kudos

You have to fill these components


         quantity(3)    type c,
         qfieldname     type slis_fieldname, " field with quantity unit
         qtabname       type slis_tabname,   " and table

in your fieldcatalog for this field.

0 Kudos

Thanks for the suggestion.

I have used the above points mentioned by you.

But I'm still not getting the sum.

0 Kudos

<li>How you are populating fieldcatalog internal table for the quantity field for which you are expecting sum? Thanks Venkat.O

0 Kudos

  CLEAR wa_fieldcat.
  wa_fieldcat-fieldname = 'QUAN'.
  wa_fieldcat-ref_tabname = 'I_OUT2'.
  wa_fieldcat-qfieldname = 'ABSMG_ME'.
  wa_fieldcat-qtabname = 'I_OUT2'.
  wa_fieldcat-outputlen = '15'.
  wa_fieldcat-do_sum = 'X'.
  wa_fieldcat-seltext_l = text-052.
  APPEND wa_fieldcat TO i_fieldcat.

Quan is the field name.

There is another fieldname 'ABSMG', I'm getting sum for this particular field. It is from Standard SAP table.

Both QUAN and ABSMG have same data type.

0 Kudos

why do you pass so many things:

CLEAR wa_fieldcat.
  wa_fieldcat-fieldname = 'QUAN'.
  wa_fieldcat-tabname = 'I_OUT2'. "only use tabname
  wa_fieldcat-outputlen = '15'.
"  wa_fieldcat-do_sum = 'X'. " needed for automatic sum
  wa_fieldcat-seltext_l = text-052.
  APPEND wa_fieldcat TO i_fieldcat.

Edited by: Soumyaprakash Mishra on Sep 22, 2009 12:19 PM

0 Kudos

Hi, Try this way an run.


  wa_fieldcat-fieldname = 'QUAN'.
  wa_fieldcat-tabname   = 'I_OUT2'.
  wa_fieldcat-do_sum    = 'X'.
  wa_fieldcat-seltext_l = text-052.
  APPEND wa_fieldcat TO i_fieldcat.
Thanks Venkat.O

0 Kudos

Thanks a lot guys for your inputs.

The program is working now.

Now I'm using :


  CLEAR wa_fieldcat.
  wa_fieldcat-fieldname = 'QUAN'.
*  wa_fieldcat-ref_tabname = 'I_OUT2'.
*  wa_fieldcat-tabname = 'I_OUT2'.
  wa_fieldcat-qfieldname = 'MEAS'.
  wa_fieldcat-qtabname = 'I_OUT2'.
  wa_fieldcat-outputlen = '15'.
  wa_fieldcat-seltext_l = text-052.
  APPEND wa_fieldcat TO i_fieldcat.

The program is working fine now.

I have commented tabname and -ref_tabname , and the program is working fine now.

Thanks a lot.

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

As you are using Quantity field for Sum oepration , you also have to pass other required inputs in the fieldcatalog for this field.

Former Member
0 Kudos

can you please show us how you have defined field catalog for that field?