‎2013 Oct 18 7:05 AM
Hi All
Could somebody provide a method for two structure types comparison ?
I need to define if both structures have same:
but one of field has different length.
Does it exist short method for the difference check?
Of course I can create two tables by CL_ABAP_TYPE_DESCR with types of these structures and to compare these internal tables them line by line.
May be exists more short Method without LOOP ?
Regards..
‎2013 Oct 18 7:34 AM
‎2013 Oct 18 7:34 AM
‎2013 Oct 18 7:37 AM
Hi Anuser,
The structure can be compared either by using the FM DDIF_NAMETAB_GET or using CL_ABAP_TYPE_DESCR like mentioned below. But as far as I know, if you want to compare internal table records, you must loop through the records.
Structure comparison using CL_ABAP_TYPE_DESCR:
TYPES: begin of my_type,
age TYPE i,
name type text30,
end of my_type.
DATA: my_data TYPE my_type,
descr_ref TYPE ref to cl_abap_typedescr.
START-OF-SELECTION.
descr_ref = cl_abap_typedescr=>describe_by_data( my_data ).
WRITE: / 'Typename:', descr_ref->absolute_name.
WRITE: / 'Kind :', descr_ref->type_kind.
WRITE: / 'Length :', descr_ref->length.
WRITE: / 'Decimals:', descr_ref->decimals.
Thanks,
Ajay Bose
‎2013 Oct 18 7:57 AM
Sorry, I forgot a small detail. These structures are Local in ABAP program and they don't have relation to SAP Dictionary.
But it seems to me advised CL_TPDA_TOOL_DIFF->DIFF_VARS my be appropriate. I check it
‎2013 Oct 18 8:03 AM
Yes becoz this is what New ABAP debugger use in its new tool structure comparison