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: 

ABAP Short Dump -> COMPUTE_BCD_OVERFLOW -> CX_SY_ARITHMETIC_OVERFLOW

Former Member

Runtime errors COMPUTE_BCD_OVERFLOW

Exception CX_SY_ARITHMETIC_OVERFLOW

I want to move Currency variable with 4 decimals to another currency variable with 2 decimals. Please advice me with a suitable solution without causing short dump.

Appreciate Your Help in Advance.

Thanks.

Kannan.

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos

SAP catch the exception like this :

CATCH SYSTEM-EXCEPTIONS conversion_errors = 1
                                    arithmetic_errors = 5.
              xkwert = xkomv-kwert * 1000 * xkomv-kpein / komp-mgame.
              xkomv-kbetr = xkwert.
            ENDCATCH.
            IF sy-subrc = 1 OR sy-subrc = 5.
              xkomv-kbetr = 0.
              xkomv-fxmsg = '802'.
              komp-fxmsg  = '802'.
            ENDIF.

5 REPLIES 5

former_member194669
Active Contributor
0 Kudos

Instead of moving directly use WRITE along with NO-GROUPING addition


WRITE v_4_dec_variable NO-GROUPING DECIMALS 2 to v_2_dec_variable. 

0 Kudos

write: lv_4 decimals no-grouping decimals 2 to lv2_decimals.

I am gettign Syntax Erroe lv_2_decimals must be a character-type field (data type C, N, D, or T).an open control structure introduced by "INTERFACE".

Thanks,

Kannan

0 Kudos

Hi,

Why dont you use simple assignment?



data: lv_4_decimals type p decimals 4,
        lv_2_decimals type p decimals 2.

lv_4_decimals = '345.4521'.

lv_2_decimals = lv_4_decimals.

write: lv_2_decimals.

Regards,

Vikranth

0 Kudos

Check this


report zaRs
       no standard page heading line-size 255.

DATA pack TYPE p LENGTH 8 DECIMALS 4 VALUE '1234.5678'.
DATA pack1 TYPE p LENGTH 8 DECIMALS 2.

 call function 'ROUND'
   exporting
    DECIMALS            = 2
     input               = pack
  IMPORTING
    OUTPUT              = pack1.

write :  pack1.

former_member156446
Active Contributor
0 Kudos

SAP catch the exception like this :

CATCH SYSTEM-EXCEPTIONS conversion_errors = 1
                                    arithmetic_errors = 5.
              xkwert = xkomv-kwert * 1000 * xkomv-kpein / komp-mgame.
              xkomv-kbetr = xkwert.
            ENDCATCH.
            IF sy-subrc = 1 OR sy-subrc = 5.
              xkomv-kbetr = 0.
              xkomv-fxmsg = '802'.
              komp-fxmsg  = '802'.
            ENDIF.