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: 

ALV summation in the output

Former Member
0 Kudos

Hai All,

When iam trying to sum on a particular coloumn in ALV output it is throwing a dump and uiam giving the part of the dump analysis.

assign component

<ls_fieldcat>-fieldname of structure rt_data to <g_field>.

if sy-subrc ne 0.

message x000(0k).

endif.

g_col_counter = g_col_counter + 1.

gs_lvc_data-row_pos = r_row_counter.

kindly suggest me where iam goin wrong or the possibility for the error.

Thanks & Regards,

Praveen.

4 REPLIES 4

Former Member
0 Kudos

Hi Praveen ,

i think u havnt given proper values in Field Catalog.

Plz check Ex.Code to get the Sum of the Col.

  • Total Loss

fcat-fieldname = 'TLOSS'.

fcat-hotspot = ' '.

fcat-outputlen = '000016'.

fcat-just = 'L'.

fcat-seltext_m = 'Total Loss'.

fcat-ddictxt = 'M'.

fcat-inttype = 'Q'.

fcat-datatype = 'QUAN'.

fcat-do_sum = 'X'.

fcat-just = 'R'.

fcat-no_zero = 'X'.

APPEND fcat.

CLEAR fcat.

In that mainly u have to check the datatype and inttype in Se11.

if any info plz buzz me

regards

Prabhu

nethranp@gmail.com

Former Member
0 Kudos

The program is looking for the <b>reference field</b> for the <b>Quantity/Value fields</b> in the data table.

Use

<b>fieldcat-cfieldname = 'WAERS'</b>

for <b>currency/Amount fields</b>, where <b>WAERS</b> is the field name in the data table that has the currency.

or

<b>fieldcat-qfieldname = 'MEINS'</b>

for <b>quantity fields</b>, where <b>MEINS</b> is the field name in the data table that has the Unit of measure.

If you do not have these fields in your internal table, then define the field catalog as follows.

<b>FIELDCAT-DATATYPE = 'DEC'.

FIELDCAT-LENG = <u>Length of the field</u>

FIELDCAT-OUTPUTLEN = <u>Output Length of the field</u>

FIELDCAT-DECIMALS = <u>Required Number of decimal places</u>

FIELDCAT-SIGNFLAG = <u>'X' to display sign, ' ' to ignore sign</u></b>

Rishi

Former Member
0 Kudos

Hi,

As mentioned by u i have also faced the same probem.

Try to increase the output length as ( g_col_counter = g_col_counter + 1 ) you are incrementing the value, when the particular field length exceeds the actual field length u have specified it will throw a dump.

So try to use a field of type length greater than what u have specified in the fieldcatalog.

Thanks & Regards,

Judith.

Former Member
0 Kudos

Hi, for sum a particular column in ALV you can try this example code:

fieldcat-fieldname = 'WRBTR'.

fieldcat-ref_tabname = 'BSID'.

fieldcat-cfieldname = 'WAERS'. "Currency

fieldcat-do_sum = 'X'.

APPEND fieldcat. CLEAR fieldcat.

Jhon.