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

ALV sum

Former Member
0 Likes
521

I am generating an ALV report with proper data.

The sort function and filter works fine.

But when i click Sum button ( E ) it ends up with an error - dump.

code :

perform fill_catalog1 using :

'MATNR' 'ITAB' 'MATERIAL NUMBER' ,

'WERKS' 'ITAB' 'PLANT' ,

'TOTAL' 'ITAB' 'TOTAL STOCK'.

FORM FILL_CATALOG1 USING P_FIELDNAME TYPE ANY

P_REF_TABLE TYPE ANY

P_SCRTEXT TYPE ANY.

CLEAR : WA_FLD_CATALOG.

WA_FLD_CATALOG-FIELDNAME = P_FIELDNAME.

WA_FLD_CATALOG-TABNAME = P_REF_TABLE.

WA_FLD_CATALOG-SELTEXT_S = P_SCRTEXT.

WA_FLD_CATALOG-SELTEXT_M = P_SCRTEXT.

WA_FLD_CATALOG-SELTEXT_L = P_SCRTEXT.

WA_FLD_CATALOG-OUTPUTLEN = 15.

APPEND WA_FLD_CATALOG TO IT_FLD_CATALOG.

ENDFORM. " fill_catalog1

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = ZX"Program name

it_fieldcat = it_fld_catalog

i_save = 'X'

TABLES

t_outtab = it_final

EXCEPTIONS

program_error = 1

OTHERS = 2.

Question 1) Any help with sum button in the above code for total of a particular column(total stock)?

Question 2) subtotals , group by plant in ALV

Is it possible to subtotal based on plant and display in the ALV list output along with plant details.what should be done ?

plant1 mat1 amt

plant1 mat2 amt

plant1 mat3 amt

subtoatl plant 1 : amt

plant2 mat4 amt

plant 2 mat5 amt

subtotal plant2 amt

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
494

hI

WA_FLD_CATALOG-FIELDNAME = P_FIELDNAME.
WA_FLD_CATALOG-TABNAME = P_REF_TABLE.
WA_FLD_CATALOG-SELTEXT_S = P_SCRTEXT.
WA_FLD_CATALOG-SELTEXT_M = P_SCRTEXT.
WA_FLD_CATALOG-SELTEXT_L = P_SCRTEXT.
WA_FLD_CATALOG-OUTPUTLEN = 15.
WA_FLD_CATLOG_DO_SUM       = 'X'        "Display column total
APPEND WA_FLD_CATALOG TO IT_FLD_CATALOG.

Ranga

I am generating an ALV report with proper data.

The sort function and filter works fine.

But when i click Sum button ( E ) it ends up with an error - dump.

code :

perform fill_catalog1 using :

'MATNR' 'ITAB' 'MATERIAL NUMBER' ,

'WERKS' 'ITAB' 'PLANT' ,

'TOTAL' 'ITAB' 'TOTAL STOCK'.

FORM FILL_CATALOG1 USING P_FIELDNAME TYPE ANY

P_REF_TABLE TYPE ANY

P_SCRTEXT TYPE ANY.

CLEAR : WA_FLD_CATALOG.

WA_FLD_CATALOG-FIELDNAME = P_FIELDNAME.

WA_FLD_CATALOG-TABNAME = P_REF_TABLE.

WA_FLD_CATALOG-SELTEXT_S = P_SCRTEXT.

WA_FLD_CATALOG-SELTEXT_M = P_SCRTEXT.

WA_FLD_CATALOG-SELTEXT_L = P_SCRTEXT.

WA_FLD_CATALOG-OUTPUTLEN = 15.

APPEND WA_FLD_CATALOG TO IT_FLD_CATALOG.

ENDFORM. " fill_catalog1

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = ZX"Program name

it_fieldcat = it_fld_catalog

i_save = 'X'

TABLES

t_outtab = it_final

EXCEPTIONS

program_error = 1

OTHERS = 2.

Question 1) Any help with sum button in the above code for total of a particular column(total stock)?

Question 2) subtotals , group by plant in ALV

Is it possible to subtotal based on plant and display in the ALV list output along with plant details.what should be done ?

plant1 mat1 amt

plant1 mat2 amt

plant1 mat3 amt

subtoatl plant 1 : amt

plant2 mat4 amt

plant 2 mat5 amt

subtotal plant2 amt

2 REPLIES 2
Read only

Former Member
0 Likes
495

hI

WA_FLD_CATALOG-FIELDNAME = P_FIELDNAME.
WA_FLD_CATALOG-TABNAME = P_REF_TABLE.
WA_FLD_CATALOG-SELTEXT_S = P_SCRTEXT.
WA_FLD_CATALOG-SELTEXT_M = P_SCRTEXT.
WA_FLD_CATALOG-SELTEXT_L = P_SCRTEXT.
WA_FLD_CATALOG-OUTPUTLEN = 15.
WA_FLD_CATLOG_DO_SUM       = 'X'        "Display column total
APPEND WA_FLD_CATALOG TO IT_FLD_CATALOG.

Ranga

Read only

Former Member
0 Likes
494

HI,

Check this demo program for total...BCALV_GRID_DEMO