Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Comparing 2 identicals structures.

Former Member
0 Likes
577

Hi,

I have to find the fields that are differrent in two big structures.

Rather than comparing all fileds one by one, i was wondering if there is quicker way to do it?

Or maybe a Function module?

Thanks for your help.

Olivier D.

2 REPLIES 2
Read only

Former Member
0 Likes
532

hello O ,

try something like this



type-pools: abap.

data: gt_comp1             type standard table of abap_componentdescr,
      gt_comp2             type standard table of abap_componentdescr,
      gs_comp              type abap_componentdescr,
      go_struct            type ref to cl_abap_structdescr.

go_struct ?= cl_abap_typedescr=>describe_by_name( 'BKPF' ).
gt_comp1 = go_struct->get_components( ).

go_struct ?= cl_abap_typedescr=>describe_by_name( 'BSEG' ).
gt_comp2 = go_struct->get_components( ).

if gt_comp1[] ne gt_comp2[].
  write: / 'Error'.
endif.

regards

Prabhu

Read only

Former Member
0 Likes
532

You can create a small custom program for this. You can get all the fields in the structure using FM DDIF_FIELDINFO_GET. Now, compare the both the internal tables and delete the duplicate entries using read inside loop.