Application Development 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: 

Need a generic CATCH statement

Former Member
0 Kudos
2,562

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

Former Member
0 Kudos
754

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

Former Member
0 Kudos
755

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,