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

Structure Comparison - Debugger Diff Tool Equivalent

Former Member
0 Likes
1,375

Does anyone know of a function module/other which performs logic similar to what is possible in the Diff Tool in the new debugger? (see http://help.sap.com/saphelp_nw70/helpdata/en/2c/840b42202cce6ce10000000a155106/content.htm )

This is a great tool available in debugging that I would like to use in a program to highlight differences between structures which share common fields yet have different layouts. Consider the following example of two structures and their corresponding values:

Structure A

- Field 'A'; Value '123'

- Field 'B'; Value '234'

- Field 'C'; Value '345'

Structure B

- Field B; Value '234'

- Field C; Value '456'

- Field D; Value '567'

In this example, fields B and C are common to both structures and the assigned values for field C differs. I am able to see this type of analysis from the debugging tool - is there a way to perform similar logic in a program using a standard function module/syntax? I'm not sure if a field-symbol type approach would be very efficient although I am open to thoughts.

Thanks!

4 REPLIES 4
Read only

naimesh_patel
Active Contributor
1,044

New debugger uses the class CL_TPDA_DIFF_STRUC for structure comparison. There are other classes available for Table, Object and other comparisons - Check with CL_TPDA_DIFF*.

If you check this classes, it find the different values by going through each component and comparing it with each other using the field-symbols. So, you can work on similar approch:

  • Get the Fields of both structures

  • Sort them by field names, if you want comparison by field names

  • For each field check the value and compare with other value

I found the FM COMPARE_STRUCTURE_DATA which does the comparison, but doesn't use RTTS so, you need to have data dictionary reference in order to use it.

Regards,

Naimesh Patel

Read only

0 Likes
1,044

Have a look at this WIKI, it uses RTTS to compare internal tables dynamically

http://wiki.sdn.sap.com/wiki/display/Snippets/ComparingTwoInternalTables-AGeneric+Approach

Read only

0 Likes
1,044

Hi;

Is there any example about CL_TPDA_DIFF_STRUC Class?

Thanks.

Read only

former_member189009
Active Participant
0 Likes
1,044

This message was moderated.