09-03-2009 8:49 PM
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.
09-03-2009 10:34 PM
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.
09-03-2009 8:58 PM
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.
a®
09-03-2009 9:06 PM
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
09-03-2009 9:13 PM
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
09-03-2009 9:20 PM
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.
a®
09-03-2009 10:34 PM
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.