Skip to Content
0
Former Member
Jun 28, 2007 at 03:12 PM

Raising Exceptions and Assistance classes

108 Views

Hi everyone. I know that the WDA framwork will not let me declare a raising clause in the method signature. However, during checks in the component i usually declare some code like this which is not pretty:

The methods below were declared in the view controller.

*---this method is called from DOBEFOREACTION method

METHOD validate_view_fields .

DATA: l_returncode TYPE sysubrc.

CALL METHOD validate_required_fields(

IMPORTING

e_returncode = l_returncode ).

IF l_returncode <> 0.

e_returncode = l_returncode.

ENDIF.

-more code down here -

ENDMETHOD.

I would like the framework to call a method and if something goes wrong I do not want to proceed further down the code or navigate. If I could declare exceptions I could handle this pretty easily.

If assistance classes or model classes are the answer then would I be able to read the context from those classes? I've also read that passing references of the web dynpro controllers to the assistance class could produce some problems.

What's the best way to check the view fields and to prevent going further with the subsequent code if an exception condition is found?

Thanks! Generous points will be awarded!