REPORT zfsl_show_desktop.
TABLES : seoclass.
DATA : zcl_oo_class TYPE REF TO cl_oo_class.
DATA : lt_attributes TYPE seo_attributes,
ls_attributes TYPE vseoattrib,
lt_methods TYPE seo_methods,
ls_methods TYPE vseomethod,
ls_signature TYPE seocmpsign,
lt_params TYPE seo_parameters,
ls_params TYPE vseoparam,
lt_exceps TYPE seo_exceptions,
ls_exceps TYPE vseoexcep.
DATA : ls_seotype TYPE seotype,
lt_subclass TYPE seo_relkeys,
ls_subclass TYPE seorelkey.
DATA : lv_cpdname TYPE seocpdname,
lv_type TYPE char30,
lv_exposure TYPE seoexpose,
lv_text TYPE char30,
lv_superclass TYPE seoclsname.
DATA : lt_domval TYPE re_t_rsdomaval,
ls_domval TYPE dd07v.
PARAMETER : p_class TYPE seoclass-clsname.
TRY.
CREATE OBJECT zcl_oo_class
EXPORTING
clsname = p_class
with_inherited_components = seox_true
with_interface_components = seox_true.
WRITE :/ 'Class Name : ', zcl_oo_class->class-clsname.
WRITE :/ 'Class Description : ', zcl_oo_class->class-descript.
WRITE :/ 'Class Author : ', zcl_oo_class->class-author.
CATCH cx_class_not_existent .
ENDTRY.
IF zcl_oo_class IS NOT INITIAL.
** Get attributes of the Class **
REFRESH : lt_attributes.
zcl_oo_class->get_attributes(
EXPORTING
public_attributes_only = seox_false
instance_attributes_only = seox_false
reference_attributes_only = seox_false
RECEIVING
result = lt_attributes ).
WRITE :/ 'Attributes List'.
WRITE :/ '---------------'.
LOOP AT lt_attributes INTO ls_attributes.
WRITE :/ ls_attributes-clsname, ls_attributes-cmpname.
ENDLOOP.
WRITE :/.
* Get components list **
REFRESH : lt_methods.
zcl_oo_class->get_methods(
EXPORTING
public_methods_only = seox_false
instance_methods_only = seox_false
RECEIVING
result = lt_methods ).
WRITE :/ 'Components List '.
WRITE :/ '----------------'.
LOOP AT lt_methods INTO ls_methods.
WRITE :/ ls_methods-clsname, ls_methods-cmpname.
ENDLOOP.
WRITE :/.
** Get Component Signature **
IF lt_methods[] IS NOT INITIAL.
REFRESH : lt_params, lt_exceps.
WRITE :/ 'Component Signatures '.
WRITE :/ '---------------------'.
LOOP AT lt_methods INTO ls_methods.
MOVE ls_methods-cmpname TO lv_cpdname.
CLEAR : ls_signature.
TRY.
zcl_oo_class->get_component_signature(
EXPORTING
cpdname = lv_cpdname
RECEIVING
result = ls_signature ).
CATCH cx_component_not_existing .
ENDTRY.
IF ls_signature IS NOT INITIAL.
APPEND LINES OF ls_signature-params TO lt_params.
APPEND LINES OF ls_signature-exceps TO lt_exceps.
ENDIF.
ENDLOOP.
WRITE :/ ':: Parameters ::'.
LOOP AT lt_params INTO ls_params.
MOVE ls_params-type TO lv_type.
WRITE :/ ls_params-cmpname,ls_params-sconame, lv_type.
ENDLOOP.
IF lt_exceps[] IS NOT INITIAL.
WRITE :/ ':: Exceptions ::'.
LOOP AT lt_exceps INTO ls_exceps.
WRITE :/ ls_exceps-cmpname, ls_exceps-sconame, ls_exceps-descript.
ENDLOOP.
ENDIF.
ENDIF.
WRITE :/.
** Get Component Exposure **
REFRESH : lt_domval.
cl_reca_ddic_doma=>get_values(
EXPORTING
id_name = 'SEOEXPOSE'
id_langu = sy-langu
IMPORTING
et_values = lt_domval
EXCEPTIONS
not_found = 1
OTHERS = 2 ).
WRITE :/ 'Components Visibility '.
WRITE :/ '----------------------'.
LOOP AT lt_methods INTO ls_methods.
CLEAR : lv_exposure.
MOVE ls_methods-cmpname TO lv_cpdname.
TRY.
zcl_oo_class->get_component_exposure(
EXPORTING
cpdname = lv_cpdname
RECEIVING
result = lv_exposure ).
CLEAR : ls_domval.
READ TABLE lt_domval INTO ls_domval WITH KEY domvalue_l = lv_exposure.
IF sy-subrc EQ 0.
WRITE :/ lv_cpdname, ls_domval-ddtext.
ENDIF.
CATCH cx_component_not_existing .
ENDTRY.
ENDLOOP.
WRITE :/.
** Get attribute Type **
REFRESH : lt_domval.
cl_reca_ddic_doma=>get_values(
EXPORTING
id_name ='SEOTYPTYPE'
id_langu = sy-langu
IMPORTING
et_values = lt_domval
EXCEPTIONS
not_found = 1
OTHERS = 2 ).
WRITE :/ 'Class Attributes details'.
WRITE :/ '------------------------'.
LOOP AT lt_attributes INTO ls_attributes.
TRY.
MOVE ls_attributes-cmpname TO lv_cpdname.
zcl_oo_class->get_attribute_type(
EXPORTING
cpdname = lv_cpdname
RECEIVING
result = ls_seotype ).
CLEAR :ls_domval.
READ TABLE lt_domval INTO ls_domval WITH KEY domvalue_l = ls_seotype-typtype.
IF sy-subrc EQ 0.
MOVE ls_seotype-type TO lv_type.
MOVE ls_domval-ddtext TO lv_text.
WRITE :/ lv_cpdname, lv_text, lv_type.
ENDIF.
CATCH cx_component_not_existing .
CATCH cx_wrong_component_type .
ENDTRY.
ENDLOOP.
WRITE :/.
** Get list of sub classes **
REFRESH : lt_subclass.
lt_subclass = zcl_oo_class->get_subclasses( ).
IF lt_subclass[] IS NOT INITIAL.
WRITE :/ 'Subclass Details'.
WRITE :/ '----------------'.
LOOP AT lt_subclass INTO ls_subclass.
WRITE :/ ls_subclass-refclsname, ls_subclass-clsname.
ENDLOOP.
ENDIF.
WRITE :/.
** Get list of super classes **
CLEAR : lv_superclass.
lv_superclass = zcl_oo_class->get_superclass( ).
WRITE :/ 'Super Class -> ' ,lv_superclass.
ENDIF.
source link:
http://wiki.sdn.sap.com/wiki/display/stage/Information+of+Class+Objects+using+CL_OO_CLASS