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: 

DO_SUM = 'X' Problem .

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

Hi Serkan

Set NUMC_SUM = X in layout also.

Thanks & Regards,

Anil Salekar

Former Member
0 Kudos

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.

Former Member
0 Kudos

i think u missing gt_fcatsip--fieldname in fieldcatalog..

0 Kudos

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

0 Kudos

Can you paste your code for fieldcatalog internal table population.

Thanks

Venkat.O

venkat_o
Active Contributor
0 Kudos

Hi Taskan,

You need to add these also .

gt_fcatsip-fieldname = 'FIYAT'.
gt_fcatsip-tabname   = 'ITAB'.

Thanks

Venkat.O

Former Member
0 Kudos

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