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: 

kursf and type p

kiran_k8
Active Contributor
0 Kudos

Hi Folks,

I have a field called kursf which is declared as rbkp-kursf.

The thing is that I am having an internal table itab which is having some data alng with kursf which I am summing it up using SUM.

In some instances it is giving dump with the below explanation.

Field too small when calculating totals in internal table.

************

In the internal table "\PROGRAM=ZFI\DATA=IT_HEADER[]", a SUM statement is used to calculate totals. However, the values are too large for the designated field.

The name of the field is "KURSF".

The name of the field is "KURSF".

***********

The field "KURSF" in the program "ZFI" be a different

type (e.g. type P of appropriate length).

Should I change the declaration of kursf as type p decimals 5?

Kindly let me know.

K.Kiran.

4 REPLIES 4

Former Member
0 Kudos

KURSF is an Exchange rate, so the sum of kursf wouldn't mean much... something like

"fx_rate(16)   type p decimals 5,"

should give you plenty of space for your sum!

0 Kudos

Jonathan,

itab1 and itab2 is having the kursf as rbkpf-kursf.

LOOP AT itab1.

MOVE-CORRESPONDING itab1 TO itab2.

APPEND itab2.

ENDLOOP.

SORT itab2 BY belnr.

LOOP AT itab2.

AT END OF belnr.

READ TABLE itab2 INDEX sy-tabix.

SUM.

I am doing the SUM only at end of belnr in itab2,So,if I change the declaration of kursf in itab2 that will be enough,right? or do i have to change in both itab1 and itab2?

Thanks,

K.Kiran.

0 Kudos

The logic shown confuses me a little - why "read table ITAB2" when you are in a loop around it already... plus the online helps says:

"Prerequisites for using the statement SUM include using the addition INTO in the LOOP statement" and sample they gives is:

LOOP AT sflight_tab INTO sflight_wa.  "loop into structure
  WRITE: / sflight_wa-fldate, 
           sflight_wa-seatsocc. 
  AT END OF connid. 
    SUM. 
    ULINE. 
    WRITE: / 'Sum', 
              sflight_wa-seatsocc UNDER sflight_wa-seatsocc. "uses structure
    SKIP. 
  ENDAT.

Based on this, you could try just changing in in ITAB2 and the structure you loop into with ITAB2.

0 Kudos

Jonathan,

After SUM I am moving ITAB 2 to ITAB3 which is displayed in ALV.

Thanks,

K.Kiran.