Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Need a generic CATCH statement

Former Member
0 Likes
4,112

I m writing some code and calling lots of functions. I want to write a generic catch block which will catch any and every type of exception, I dont want to get a runtime error at all, no matter what the exception. Is it possible. If so what exception class do i need to use.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,304

Hello,

Yes, it's possible:


TRY.
    lr_ref1 ?= lr_ref2.
  CATCH cx_root.
    WRITE 'Error'.
ENDTRY.

And I suggest you to read the follwing:

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f86c9290-0201-0010-7a93-dda3716dc0d2]

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/20a3cc03-2d6b-2910-588b-88d8c6659e40]

Regards,

1 REPLY 1
Read only

Former Member
0 Likes
2,305

Hello,

Yes, it's possible:


TRY.
    lr_ref1 ?= lr_ref2.
  CATCH cx_root.
    WRITE 'Error'.
ENDTRY.

And I suggest you to read the follwing:

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f86c9290-0201-0010-7a93-dda3716dc0d2]

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/20a3cc03-2d6b-2910-588b-88d8c6659e40]

Regards,