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

Catch

Former Member
0 Likes
334

I would like to catch system exception cx_sy_dynamic_osql_semantics. However, I believe that I need to use CATCH (not TRY) because the program will run in 4.6. I don't see a valid exception group and OTHERS doesn't work. Any suggestions? I have a SELECT inside the Catch / endcatch. This select may have invalid fields in the were clause that not associated with a dynamic itab. I would like to just catch the exception and handle it.

Your help is greatly appreciated.

Kind Regards,

Jason

2 REPLIES 2
Read only

Former Member
0 Likes
290

Hi,

Have a look at this code

TRY. 
 SELECT * FROM mard INTO TABLE lt_mard WHERE (where) ORDER BY matnr.

* Catch the error and avoid short dump

 CATCH cx_sy_dynamic_osql_semantics INTO exc_ref.
   Exc_ref->get_text exc_text = (). 
   MESSAGE exc_text TYPE 'E'. 

 CATCH cx_sy_dynamic_osql_syntax INTO exc_ref. 
   Exc_ref->get_text exc_text = (). 
   MESSAGE exc_text TYPE 'E'. 
ENDTRY. 

Read only

0 Likes
290

Hi

TRY/ENDTRY statament is not supported by 4.6C.

I believe you should check in "where" table if there are only the fields belonging to the table of the select.

Max