07-21-2009 7:37 AM
Hi Everbody .
I want to sum FIYAT field . But I dont sum . I think problem is data type but I dont find
My code is here :
"Database Table :
ZYEMEKSIPARIS
FIYAT CURR 15 2 " ref --> wears
WEARS CUKY 5 0
" Fieldcat
WHEN 'FIYAT'.
gt_fcatsip-seltext_s = 'F.'.
gt_fcatsip-seltext_m = 'FIY.'.
gt_fcatsip-seltext_l = 'FIYAT'.
gt_fcatsip-just = 'L' .
gt_fcatsip-ref_tabname = 'ZYEMEKSIPARIS'.
gt_fcatsip-do_sum = 'X' .
gt_fcatsip-cfieldname = 'WEARS'.
" itab
data : begin of itab occurs 0
fiyat like ZYEMEKSIPARIS-fiyat ..
Thanks for reply .
Serkan
07-21-2009 8:21 AM
Hi,
When you use Do_sum you need to sort the internal table first.
Please find below the code
DATA: IT_SORT TYPE SLIS_T_SORTINFO_ALV,
X_SORT TYPE SLIS_SORTINFO_ALV.
X_SORT-SPOS = 1. " SORT ORDER
X_SORT-FIELDNAME = 'Field name'
X_SORT-TABNAME = 'Internal table name'.
X_SORT-UP = 'X'.
X_SORT-SUBTOT = 'X'.
APPEND X_SORT TO IT_SORT.
CLEAR X_SORT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = LS_LAYOUT " Layout
IT_FIELDCAT = XT_FIELDCAT "Internal table for fieldcatalog
IT_EVENTS = T_EVENTS "Events if any
IT_SORT = IT_SORT "Sort table
TABLES
T_OUTTAB = 'Internal table name'.
Hope this helps!
Regards,
Sandhya
07-21-2009 7:42 AM
Hi Serkan
Set NUMC_SUM = X in layout also.
Thanks & Regards,
Anil Salekar
07-21-2009 7:42 AM
i think there are two problems may be possible.
1. if you use reuse_alv_fieldcatlog_merge function module, it can be problem.
2. check in debugger that your value is change in case statement.
07-21-2009 7:43 AM
07-21-2009 7:50 AM
case fieldname
when 'FIYAT' .
we use fiyat field in this code . and I add filedname = fiyat .. Dont solved .
Problem is continue .
gt_fcatsip-fieldname = 'FIYAT'.
gt_fcatsip-tabname = 'ITAB'.
this code not solved . Thanks reply .
Edited by: Serkan Taskan on Jul 21, 2009 8:56 AM
Edited by: Serkan Taskan on Jul 21, 2009 8:57 AM
07-21-2009 8:33 AM
Can you paste your code for fieldcatalog internal table population.
Thanks
Venkat.O
07-21-2009 7:49 AM
Hi Taskan,
You need to add these also .
gt_fcatsip-fieldname = 'FIYAT'.
gt_fcatsip-tabname = 'ITAB'.
Thanks
Venkat.O
07-21-2009 8:21 AM
Hi,
When you use Do_sum you need to sort the internal table first.
Please find below the code
DATA: IT_SORT TYPE SLIS_T_SORTINFO_ALV,
X_SORT TYPE SLIS_SORTINFO_ALV.
X_SORT-SPOS = 1. " SORT ORDER
X_SORT-FIELDNAME = 'Field name'
X_SORT-TABNAME = 'Internal table name'.
X_SORT-UP = 'X'.
X_SORT-SUBTOT = 'X'.
APPEND X_SORT TO IT_SORT.
CLEAR X_SORT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = LS_LAYOUT " Layout
IT_FIELDCAT = XT_FIELDCAT "Internal table for fieldcatalog
IT_EVENTS = T_EVENTS "Events if any
IT_SORT = IT_SORT "Sort table
TABLES
T_OUTTAB = 'Internal table name'.
Hope this helps!
Regards,
Sandhya