10-06-2010 11:17 AM
Hi
Is do_sum in the field catalog has some restriction to display SUM in the report output. In my report around 4000 records are displaying. For some of the fields do_sum functionality used to display the total in the ouput. But for some fields it showing Total and remaining fields Total is not coming and it gives one messag in the output "The field cannot be totalled because of field overflow". Message is coming from standard Include LSKBHF__ . Is there any way to display for all the fields other than writting logic for that.
Regards
Raj
10-06-2010 11:39 AM
May be the field cannot accomodate the value bigger than its length.
Data type of that field ???
10-06-2010 11:46 AM
Yes. I know that. But since standard functionality we can not change that right.
10-06-2010 11:49 AM
Hi,
What i mean to say is for example if a field has length of 6 digits and it cannot hold 7 digits . its a overflow.
Change the length of that field to maximum.
10-06-2010 11:57 AM
Hi,
Use NUMC fields where the totals are not coming due to overflow.
Regards,
Amitava
10-06-2010 12:00 PM
Guys,
Note that I have not written any logic to display the total. I have used do_sum as X in the field catalog. Message coming from standard inlcude. Hence I canot change the filed length or type.
Regards
Raj.
10-06-2010 12:33 PM
Even if you have only written do_sum = 'X', the field which you are totalling would of a fixed length, eg. type FKIMG. (in this case, FKIMG's length is 13). So if the calculated sum, exceeds this length, you will get the error message.
So you must change the field type in your ALV structure. Eg. instead of type NETWR, give type NUMC15. This would solve your problem.
10-07-2010 7:43 AM
Example:
TYPE-POOLS SLIS.
DATA: BEGIN OF ITAB OCCURS 0,
BELNR LIKE BSEG-BELNR,
GJAHR TYPE I,
WRBTR TYPE I,
WAERS LIKE BKPF-WAERS,
TOTAL TYPE P,
AUGDT type BSEG-AUGDT,
END OF ITAB.
DATA: LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_EVENTS TYPE SLIS_T_EVENT,
FCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
REC_FCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
START-OF-SELECTION.
FCAT-COL_POS = 1.
FCAT-FIELDNAME = 'BELNR'.
FCAT-TABNAME = 'ITAB'.
FCAT-REF_FIELDNAME = 'BELNR'.
FCAT-REF_TABNAME = 'BSEG'.
APPEND FCAT.
FCAT-COL_POS = 2.
FCAT-FIELDNAME = 'GJAHR'.
FCAT-TABNAME = 'ITAB'.
FCAT-REF_FIELDNAME = 'GJAHR'.
FCAT-DATATYPE = 'INT4'.
FCAT-INTTYPE = 'I'.
FCAT-DO_SUM = 'X'.
APPEND FCAT.
FCAT-COL_POS = 3.
FCAT-FIELDNAME = 'WRBTR'.
FCAT-TABNAME = 'ITAB'.
FCAT-DATATYPE = 'INT4'.
FCAT-INTTYPE = 'I'.
FCAT-DO_SUM = 'X'.
APPEND FCAT.
FCAT-COL_POS = 4.
FCAT-FIELDNAME = 'TOTAL'.
FCAT-TABNAME = 'ITAB'.
* FCAT-DATATYPE = 'INT4'.
FCAT-INTTYPE = 'P'.
FCAT-DO_SUM = 'X'.
APPEND FCAT.
FCAT-COL_POS = 5.
FCAT-FIELDNAME = 'AUGDT'.
FCAT-TABNAME = 'ITAB'.
FCAT-REF_FIELDNAME = 'AUGDT'.
FCAT-REF_TABNAME = 'BSEG'.
APPEND FCAT.
BREAK DEVELOPER.
DO 100 TIMES.
ITAB-WRBTR = SY-INDEX.
ITAB-GJAHR = SY-INDEX + 1.
ITAB-TOTAL = ITAB-WRBTR / ITAB-GJAHR.
itab-AUGDT = sy-datum.
APPEND ITAB.
ENDDO.
*CALLING ALV
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = 'Z_TOT_ALV'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FCAT[]
I_TABNAME = 'ITAB'
IT_EVENTS = IT_EVENTS[]
TABLES
T_OUTTAB = ITAB[].
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.