10-20-2008 3:28 PM
Hi all,
I have to call a transformation and give it as result parameter an internal table with ABAP_TRANS_RESBIND_TAB type.
How can I get the name & the reference of the current class attributes ?
Thanks.
10-20-2008 3:55 PM
I am not sure what you want to need, but please check this class CL_ABAP_CLASSDESCR. It may help you.
10-24-2008 7:16 AM
hi,
You can get the reference to current class object threw 'ME'.
'ME' refer to current class object.
and threw it u can get access current object attribute.
If still you are facing any problem .
please let me know.
Regards .
Punit
10-24-2008 11:22 AM
Hi,
View: VSEOATTRIB. It contains the metadata regarding the Attributes of the Class.
10-24-2008 2:52 PM
Here is the solution I wound, but it works with public attributes only!
DATA: l_typedesc TYPE REF TO cl_abap_typedescr.
data: l_classdesc TYPE REF TO cl_abap_classdescr.
data: l_attribute TYPE abap_attrdescr.
data : att_ref type ref to any.
FIELD-SYMBOLS : <att> TYPE ANY . "abap_attrname.
DATA : name TYPE string.
CLEAR st_root_out.
CALL METHOD cl_abap_classdescr=>describe_by_object_ref
EXPORTING
p_object_ref = me
RECEIVING
p_descr_ref = l_typedesc.
l_classdesc ?= l_typedesc.
LOOP AT l_classdesc->attributes INTO l_attribute "-
WHERE type_kind = cl_abap_classdescr=>typekind_string "-
OR type_kind = cl_abap_classdescr=>typekind_num "-
OR type_kind = cl_abap_classdescr=>typekind_date "-
OR type_kind = cl_abap_classdescr=>typekind_packed "-
OR type_kind = cl_abap_classdescr=>typekind_time "-
OR type_kind = cl_abap_classdescr=>typekind_char "-
OR type_kind = cl_abap_classdescr=>typekind_hex "-
OR type_kind = cl_abap_classdescr=>typekind_float "-
OR type_kind = cl_abap_classdescr=>typekind_int "-
OR type_kind = cl_abap_classdescr=>typekind_table "-
OR type_kind = cl_abap_classdescr=>typekind_struct2 "-
OR type_kind = cl_abap_classdescr=>typekind_struct1 "-
OR type_kind = cl_abap_classdescr=>typekind_oref
OR type_kind = cl_abap_classdescr=>typekind_time. "-
name = l_attribute-name .
ASSIGN me->(name) TO <att>.
CHECK sy-subrc = 0.
GET REFERENCE OF <att> INTO att_ref. " here I get the reference
ENDLOOP.