Skip to Content
Dec 18, 2018 at 11:58 AM

pass on the exception when i use class methods


Hello experts,

Here i have a table with single column which contains "views name". Based on the view name I tried to create a table.


loop itab into wa.
lv_vname = wa-view_name.
* Get a structure of view name 

    ro_struc_descr ?= cl_abap_typedescr=>describe_by_name( lv_vname ).
    lt_comp = ro_struc_descr->get_components( ).
    APPEND LINES OF lt_comp TO lt_tot_comp.

* Create new type from component table
    lo_new_type = cl_abap_structdescr=>create( lt_tot_comp ).

* Create new table type
    lo_table_type = cl_abap_tabledescr=>create( lo_new_type ).

* Create dynamic internal table and assign to Field Symbol
    CREATE DATA w_tref TYPE HANDLE lo_table_type.

<---some logic---------->

from the above code, "lv_vname" is a view name.

suppose if my table has a invalid view name means my program through the dump error.



it won't process other values.

i want to capture that error and except that i want to process all the data to create dynamic table.

Any suggestions please...

Thanks in advance