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

runtime errors - BCD_FIELD_OVERFLOW

Former Member
0 Likes
2,131

Runtime Errors BCD_FIELD_OVERFLOW

Hi , i get the run time error BCD_FIELD_OVERFLOW in my customize program. But this program i m copy from the standard program RFDKLI41 (transaction code f.35). FOllowing are the code that occur the error. Please kindly advise.

8 *----


9 FORM ausschoepfungsgrad_berechnen USING

10 a01_klimk LIKE knkk-klimk.

11 *ORM AUSSCHOEPFUNGSGRAD_BERECHNEN USING A01_KLIMK.

12 DATA: ld_refe1(16) TYPE p.

13 CLEAR: ld_refe1.

14 IF a01_klimk = 0

15 OR rf02l-oblig < 0.

16 CLEAR: rf02l-klprz.

17 ELSE.

18 ld_refe1 = ( rf02l-oblig * 10000 ) / a01_klimk.

19 ENDIF.

20 IF a01_klimk = 0

21 AND rf02l-oblig > 0.

22 ld_refe1 = 99999.

23 ENDIF.

24 IF ld_refe1 > 99999.

25 rf02l-klprz = 99999.

26 ELSE.

>>>>> rf02l-klprz = ld_refe1.

28 ENDIF.

29 ENDFORM. "AUSSCHOEPFUNGSGRAD_BERECHNEN

4 REPLIES 4
Read only

MariaJooRocha
Contributor
0 Likes
1,307

Hi,

ld_refe1(16) is TYPE p

and

RF02L-KLPRZ (dec 5 - with 2 decimal places) !

Best regards,

Maria João Rocha

Read only

StMou
Active Participant
0 Likes
1,307

Hi,

You can only have max value equal to 999.99.

Try with this.


CONSTANTS CO_MAX TYPE rf02l-klprz value `999.99`.


*--------------------------------------------------------------
FORM ausschoepfungsgrad_berechnen USING a01_klimk LIKE knkk-klimk.
*orm ausschoepfungsgrad_berechnen using a01_klimk.
  DATA: ld_refe1(16) TYPE p.
  CLEAR: ld_refe1.
  IF a01_klimk = 0
  OR rf02l-oblig < 0.
    CLEAR: rf02l-klprz.
  ELSE.
    ld_refe1 = ( rf02l-oblig * 10000 ) / a01_klimk.
  ENDIF.
  IF a01_klimk = 0
  AND rf02l-oblig > 0.
    ld_refe1 = CO_MAX.
  ENDIF.
  IF ld_refe1 > CO_MAX.
    rf02l-klprz = CO_MAX.
  ELSE.
    rf02l-klprz = ld_refe1.
  ENDIF.
ENDFORM. "AUSSCHOEPFUNGSGRAD_BERECHNEN

Read only

Former Member
0 Likes
1,307

Hi pingping:

Declare ld_refe1 like the same type of rf02l-klprz.

DATA: ld_refe1 LIKE rf02l-klprz.

Regards,

Read only

Former Member
0 Likes
1,307

you can use

catch system-exceptions bcd_zerodivide = 1.

ld_refe1 = ( rf02l-oblig * 10000 ) / a01_klimk.

endcatch.