Application Development and Automation 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: 
Read only

Runtime Error while summing a column in ALV output

Former Member
0 Likes
952

Dear All,

I have developed an ALV Report and the report is giving output without any flaws.

I have defined proper field catalog and displaying the results using REUSE_ALV_GRID function module.

Now the report is generating Runtime Error while the user selects a column and click the SUM icon.

The fields like Qty, or amounts are also theowing runtime error while summing up their column in the ALV output.

What might be the reason and how to resolve this issu?

Regards

Pavan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
607

Hi ,

I don't know how you have write down the code but follow the below coding example:

FOR TOTAL:

there is a property of fieldcatalog, that is do_sum.

USE COED LIKE:

PERFORM fieldcat USING:

'1' 'MATNR' 'I_MARD' 'MATERIAL NO' 'MARD' 'MATNR ' ' ',

'2' 'NETWR' 'I_MARD' 'PLANT' 'MARD' 'WERKS' ' ',

..............................

FORM fieldcat USING value(p_0029)

value(p_0030)

value(p_0031)

value(p_0032)

wa_fieldcat-col_pos = p_0029.

wa_fieldcat-fieldname = p_0030.

wa_fieldcat-tabname = p_0031.

wa_fieldcat-reptext = p_0032.

wa_fieldcat-do_sum = 'X'.

APPEND wa_fieldcat TO i_fieldcat.

ENDFORM. " FIELDCAT

in final output you will get the total of currency field.

FOR SUB TOTAL:

decleare: i_sort type standard table of slis_sortinfo_alv,

wa_sort type slis_t_sortinfo_alv.

wa_sort-spos = '1'.

wa_sort-fieldname = 'field1'.

wa_sort-subtot = 'X'.

append wa_tab to i_sort.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = it_fieldcat

it_sort = i_sort

Hope this can solve your pbs.

If you need more inputs let me know.

Regards,

Tutun

2 REPLIES 2
Read only

Former Member
0 Likes
608

Hi ,

I don't know how you have write down the code but follow the below coding example:

FOR TOTAL:

there is a property of fieldcatalog, that is do_sum.

USE COED LIKE:

PERFORM fieldcat USING:

'1' 'MATNR' 'I_MARD' 'MATERIAL NO' 'MARD' 'MATNR ' ' ',

'2' 'NETWR' 'I_MARD' 'PLANT' 'MARD' 'WERKS' ' ',

..............................

FORM fieldcat USING value(p_0029)

value(p_0030)

value(p_0031)

value(p_0032)

wa_fieldcat-col_pos = p_0029.

wa_fieldcat-fieldname = p_0030.

wa_fieldcat-tabname = p_0031.

wa_fieldcat-reptext = p_0032.

wa_fieldcat-do_sum = 'X'.

APPEND wa_fieldcat TO i_fieldcat.

ENDFORM. " FIELDCAT

in final output you will get the total of currency field.

FOR SUB TOTAL:

decleare: i_sort type standard table of slis_sortinfo_alv,

wa_sort type slis_t_sortinfo_alv.

wa_sort-spos = '1'.

wa_sort-fieldname = 'field1'.

wa_sort-subtot = 'X'.

append wa_tab to i_sort.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = it_fieldcat

it_sort = i_sort

Hope this can solve your pbs.

If you need more inputs let me know.

Regards,

Tutun

Read only

Former Member
0 Likes
607

IF we mention wrong field name in the field catalog, such error occurs in the report execution.

Thanks,...