Skip to Content
2
May 20, 2020 at 03:37 PM

Dynamic table as parameter - checking type

120 Views

Hi,

I recently came across an interesting mind-boggling issue.

Let's assume, we have a method that as one of the parameters has a table type TABLE.

During the runtime, one can check the type of the Table passed to the method in a pretty straightforward way.

DATA(typedescr) = cl_abap_typedescr=>describe_by_data( it_table ).
DATA(outtype) = typedescr->absolute_name.

As a result we have the absolute type of it_table which is fine.

However, how can we check if the input table is of type f.ex. lty_ztype.

        TYPES: BEGIN OF lty_ztype ,
                    first TYPE CHAR12
        TYPES END OF lty_ztype.

In case of the classes and objects we have keywords IS INSTANCE OF.
The above case can happen if we have a generic method used to process different table types in specific ways.

How can we handle such case?

Thanks!