‎2008 Jun 24 1:43 PM
HI,
i wont to catch error when the table that i receive is empty ,
how i can do it with try@catch,
i new with try and catch.
Regards
DATA: eref TYPE REF TO cx_root.
CREATE OBJECT oref.
TRY.
CALL METHOD oref->fin
EXPORTING
znodefather = znode
RECEIVING
node_tab = no.
CATCH cx_root INTO eref.
ENDTRY.
‎2008 Jun 24 2:01 PM
Unless it is an error - i.e. you don't expect it to come back empty - it is bad programming practice to use exceptions to control program flow.
Why not use IF mytab IS INITIAL instead?
In any case, you'll have to use that. With your example, the method oref->fin will need some code like:
IF mytab IS INITIAL.
RAISE my_exception.
ENDIF.matt
‎2008 Jun 24 1:47 PM
‎2008 Jun 24 1:51 PM
‎2008 Jun 24 2:01 PM
Unless it is an error - i.e. you don't expect it to come back empty - it is bad programming practice to use exceptions to control program flow.
Why not use IF mytab IS INITIAL instead?
In any case, you'll have to use that. With your example, the method oref->fin will need some code like:
IF mytab IS INITIAL.
RAISE my_exception.
ENDIF.matt