11-29-2005 11:48 AM
hi ,
i have a requirement , in which i have to read the metadata of a class dynamically,
the information should include the name of its methods and there signatures along with class attributes
i only know the name of the class,
does anybody have an idea regarding this ,
can somebody please tell me , how ABAP stores metadata for a class ( which tables ...etc)
thanks in Advance
Abhishek
11-29-2005 11:57 AM
Hi,
Try using function module SEO_COMPONENTS_SELECT.
Just fill the class name in the table CLIF_KEYS and call it to get back all the attributes and methods..
Here is some sample code to help you understand,
DATA: lwa_clskey TYPE seoclskey,
lt_clskey TYPE STANDARD TABLE OF seoclskey INITIAL SIZE 0,
lt_attributes TYPE STANDARD TABLE OF vseoattrib INITIAL SIZE 0,
lt_methods TYPE STANDARD TABLE OF vseomethod INITIAL SIZE 0,
lt_events TYPE STANDARD TABLE OF vseoevent INITIAL SIZE 0,
lt_params TYPE STANDARD TABLE OF vseoparam INITIAL SIZE 0,
lt_exceptions TYPE STANDARD TABLE OF vseoexcep INITIAL SIZE 0.
lwa_clskey-clsname = 'CL_GUI_ALV_GRID'.
APPEND lwa_clskey TO lt_clskey.
CALL FUNCTION 'SEO_COMPONENTS_SELECT'
EXPORTING
LANGU = SY-LANGU
WITH_ATTRIBUTES = 'X'
WITH_METHODS = 'X'
WITH_EVENTS = 'X'
WITH_PARAMETERS = 'X'
WITH_EXCEPTIONS = 'X'
TABLES
clif_keys = lt_clskey[]
comp_attributes = lt_attributes[]
comp_methods = lt_methods[]
comp_events = lt_events[]
subcomp_parameters = lt_params[]
subcomp_exceptions = lt_exceptions[]
EXCEPTIONS
parameter_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni
11-29-2005 11:57 AM
Hi,
Try using function module SEO_COMPONENTS_SELECT.
Just fill the class name in the table CLIF_KEYS and call it to get back all the attributes and methods..
Here is some sample code to help you understand,
DATA: lwa_clskey TYPE seoclskey,
lt_clskey TYPE STANDARD TABLE OF seoclskey INITIAL SIZE 0,
lt_attributes TYPE STANDARD TABLE OF vseoattrib INITIAL SIZE 0,
lt_methods TYPE STANDARD TABLE OF vseomethod INITIAL SIZE 0,
lt_events TYPE STANDARD TABLE OF vseoevent INITIAL SIZE 0,
lt_params TYPE STANDARD TABLE OF vseoparam INITIAL SIZE 0,
lt_exceptions TYPE STANDARD TABLE OF vseoexcep INITIAL SIZE 0.
lwa_clskey-clsname = 'CL_GUI_ALV_GRID'.
APPEND lwa_clskey TO lt_clskey.
CALL FUNCTION 'SEO_COMPONENTS_SELECT'
EXPORTING
LANGU = SY-LANGU
WITH_ATTRIBUTES = 'X'
WITH_METHODS = 'X'
WITH_EVENTS = 'X'
WITH_PARAMETERS = 'X'
WITH_EXCEPTIONS = 'X'
TABLES
clif_keys = lt_clskey[]
comp_attributes = lt_attributes[]
comp_methods = lt_methods[]
comp_events = lt_events[]
subcomp_parameters = lt_params[]
subcomp_exceptions = lt_exceptions[]
EXCEPTIONS
parameter_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni
11-29-2005 1:25 PM
thanks Sri ,
it did help ,
Can any one also let me know how to generate classes at run time
thanks
Abhishek