2015 Sep 21 7:43 AM
Hi
I will like to know the software design to design exception handling within a class. I have a class with both private and public methods. There is a public method which is supposed to do some actions then consolidate all the warnings and errors arose from processing the actions. This is similar to the Function module BAPI_PO_CREATE1, with a return message table.
The implementation of the public method involved calling private methods within the same class for validation.
I want to ask what will be a better way for implementation for the failed validation handling:
Hi
I will like to know the software design to design exception handling within a class. I have a class with both private and public methods. There is a public method which is supposed to do some actions then consolidate all the warnings and errors arose from processing the actions. This is similar to the Function module BAPI_PO_CREATE1, with a return message table.
The implementation of the public method involved calling private methods within the same class for validation.
I want to ask what will be a better way for implementation for the failed validation handling:
2015 Sep 21 8:22 AM
I tend to use things like:
IF is_in_range( ) EQ abap_false.
RAISE EXCEPTION TYPE zcx_my_exception EXPORTING textid = zcx_my_exception=>out_of_range.
ELSEIF is_valid_in_some_other_way( ) EQ abap_false
RAISE EXCEPTION TYPE zcx_my_exception EXPORTING textid = zcx_my_exception=>invalid_some_other_way.
ENDIF.
In my view, the validation methods are making a test. What you do with the result of the test is delegated to the calling method.