Skip to Content
0
Former Member
Feb 16, 2009 at 11:40 AM

SUM_OVERFLOW Error

81 Views

Hi Experts,

Iam getting SUM_OVERFLOW while executing my report,Plz find my CODE

*TABLES USED IN THIS REPORT *

----


TABLES : BSIK,LFA1.

*eject

*----


*DATA DECLARATION

*----


DATA : BEGIN OF ITAB OCCURS 100,

LIFNR LIKE BSIK-LIFNR,

GSBER LIKE BSIK-GSBER,

NAME1 LIKE LFA1-NAME1,

BUDAT LIKE BSIK-BUDAT,

DMBTR LIKE BSIK-DMBTR,

SHKZG LIKE BSIK-SHKZG,

**Included by e arthi on 09/02/09

ZFBDT LIKE BSIK-ZFBDT,

ZBD1T LIKE BSIK-ZBD1T,

DMBTR_30 LIKE BSIK-DMBTR,

DMBTR_45 LIKE BSIK-DMBTR,

DMBTR_60 LIKE BSIK-DMBTR,

DMBTR_90 LIKE BSIK-DMBTR,

DMBTR_120 LIKE BSIK-DMBTR,

DMBTR_121 LIKE BSIK-DMBTR,

DIFF TYPE I,

END OF ITAB.

DATA : DAT_30 LIKE BSIK-BUDAT.

DATA : DAT_31 LIKE BSIK-BUDAT.

DATA : DAT_45 LIKE BSIK-BUDAT.

DATA : DAT_46 LIKE BSIK-BUDAT.

DATA : DAT_60 LIKE BSIK-BUDAT.

DATA : DAT_61 LIKE BSIK-BUDAT.

DATA : DAT_90 LIKE BSIK-BUDAT.

DATA : DAT_91 LIKE BSIK-BUDAT.

DATA : DAT_120 LIKE BSIK-BUDAT.

DATA : DAT_121 LIKE BSIK-BUDAT.

DATA: AMT_30 LIKE BSIK-DMBTR.

RANGES R_BUDAT FOR BSIK-BUDAT.

*eject

----


*SELECTION-SCREEN *

----


SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME TITLE T1.

SELECT-OPTIONS: S_BUKRS FOR BSIK-BUKRS DEFAULT 'HML' NO INTERVALS

NO-EXTENSION,

S_GSBER FOR BSIK-GSBER NO INTERVALS

NO-EXTENSION,

**Included by e arthi on 10/2/09

S_LIFNR FOR BSIK-LIFNR.

.

PARAMETERS P_BUDAT TYPE BSIK-BUDAT OBLIGATORY.

SELECTION-SCREEN END OF BLOCK B.

----


*INITIALIZATION *

----


----


*INITIALIZATION *

----


INITIALIZATION.

T1 = 'SELECTION DETAILS'.

AT SELECTION-SCREEN ON P_BUDAT.

R_BUDAT-SIGN = 'I'.

R_BUDAT-OPTION = 'BT'.

R_BUDAT-HIGH = P_BUDAT.

R_BUDAT-LOW = '19970101'.

APPEND R_BUDAT.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = R_BUDAT-HIGH

days = 30

months = 0

signum = '-'

years = 0

importing

calc_date = DAT_30.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = R_BUDAT-HIGH

days = 31

months = 0

signum = '-'

years = 0

importing

calc_date = DAT_31.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = R_BUDAT-HIGH

days = 45

months = 0

signum = '-'

years = 0

importing

calc_date = DAT_45.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = R_BUDAT-HIGH

days = 46

months = 0

signum = '-'

years = 0

importing

calc_date = DAT_46.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = R_BUDAT-HIGH

days = 60

months = 0

signum = '-'

years = 0

importing

calc_date = DAT_60.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = R_BUDAT-HIGH

days = 61

months = 0

signum = '-'

years = 0

importing

calc_date = DAT_61.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = R_BUDAT-HIGH

days = 90

months = 0

signum = '-'

years = 0

importing

calc_date = DAT_90.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = R_BUDAT-HIGH

days = 91

months = 0

signum = '-'

years = 0

importing

calc_date = DAT_91.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = R_BUDAT-HIGH

days = 90

months = 1

signum = '-'

years = 0

importing

calc_date = DAT_120.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = R_BUDAT-HIGH

days = 30

months = 9

signum = '-'

years = 9

importing

calc_date = DAT_121.

*

*eject

----


*AT SELECTION-SCREEN *

----


*AT SELECTION-SCREEN.

*eject

----


*START-OF-SELECTION *

----


START-OF-SELECTION.

PERFORM DISPLAY.

*eject

*----


*END-OF-SELECTION

*----


END-OF-SELECTION.

*eject

----


  • 01. DISPLAY "DISPLAY LIST *

----


FORM DISPLAY.

DATA : BEGIN OF ITAB1 OCCURS 100,

LIFNR LIKE BSIK-LIFNR,

GSBER LIKE BSIK-GSBER,

NAME1 LIKE LFA1-NAME1,

BUDAT LIKE BSIK-BUDAT,

DMBTR LIKE BSIK-DMBTR,

SHKZG LIKE BSIK-SHKZG,

**Included by e arthi on 09/02/09

ZFBDT LIKE BSIK-ZFBDT,

ZBD1T LIKE BSIK-ZBD1T,

*

  • DMBTR_30 TYPE P DECIMALS 2,

  • DMBTR_45 TYPE P DECIMALS 2,

  • DMBTR_60 TYPE P DECIMALS 2,

  • DMBTR_90 TYPE P DECIMALS 2,

  • DMBTR_120 TYPE P DECIMALS 2,

  • DMBTR_121 TYPE P DECIMALS 2 ,

DMBTR_30 LIKE BSIK-DMBTR,

DMBTR_45 LIKE BSIK-DMBTR,

DMBTR_60 LIKE BSIK-DMBTR,

DMBTR_90 LIKE BSIK-DMBTR,

DMBTR_120 LIKE BSIK-DMBTR,

DMBTR_121 LIKE BSIK-DMBTR,

DIFF TYPE I,

END OF ITAB1.

DATA : BEGIN OF ITAB2 OCCURS 100,

LIFNR LIKE BSIK-LIFNR,

GSBER LIKE BSIK-GSBER,

NAME1 LIKE LFA1-NAME1,

BUDAT LIKE BSIK-BUDAT,

DMBTR LIKE BSIK-DMBTR,

SHKZG LIKE BSIK-SHKZG,

**Included by e arthi on 09/02/09

ZFBDT LIKE BSIK-ZFBDT,

ZBD1T LIKE BSIK-ZBD1T,

DMBTR_30 LIKE BSIK-DMBTR,

DMBTR_45 LIKE BSIK-DMBTR,

DMBTR_60 LIKE BSIK-DMBTR,

DMBTR_90 LIKE BSIK-DMBTR,

DMBTR_120 LIKE BSIK-DMBTR,

DMBTR_121 LIKE BSIK-DMBTR,

  • DMBTR_30 TYPE P DECIMALS 2,

  • DMBTR_45 TYPE P DECIMALS 2,

  • DMBTR_60 TYPE P DECIMALS 2,

  • DMBTR_90 TYPE P DECIMALS 2,

  • DMBTR_120 TYPE P DECIMALS 2,

  • DMBTR_121 TYPE P DECIMALS 2 ,

DIFF TYPE I,

END OF ITAB2.

----


*select query for bus.area 1310,comp code hml,posting date

----


SELECT BSIKLIFNR BSIKGSBER LFA1NAME1 BSIKBUDAT BSIKDMBTR BSIKSHKZG

BSIKZFBDT BSIKZBD1T

INTO TABLE ITAB

FROM ( BSIK INNER JOIN LFA1 ON LFA1LIFNR = BSIKLIFNR )

WHERE BSIK~BUKRS IN S_BUKRS

AND BSIK~GSBER IN S_GSBER

AND BSIK~BUDAT IN R_BUDAT

AND BSIK~LIFNR IN S_LIFNR.

  • AND ( BSIKSHKZG EQ 'H' OR BSIKSHKZG EQ 'S' ).

  • AND BSIK~LIFNR EQ 'D1S003'.

SORT ITAB BY LIFNR.

LOOP AT ITAB.

ITAB1-GSBER = ITAB-GSBER.

ITAB1-LIFNR = ITAB-LIFNR.

ITAB1-NAME1 = ITAB-NAME1.

  • ITAB1-BUDAT = ITAB-BUDAT.

ITAB1-DMBTR = ITAB-DMBTR.

ITAB1-SHKZG = ITAB-SHKZG.

**Included by e arthi on 9/2/09

ITAB1-ZFBDT = ITAB-ZFBDT.

ITAB1-ZBD1T = ITAB-ZBD1T.

APPEND ITAB1.

ENDLOOP.

  • WRITE : /1(10) 'Base Line Date',

  • 11(10) 'Cash Disc Days',

  • 22(10) 'Date',

  • 33(10) 'Days DIFF',

  • 44(10) 'I/P Date'.

LOOP AT ITAB1.

ITAB1-BUDAT = ITAB1-ZFBDT + ITAB1-ZBD1T.

ITAB1-DIFF = P_BUDAT - ITAB1-BUDAT.

MODIFY ITAB1.

  • WRITE : /1(10) ITAB1-ZFBDT,

  • 11(10) ITAB1-ZBD1T,

  • 22(10) ITAB1-BUDAT,

  • 33(10) ITAB1-DIFF,

  • 44(10) P_BUDAT.

ENDLOOP.

----


*0-30 days

LOOP AT ITAB1.

IF ITAB1-DIFF GT 0 AND ITAB1-DIFF LE 30.

IF ITAB1-SHKZG = 'H'.

MOVE ITAB1-DMBTR TO ITAB1-DMBTR_30.

ITAB1-DMBTR_30 = ITAB1-DMBTR_30 * ( -1 ).

MODIFY ITAB1.

ENDIF.

IF ITAB1-SHKZG = 'S'.

MOVE ITAB1-DMBTR TO ITAB1-DMBTR_30.

ITAB1-DMBTR_30 = ITAB1-DMBTR_30 * ( 1 ).

MODIFY ITAB1.

ENDIF.

ENDIF.

**31-45 days

IF ITAB1-DIFF GT 30 AND ITAB1-DIFF LE 45.

*IF ITAB1-BUDAT GT DAT_45 AND ITAB1-BUDAT LE DAT_30 .

IF ITAB1-SHKZG = 'H'.

MOVE ITAB1-DMBTR TO ITAB1-DMBTR_45.

ITAB1-DMBTR_45 = ITAB1-DMBTR_45 * ( -1 ).

MODIFY ITAB1.

ENDIF.

IF ITAB1-SHKZG = 'S'.

MOVE ITAB1-DMBTR TO ITAB1-DMBTR_45.

ITAB1-DMBTR_45 = ITAB1-DMBTR_45 * ( 1 ).

MODIFY ITAB1.

ENDIF.

ENDIF.

*

**46-60 days

IF ITAB1-DIFF GT 45 AND ITAB1-DIFF LE 60.

*IF ITAB1-BUDAT GT DAT_60 AND ITAB1-BUDAT LE DAT_45 .

IF ITAB1-SHKZG = 'H'.

MOVE ITAB1-DMBTR TO ITAB1-DMBTR_60.

ITAB1-DMBTR_60 = ITAB1-DMBTR_60 * ( -1 ).

MODIFY ITAB1.

ENDIF.

IF ITAB1-SHKZG = 'S'.

MOVE ITAB1-DMBTR TO ITAB1-DMBTR_60.

ITAB1-DMBTR_60 = ITAB1-DMBTR_60 * ( 1 ).

MODIFY ITAB1.

ENDIF.

ENDIF.

**61-90 days

IF ITAB1-DIFF GT 60 AND ITAB1-DIFF LE 90.

*IF ITAB1-BUDAT GT DAT_90 AND ITAB1-BUDAT LE DAT_60 .

IF ITAB1-SHKZG = 'H'.

MOVE ITAB1-DMBTR TO ITAB1-DMBTR_90.

ITAB1-DMBTR_90 = ITAB1-DMBTR_90 * ( -1 ).

MODIFY ITAB1.

ENDIF.

IF ITAB1-SHKZG = 'S'.

MOVE ITAB1-DMBTR TO ITAB1-DMBTR_90.

ITAB1-DMBTR_90 = ITAB1-DMBTR_90 * ( 1 ).

MODIFY ITAB1.

ENDIF.

ENDIF.

**91-120 days

IF ITAB1-DIFF GT 90 AND ITAB1-DIFF LE 120.

*IF ITAB1-BUDAT GT DAT_120 AND ITAB1-BUDAT LE DAT_90.

IF ITAB1-SHKZG = 'H'.

MOVE ITAB1-DMBTR TO ITAB1-DMBTR_120.

ITAB1-DMBTR_120 = ITAB1-DMBTR_120 * ( -1 ).

MODIFY ITAB1.

ENDIF.

IF ITAB1-SHKZG = 'S'.

MOVE ITAB1-DMBTR TO ITAB1-DMBTR_120.

ITAB1-DMBTR_120 = ITAB1-DMBTR_120 * ( 1 ).

MODIFY ITAB1.

ENDIF.

ENDIF.

*

**>120 days

IF ITAB1-DIFF GT 120.

*IF ITAB1-BUDAT GE DAT_121 AND ITAB1-BUDAT LE DAT_120.

IF ITAB1-SHKZG = 'H'.

MOVE ITAB1-DMBTR TO ITAB1-DMBTR_121.

ITAB1-DMBTR_121 = ITAB1-DMBTR_121 * ( -1 ).

MODIFY ITAB1.

ENDIF.

IF ITAB1-SHKZG = 'S'.

MOVE ITAB1-DMBTR TO ITAB1-DMBTR_121.

ITAB1-DMBTR_121 = ITAB1-DMBTR_121 * ( 1 ).

MODIFY ITAB1.

ENDIF.

ENDIF.

ENDLOOP.

SORT ITAB1 BY LIFNR.

*----


*

LOOP AT ITAB1.

AT END OF NAME1.

WRITE : /1(10) ITAB1-GSBER.

WRITE : 11(10) ITAB1-LIFNR.

WRITE : 22(35) ITAB1-NAME1.

ENDAT.

AT END OF LIFNR.

SUM.

WRITE : 58(15) ITAB1-DMBTR_30.

WRITE : 73(15) ITAB1-DMBTR_45,

: 89(15) ITAB1-DMBTR_60,

: 105(15) ITAB1-DMBTR_90,

: 121(15) ITAB1-DMBTR_120,

: 137(15) ITAB1-DMBTR_121.

ENDAT.

ENDLOOP.

*

  • WRITE : 58(15) AMT_30.

  • WRITE : / 'POSTING DATE - ', P_BUDAT,

    • : DAT_30,

  • : /'0-30 DAYS - ',DAT_30,

    • : ,DAT_45,

  • : /'31-45 - ',DAT_45,

    • : DAT_60,

  • : /'46-60 - ',DAT_60,

    • : DAT_90,

  • : /'61-90 - ',DAT_90,

    • : DAT_120,

  • : /'91-120 - ',DAT_120,

    • : DAT_121,

  • : /'>120 - ',DAT_121.

  • ENDFORM.

    *----


    • eject

    ***----


    *-

    ***

    • TOP-OF-PAGE

    ***

    ***----


    *-

    ***

    TOP-OF-PAGE.

    • DESIGING REPORT FORMAT TO DISPLAY THE LIST

    WRITE : /40 'VENDOR AGING REPORT', SY-DATUM,

    120 'PAGE:',

    125 SY-PAGNO .

    WRITE : /1(152) SY-ULINE.

    WRITE : /1(10) 'BUS.AREA',

    11(10) 'VENDOR',

    22(35) 'NAME',

    58(15) '0-30',

    73(15) '31-45',

    89(15) '46-60',

    105(15) '61-90',

    121(15) '91-120',

    137(15) '>120'.

    *

    ***eject

    ***----


    *-

    ***

    • END-OF-PAGE

    ***

    ***----


    *-

    **

    *END-OF-PAGE.

    • WRITE : /1(152) SY-ULINE.