[ABAP] Code von Klassen und Interfaces über Eclipse-Klasse (cl_oo_factory) lesen

TRY.
* Objektname: Klasse oder Interface
    DATA(lv_obj_name) = |CL_DEMO_OUTPUT|.

    DATA(o_source) = cl_oo_factory=>create_instance( )->create_clif_source( clif_name = lv_obj_name
                                                                            version   = if_oo_clif_source=>co_version_active ).

* Typ ausgeben
    WRITE: / COND string( WHEN o_source->get_type( ) = 0 THEN 'Class' ELSE 'Interface' ).

    ULINE.

* Code zum Objekt holen
    DATA(it_code) = VALUE rswsourcet( ).
    o_source->get_source( IMPORTING source = it_code ).

* Code ausgeben
    LOOP AT it_code ASSIGNING FIELD-SYMBOL(<c>).
      WRITE: / <c>.
    ENDLOOP.

  CATCH cx_root INTO DATA(e_txt).
    WRITE: / e_txt->get_text( ).
ENDTRY.