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

Raise a non-class-based exception with a dynamic name

Former Member
0 Likes
1,837

Hi experts!

I'm struggling with an obviously elementary thing in Function Modules.

Is it possible to raise a non-class-based exception with a dynamic name?

Something like:

RAISE lv_raise_name. " lv_raise_name -> variable with name of exception

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
1,365

NO

(as you can see in ABAP documentation of RAISE)

Hi experts!

I'm struggling with an obviously elementary thing in Function Modules.

Is it possible to raise a non-class-based exception with a dynamic name?

Something like:

RAISE lv_raise_name. " lv_raise_name -> variable with name of exception

4 REPLIES 4
Read only

mohit_dev
Contributor
0 Likes
1,365
Read only

Nawanandana
Active Contributor
0 Likes
1,365

Hi,

I think this already answer.

Further you can check non-class-based exceptions

TRY.
CALL METHOD lr_instance->(method_name)
PARAMETER-TABLE ptab.
CATCH cx_root into lr_error.
lv_error = lr_error->get_text( ). "--> maybe a usefull error message
ENDTRY.
Read only

Sandra_Rossi
Active Contributor
1,366

NO

(as you can see in ABAP documentation of RAISE)

Read only

0 Likes
1,365

Thank you for your answer.

Of course, first of all, I've checked the documentation. And such the answer is what I was afraid of 🙂