09-19-2006 7:57 AM
Hello,
how do you catch the error of a function module that is called from within a method. Presently the process terminates in case of an exceptions. Sy-subrc seems also not to work.
E.G.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
client = sy-mandt
date = SOURCE_FIELDS-xxx
foreign_amount = SOURCE_FIELDS-xxx
foreign_currency = SOURCE_FIELDS-xxx
local_currency = SOURCE_FIELDS-xxx
IMPORTING
local_amount = RESULT
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
DERIVED_2_TIMES = 5
OTHERS = 6.
09-19-2006 7:59 AM
Hi,
Please uncomment the exceptions part and then check the sy-subrc .
You'll have to uncomment evrything from exceptions till the last .
Regards
Nishant
Message was edited by: Nishant Rustagi
09-19-2006 7:59 AM
HI,
use 'EXCEPTIONS' to catch the error happens in FM.
uncomment all your exceptions when calling FM.
and you will get the exception number in sy-subrc.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
client = sy-mandt
date = SOURCE_FIELDS-xxx
foreign_amount = SOURCE_FIELDS-xxx
foreign_currency = SOURCE_FIELDS-xxx
local_currency = SOURCE_FIELDS-xxx
IMPORTING
local_amount = RESULT
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
DERIVED_2_TIMES = 5
OTHERS = 6.
if sy-subrc = 2.
message e000(su) 'overflow.
endif.
Regards,