2005 Jul 08 1:12 PM
I have a problem with sum function in ALV. I'm using function REUSE_ALV_GRID_DISPLAY with dynamic created table and I can't use sum. I don't have sum sign in toolbar. 'X' on do_sum in field catalog don't working neither. Anybody help me?
2005 Jul 08 3:15 PM
It's example code ! When I start this program I don't see SUM icon i toolbar! Why?
REPORT ZKM_TESTOWY no standard page heading.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat.
data: wa_cat like line of alv_fldcat.
data: gv_fldname(20) type c.
data: index(3) type c.
selection-screen begin of block b1 with frame title text-001.
parameters: p_check type c.
selection-screen end of block b1.
start-of-selection.
perform build_dyn_itab.
perform build_report.
do 10 times.
MOVE sy-index TO index.
clear wa_cat.
concatenate 'FIELD' index into
gv_fldname .
condense gv_fldname no-gaps.
wa_cat-fieldname = gv_fldname.
wa_cat-seltext_s = gv_fldname.
wa_cat-outputlen = '5'.
append wa_cat to alv_fldcat.
enddo.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = alv_fldcat
tables
t_outtab = <dyn_table>.
************************************************************************
Build_dyn_itab
************************************************************************
form build_dyn_itab.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
Create fields
clear index.
do 10 times.
index = sy-index.
clear wa_it_fldcat.
concatenate 'Field' index into
wa_it_fldcat-fieldname .
condense wa_it_fldcat-fieldname no-gaps.
wa_it_fldcat-datatype = 'MATNR'.
wa_it_fldcat-intlen = 5.
append wa_it_fldcat to it_fldcat .
enddo.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
endform.
*********************************************************************
Form build_report
*********************************************************************
form build_report.
data: fieldname(20) type c.
data: fieldvalue(5) type c.
data: index(3) type c.
field-symbols: <fs1>.
data: new_table type ref to data,
wa_it_fldcat type lvc_s_fcat.
do 10 times.
index = sy-index.
Set up fieldname
concatenate 'FIELD' index into
fieldname .
condense fieldname no-gaps.
Set up fieldvalue
concatenate '66' index into
fieldvalue.
condense fieldvalue no-gaps.
assign component fieldname of structure <dyn_wa> to <fs1>.
<fs1> = fieldvalue.
enddo.
Append to the dynamic internal table
append <dyn_wa> to <dyn_table>.
endform.
2005 Jul 08 1:21 PM
I have used ALV Grid & dynamic table without problem (Object). Maybe if you cut past your code that will be more easy.
Regards
Frédéric
2005 Jul 08 1:28 PM
Hi,
check your fields to sum :
have they type p or dec ?
regards Andreas
2005 Jul 08 1:55 PM
2005 Jul 08 3:15 PM
It's example code ! When I start this program I don't see SUM icon i toolbar! Why?
REPORT ZKM_TESTOWY no standard page heading.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat.
data: wa_cat like line of alv_fldcat.
data: gv_fldname(20) type c.
data: index(3) type c.
selection-screen begin of block b1 with frame title text-001.
parameters: p_check type c.
selection-screen end of block b1.
start-of-selection.
perform build_dyn_itab.
perform build_report.
do 10 times.
MOVE sy-index TO index.
clear wa_cat.
concatenate 'FIELD' index into
gv_fldname .
condense gv_fldname no-gaps.
wa_cat-fieldname = gv_fldname.
wa_cat-seltext_s = gv_fldname.
wa_cat-outputlen = '5'.
append wa_cat to alv_fldcat.
enddo.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = alv_fldcat
tables
t_outtab = <dyn_table>.
************************************************************************
Build_dyn_itab
************************************************************************
form build_dyn_itab.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
Create fields
clear index.
do 10 times.
index = sy-index.
clear wa_it_fldcat.
concatenate 'Field' index into
wa_it_fldcat-fieldname .
condense wa_it_fldcat-fieldname no-gaps.
wa_it_fldcat-datatype = 'MATNR'.
wa_it_fldcat-intlen = 5.
append wa_it_fldcat to it_fldcat .
enddo.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
endform.
*********************************************************************
Form build_report
*********************************************************************
form build_report.
data: fieldname(20) type c.
data: fieldvalue(5) type c.
data: index(3) type c.
field-symbols: <fs1>.
data: new_table type ref to data,
wa_it_fldcat type lvc_s_fcat.
do 10 times.
index = sy-index.
Set up fieldname
concatenate 'FIELD' index into
fieldname .
condense fieldname no-gaps.
Set up fieldvalue
concatenate '66' index into
fieldvalue.
condense fieldvalue no-gaps.
assign component fieldname of structure <dyn_wa> to <fs1>.
<fs1> = fieldvalue.
enddo.
Append to the dynamic internal table
append <dyn_wa> to <dyn_table>.
endform.
2005 Jul 08 3:20 PM
2005 Jul 08 3:23 PM