‎2008 Jul 28 6:55 PM
Hi All,
I am getting the Run time error at SUM statement,'Field too small when calculating totals in internal table.'. How should I eliminate this error. Please help.
Thanks,
Veni.
SORT itab_input BY chkno kunnr.
LOOP AT itab_input INTO wa_input.
MOVE wa_input-chkno TO wa_line-chkno.
MOVE wa_input-kunnr TO wa_line-kunnr.
MOVE wa_input-invno TO wa_line-vbeln.
MOVE wa_input-invmt TO wa_line-wrbtr.
MOVE wa_input-rcode TO wa_line-rstgr.
IF wa_input-invmt < 0.
wa_line-shkzg = '-'.
ELSE.
wa_line-shkzg = '+'.
ENDIF.
AT END OF kunnr.
SUM.
MOVE wa_input-chkno TO wa_head-chkno.
MOVE wa_input-kunnr TO wa_head-kunnr.
MOVE wa_input-invmt TO wa_head-chkmt.
MOVE p_bldat TO wa_head-bldat.
MOVE p_budat TO wa_head-budat.
MOVE p_bukrs TO wa_head-bukrs.
MOVE p_blart TO wa_head-blart.
MOVE p_waers TO wa_head-waers.
MOVE m_buper+1(02) TO wa_head-monat.
MOVE p_konto TO wa_head-konto.
APPEND wa_head TO ihead.
CLEAR wa_head.
ENDAT.
APPEND wa_line TO iline.
CLEAR wa_line.
ENDLOOP.
‎2008 Jul 28 6:58 PM
Please check the definition of individual fields in the internal table.
While summing the values, if the resultant value is greater than the maximum allowed for that field, then you will get this error.
cheers,
Sushil Joshi
‎2008 Jul 28 6:58 PM
Please check the definition of individual fields in the internal table.
While summing the values, if the resultant value is greater than the maximum allowed for that field, then you will get this error.
cheers,
Sushil Joshi
‎2008 Jul 28 7:00 PM
THere is some problem with your internal table field declaration.
what ever sum it calculated it is overflowing, size problem.
use some Big size data element like DEC_25.
‎2008 Jul 28 9:20 PM
Thank you Sushil and Vijay.
Here is the exact error.
In the internal table "DATA=ITAB_INPUT", a SUM
statement is used to calculate totals.
However, the values are too large for the designated field.
The name of the field is "CHKMT".
It is declared as chkmt LIKE bseg-wrbtr,
Which is CURR 13 2.
My total invoice amount is 5433315.06, but number of lines in the file are 25,000. The total amount should fit in bseg-wrbtr, why I am getting the error.
While debugging it is giving dump at SUM.
AT END OF kunnr.
SUM.
MOVE wa_input-chkno TO wa_head-chkno.
MOVE wa_input-kunnr TO wa_head-kunnr.
MOVE wa_input-invmt TO wa_head-chkmt.
MOVE p_bldat TO wa_head-bldat.
TYPES: BEGIN OF type_input,
chkno LIKE bkpf-xblnr, "Check number
kunnr LIKE bseg-kunnr, "Customer
chkdt LIKE bseg-valut, "Check date
chkmt LIKE bseg-wrbtr, "Check amount
invno LIKE vbrk-vbeln, "Invoice number
invdt LIKE bseg-valut, "Invoice date
invmt LIKE bseg-wrbtr, "Invoice amount
rcode LIKE bseg-rstgr. "Reason code
TYPES: END OF type_input.
Please help me with the error.
Thanks,
Veni.
‎2008 Jul 28 9:27 PM
chkmt LIKE bseg-wrbtr, "Check amount
invmt LIKE bseg-wrbtr, "Invoice amount
the error might be one of the two fields.
you checked for check amount, what abt Invoice amount ?
and also what is the cheque number and kunnr in all the cases. is it varying or not..?
can you show first set of control break records.
‎2008 Jul 28 9:39 PM
Hi Vijay,
The Check num is 5142174, check amt 5479382.09 and Cusy num 1023. I have 25,000 invoice numbers. Invoice total = check total = 5479382.09.
TYPES: BEGIN OF type_input,
chkno LIKE bkpf-xblnr, "Check number
kunnr LIKE bseg-kunnr, "Customer
chkdt LIKE bseg-valut, "Check date
chkmt LIKE bseg-wrbtr, "Check amount
invno LIKE vbrk-vbeln, "Invoice number
invdt LIKE bseg-valut, "Invoice date
invmt LIKE bseg-wrbtr, "Invoice amount
rcode LIKE bseg-rstgr. "Reason code
TYPES: END OF type_input.
TYPES: BEGIN OF type_head,
chkno LIKE bkpf-xblnr,
kunnr LIKE bseg-kunnr,
chkmt LIKE bseg-wrbtr,
bldat LIKE bkpf-bldat,
budat LIKE bkpf-budat,
blart LIKE bkpf-blart,
bukrs LIKE bkpf-bukrs,
waers LIKE bkpf-waers,
monat LIKE bkpf-monat,
konto LIKE rf05a-konto.
TYPES: END OF type_head.
TYPES: BEGIN OF type_line,
chkno LIKE bkpf-xblnr,
kunnr LIKE bseg-kunnr,
shkzg LIKE bseg-shkzg,
vbeln LIKE bseg-vbeln,
wrbtr LIKE bseg-wrbtr,
rstgr LIKE bseg-rstgr.
TYPES: END OF type_line.
Please help me with the error.
Regards,
veni.
‎2008 Jul 28 11:05 PM
‎2008 Sep 15 5:16 PM