Application Development and Automation 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: 
Read only

data overflow in following code why? urgent help req

Former Member
0 Likes
1,805

in the following code when i am executing it is going to dump with message

'VALUE TOO LARGE FOR CALCULATING TOTALS IN INTERNAL TABLE,

FIELD TOO '

i don't know why?

plz check my code and give the solution .

&----


*& Report Z_VENDOR AGEING *

*& *

&----


*& in this repoet I am calculating the vendor ageing

which is depending on formula

AGEING = Current Date(or any date entered by user) – Bline Date(BSIK-ZFBDT) *

*& *

&----


REPORT z_vendor NO STANDARD PAGE HEADING

LINE-SIZE 200

LINE-COUNT 65(3).

TABLES : bsik.

DATA : BEGIN OF t_out OCCURS 0,

bukrs LIKE bsik-bukrs,

saknr LIKE bsik-saknr,

bldat LIKE bsik-bldat,

wrbtr LIKE bsik-wrbtr,

lifnr LIKE bsik-lifnr,

zfbdt like bsik-zfbdt,

zbd1t like bsik-zbd1t,

ageing type i,

END OF t_out.

parameters : p_date1 type d.

SELECT-OPTIONS : s_bukrs FOR bsik-bukrs,

s_saknr FOR bsik-saknr,

s_lifnr FOR bsik-lifnr.

SELECT bukrs saknr bldat wrbtr lifnr zfbdt zbd1t

FROM bsik

INTO TABLE t_out

WHERE saknr IN s_saknr

AND bukrs IN s_bukrs

AND lifnr IN s_lifnr.

Loop at t_out.

CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'

EXPORTING

i_datum_bis = p_date1

i_datum_von = t_out-zfbdt

  • I_KZ_EXCL_VON = '0'

  • I_KZ_INCL_BIS = '0'

  • I_KZ_ULT_BIS = ' '

  • I_KZ_ULT_VON = ' '

  • I_STGMETH = '0'

  • I_SZBMETH = '1'

IMPORTING

E_TAGE = t_out-ageing

  • EXCEPTIONS

  • DAYS_METHOD_NOT_DEFINED = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Modify t_out.

Clear t_out.

Endloop.

LOOP AT T_OUT.

IF T_OUT-SHKZG = ‘H’.

T_OUT-WRBTR = T_OUT-WRBTR * -1.

T_OUT-WRBTR = T_OUT-DMBTR * -1.

ENDIF.

DATA: TOTAL(16) TYPE P DECIMALS 2.

TOTAL = TOTAL + T_OUT-DMBTR.

WRITE : / t_out-saknr,

t_out-lifnr,

t_out-wrbtr,

t_out-zfbdt,

T_OUT-DMBTR,

t_out-ageing.

AT LAST.

SUM.

WRITE:/ TOTAL.

CLEAR TOTAL.

ENDAT.

ENDLOOP.

Message was edited by: sanjeev singh

1 ACCEPTED SOLUTION
Read only

anversha_s
Active Contributor
0 Likes
1,721

hi,

REPORT z_vendor NO STANDARD PAGE HEADING

LINE-SIZE 200

LINE-COUNT 65(3).

TABLES : bsik.

DATA : BEGIN OF t_out OCCURS 0,

bukrs LIKE bsik-bukrs,

saknr LIKE bsik-saknr,

bldat LIKE bsik-bldat,

wrbtr LIKE bsik-wrbtr,

lifnr LIKE bsik-lifnr,

zfbdt like bsik-zfbdt,

zbd1t like bsik-zbd1t,

ageing type i,

END OF t_out.

parameters : p_date1 type d.

SELECT-OPTIONS : s_bukrs FOR bsik-bukrs,

s_saknr FOR bsik-saknr,

s_lifnr FOR bsik-lifnr.

SELECT bukrs saknr bldat wrbtr lifnr zfbdt zbd1t

FROM bsik

INTO TABLE t_out

WHERE saknr IN s_saknr

AND bukrs IN s_bukrs

AND lifnr IN s_lifnr.

Loop at t_out.

CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'

EXPORTING

i_datum_bis = p_date1

i_datum_von = t_out-zfbdt

  • I_KZ_EXCL_VON = '0'

  • I_KZ_INCL_BIS = '0'

  • I_KZ_ULT_BIS = ' '

  • I_KZ_ULT_VON = ' '

  • I_STGMETH = '0'

  • I_SZBMETH = '1'

IMPORTING

E_TAGE = t_out-ageing

  • EXCEPTIONS

  • DAYS_METHOD_NOT_DEFINED = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Modify t_out.

Clear t_out.

Endloop.

<b>LOOP AT T_OUT.</b> " <b>where is the end loop</b>

IF T_OUT-SHKZG = ‘H’.

T_OUT-WRBTR = T_OUT-WRBTR * -1.

T_OUT-WRBTR = T_OUT-DMBTR * -1.

ENDIF.

DATA: TOTAL(16) TYPE P DECIMALS 2.

TOTAL = TOTAL + T_OUT-DMBTR.

LOOP AT t_out.

WRITE : / t_out-saknr,

t_out-lifnr,

t_out-wrbtr,

t_out-zfbdt,

T_OUT-DMBTR,

t_out-ageing.

AT LAST.

SUM.

WRITE:/ TOTAL.

CLEAR TOTAL.

ENDAT.

ENDLOOP.

rgds

anver

in the following code when i am executing it is going to dump with message

'VALUE TOO LARGE FOR CALCULATING TOTALS IN INTERNAL TABLE,

FIELD TOO '

i don't know why?

plz check my code and give the solution .

&----


*& Report Z_VENDOR AGEING *

*& *

&----


*& in this repoet I am calculating the vendor ageing

which is depending on formula

AGEING = Current Date(or any date entered by user) – Bline Date(BSIK-ZFBDT) *

*& *

&----


REPORT z_vendor NO STANDARD PAGE HEADING

LINE-SIZE 200

LINE-COUNT 65(3).

TABLES : bsik.

DATA : BEGIN OF t_out OCCURS 0,

bukrs LIKE bsik-bukrs,

saknr LIKE bsik-saknr,

bldat LIKE bsik-bldat,

wrbtr LIKE bsik-wrbtr,

lifnr LIKE bsik-lifnr,

zfbdt like bsik-zfbdt,

zbd1t like bsik-zbd1t,

ageing type i,

END OF t_out.

parameters : p_date1 type d.

SELECT-OPTIONS : s_bukrs FOR bsik-bukrs,

s_saknr FOR bsik-saknr,

s_lifnr FOR bsik-lifnr.

SELECT bukrs saknr bldat wrbtr lifnr zfbdt zbd1t

FROM bsik

INTO TABLE t_out

WHERE saknr IN s_saknr

AND bukrs IN s_bukrs

AND lifnr IN s_lifnr.

Loop at t_out.

CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'

EXPORTING

i_datum_bis = p_date1

i_datum_von = t_out-zfbdt

  • I_KZ_EXCL_VON = '0'

  • I_KZ_INCL_BIS = '0'

  • I_KZ_ULT_BIS = ' '

  • I_KZ_ULT_VON = ' '

  • I_STGMETH = '0'

  • I_SZBMETH = '1'

IMPORTING

E_TAGE = t_out-ageing

  • EXCEPTIONS

  • DAYS_METHOD_NOT_DEFINED = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Modify t_out.

Clear t_out.

Endloop.

LOOP AT T_OUT.

IF T_OUT-SHKZG = ‘H’.

T_OUT-WRBTR = T_OUT-WRBTR * -1.

T_OUT-WRBTR = T_OUT-DMBTR * -1.

ENDIF.

DATA: TOTAL(16) TYPE P DECIMALS 2.

TOTAL = TOTAL + T_OUT-DMBTR.

WRITE : / t_out-saknr,

t_out-lifnr,

t_out-wrbtr,

t_out-zfbdt,

T_OUT-DMBTR,

t_out-ageing.

AT LAST.

SUM.

WRITE:/ TOTAL.

CLEAR TOTAL.

ENDAT.

ENDLOOP.

Message was edited by: sanjeev singh

17 REPLIES 17
Read only

Former Member
0 Likes
1,721

Hi

Debug the program na u will trace where exactly the error is coming and where it is going into dump.

Regards

haritha

Read only

Former Member
0 Likes
1,721

Hello,

1. U are running the internal table 'LOOP AT t_out.',twice why i dont understand.

2.Try to change the chracterstics of the varible for which the it is overflowing.Make it Packed decimals.

Please check this and let me know.

Regards

Read only

anversha_s
Active Contributor
0 Likes
1,722

hi,

REPORT z_vendor NO STANDARD PAGE HEADING

LINE-SIZE 200

LINE-COUNT 65(3).

TABLES : bsik.

DATA : BEGIN OF t_out OCCURS 0,

bukrs LIKE bsik-bukrs,

saknr LIKE bsik-saknr,

bldat LIKE bsik-bldat,

wrbtr LIKE bsik-wrbtr,

lifnr LIKE bsik-lifnr,

zfbdt like bsik-zfbdt,

zbd1t like bsik-zbd1t,

ageing type i,

END OF t_out.

parameters : p_date1 type d.

SELECT-OPTIONS : s_bukrs FOR bsik-bukrs,

s_saknr FOR bsik-saknr,

s_lifnr FOR bsik-lifnr.

SELECT bukrs saknr bldat wrbtr lifnr zfbdt zbd1t

FROM bsik

INTO TABLE t_out

WHERE saknr IN s_saknr

AND bukrs IN s_bukrs

AND lifnr IN s_lifnr.

Loop at t_out.

CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'

EXPORTING

i_datum_bis = p_date1

i_datum_von = t_out-zfbdt

  • I_KZ_EXCL_VON = '0'

  • I_KZ_INCL_BIS = '0'

  • I_KZ_ULT_BIS = ' '

  • I_KZ_ULT_VON = ' '

  • I_STGMETH = '0'

  • I_SZBMETH = '1'

IMPORTING

E_TAGE = t_out-ageing

  • EXCEPTIONS

  • DAYS_METHOD_NOT_DEFINED = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Modify t_out.

Clear t_out.

Endloop.

<b>LOOP AT T_OUT.</b> " <b>where is the end loop</b>

IF T_OUT-SHKZG = ‘H’.

T_OUT-WRBTR = T_OUT-WRBTR * -1.

T_OUT-WRBTR = T_OUT-DMBTR * -1.

ENDIF.

DATA: TOTAL(16) TYPE P DECIMALS 2.

TOTAL = TOTAL + T_OUT-DMBTR.

LOOP AT t_out.

WRITE : / t_out-saknr,

t_out-lifnr,

t_out-wrbtr,

t_out-zfbdt,

T_OUT-DMBTR,

t_out-ageing.

AT LAST.

SUM.

WRITE:/ TOTAL.

CLEAR TOTAL.

ENDAT.

ENDLOOP.

rgds

anver

Read only

0 Likes
1,721

sorry anvera

actually i have used loop at t_out twice but now i have used it once u can check the code i have modified it .

but still data overeflows for total why?

Read only

0 Likes
1,721

hi sanjeev,

where is this value - > <b>T_OUT-DMBTR</b>

there is no field like that in T_OUT.

rgds

anver

Read only

0 Likes
1,721

<b>CHECK the below</b>

Please change the last LOOP code as below...bold add the line and underline is to delete the line.

<b>DATA: TOTAL(18) TYPE P DECIMALS 2.</b>LOOP AT T_OUT.

IF T_OUT-SHKZG = ‘H’.

T_OUT-WRBTR = T_OUT-WRBTR * -1.

T_OUT-WRBTR = T_OUT-DMBTR * -1.

ENDIF.

TOTAL = TOTAL + T_OUT-DMBTR.

WRITE : / t_out-saknr,

t_out-lifnr,

t_out-wrbtr,

t_out-zfbdt,

T_OUT-DMBTR,

t_out-ageing.

AT LAST.

<u>SUM.</u>

WRITE:/ TOTAL.

CLEAR TOTAL.

ENDAT.

ENDLOOP.

Message was edited by: Anurag Bankley

Read only

0 Likes
1,721

try.

*DATA: TOTAL(16) TYPE P DECIMALS 2.

<b> data: total type TGFMV.</b>

TOTAL = TOTAL + T_OUT-DMBTR.

WRITE : / t_out-saknr,

t_out-lifnr,

t_out-wrbtr,

t_out-zfbdt,

T_OUT-DMBTR,

t_out-ageing.

AT LAST.

SUM.

WRITE:/ TOTAL.

CLEAR TOTAL.

ENDAT.

ENDLOOP.

Read only

0 Likes
1,721

Hi,

Change The Data Type of total if ur values are tooo large.And do Not Declare a Variable inside a Loop .Make at The begining of the program.

Regards

Ahasan

Read only

0 Likes
1,721

i might have forgotten to mention yaar.

u think that t_out dmbtr is there.

and give the possible solution.

i

Read only

0 Likes
1,721

hi kishan

what is this TGFMV.

when i used it a message comes that this type doesn't exist.

Read only

0 Likes
1,721

hi anurag

for type p only 16 is allowed boss.

so give some other solutions

Read only

0 Likes
1,721

The problem is with the SUM statement..take that out as you need only the total calculated by you rather than all fields.

Read only

0 Likes
1,721

hi,

now try this code.

TABLES : bsik.

DATA : BEGIN OF t_out OCCURS 0,

bukrs LIKE bsik-bukrs,

saknr LIKE bsik-saknr,

bldat LIKE bsik-bldat,

wrbtr LIKE bsik-wrbtr,

lifnr LIKE bsik-lifnr,

zfbdt like bsik-zfbdt,

zbd1t like bsik-zbd1t,

ageing type i,

END OF t_out.

parameters : p_date1 type d.

SELECT-OPTIONS : s_bukrs FOR bsik-bukrs,

s_saknr FOR bsik-saknr,

s_lifnr FOR bsik-lifnr.

SELECT bukrs saknr bldat wrbtr lifnr zfbdt zbd1t

FROM bsik

INTO TABLE t_out

WHERE saknr IN s_saknr

AND bukrs IN s_bukrs

AND lifnr IN s_lifnr.

Loop at t_out.

CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'

EXPORTING

i_datum_bis = p_date1

i_datum_von = t_out-zfbdt

  • I_KZ_EXCL_VON = '0'

  • I_KZ_INCL_BIS = '0'

  • I_KZ_ULT_BIS = ' '

  • I_KZ_ULT_VON = ' '

  • I_STGMETH = '0'

  • I_SZBMETH = '1'

IMPORTING

E_TAGE = t_out-ageing

  • EXCEPTIONS

  • DAYS_METHOD_NOT_DEFINED = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Modify t_out.

Clear t_out.

Endloop.

<b>DATA: TOTAL(16) TYPE P DECIMALS 2.</b>

<b>LOOP AT T_OUT.</b>

IF T_OUT-SHKZG = ‘H’.

T_OUT-WRBTR = T_OUT-WRBTR * -1.

<b>T_OUT-DMBTR = T_OUT-DMBTR * -1.</b>

ENDIF.

<b>TOTAL = TOTAL + T_OUT-WRBTR + T_OUT-DMBTR.</b>

WRITE : / t_out-saknr,

t_out-lifnr,

t_out-wrbtr,

t_out-zfbdt,

T_OUT-DMBTR,

t_out-ageing.

<b>AT LAST.

WRITE:/ TOTAL.

CLEAR TOTAL.

ENDAT.</b>

<b>ENDLOOP.</b>

rgds

anver

if hlped mark points

Read only

0 Likes
1,721

hi anurag

thanks the problem was with the sum st only.

bye

Read only

0 Likes
1,721

Hello Sanjeev,

Can u tell me how the problem is solved.

Code will be more help full.

Regards,

Ravi

Read only

Former Member
0 Likes
1,721

hi Sanjeev,

try this way out

LOOP AT T_OUT.

IF T_OUT-SHKZG = ‘H’.

T_OUT-WRBTR = <b> (( T_OUT-WRBTR ) * -1 )</b>.

T_OUT-WRBTR = <b> (( T_OUT-DMBTR ) * -1 )</b>.

ENDIF.

DATA: TOTAL(16) TYPE P DECIMALS 2.

TOTAL = TOTAL + T_OUT-DMBTR.

<b>ENDLOOP.</b>

Regards,

Santosh

Read only

anversha_s
Active Contributor
0 Likes
1,721

hi sanjeev,

if ur issue solved, kindly close the thread after giving points to helpful answers.

rgds

anver