При выходе из метода по exception параметры, переданные по ссылке, изменяются, если они были изменены до вызова exception. Параметры, переданные по значению, не изменяются.
class lcl_report definition.
public section.
class-methods:
main.
private section.
class-methods:
method_with_exception
exporting
ev_value type char10
returning
value(rv_value) type char10
raising
zcx_error.
endclass.
class lcl_report implementation.
method main.
try .
data(lv_val1) = value char10( ).
lv_val1 = 'OLD_VALUE'.
data(lv_val2) = value char10( ).
lv_val2 = 'OLD_VALUE'.
method_with_exception(
importing
ev_value = lv_val1
receiving
rv_value = lv_val2 ).
catch zcx_error.
endtry.
" lv_val1 = 'NEW_VALUE'.
" lv_val2 = 'OLD_VALUE'.
endmethod.
method method_with_exception.
clear: ev_value.
ev_value = 'NEW_VALUE'.
rv_value = 'NEW_VALUE'.
raise exception type zcx_error.
endmethod.
endclass.
Комментариев нет:
Отправить комментарий