Application Development 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: 

comparing to working areas in order to find the different.

Former Member
0 Kudos

hi

i am selecting the current row of an employee from infotype 1 to wa_1 and his previous row to wa_2.

is the an easy way to compare between the two wa ( wa_1 to wa_2 ) insted of comparing each column in wa_1 to the same column in wa_2 ?

i need to find the different between the two row .

thanks

Ami

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

perform some ASSIGN to components of the two areas and compare those in a DO/ENDDO loop. Look at [Assigning Components of Structures to a Field Symbol|http://help.sap.com/erp2005_ehp_04/helpdata/EN/fc/eb3923358411d1829f0000e829fbfe/frameset.htm]

Code should look like

DO.
  ASSIGN COMPONENT sy-index OF STRUCTURE wa1 to <fs1>
  IF SY-SUBRC NE 0. " no more component
    EXIT.
  ENDIF.
  ASSIGN COMPONENT sy-index OF STRUCTURE wa2 to <fs2>
  IF <fs1> NE <fs2>.
  * report delta
  ENDIF.
ENDDO.

Regards,

Raymond

6 REPLIES 6

raymond_giuseppi
Active Contributor
0 Kudos

perform some ASSIGN to components of the two areas and compare those in a DO/ENDDO loop. Look at [Assigning Components of Structures to a Field Symbol|http://help.sap.com/erp2005_ehp_04/helpdata/EN/fc/eb3923358411d1829f0000e829fbfe/frameset.htm]

Code should look like

DO.
  ASSIGN COMPONENT sy-index OF STRUCTURE wa1 to <fs1>
  IF SY-SUBRC NE 0. " no more component
    EXIT.
  ENDIF.
  ASSIGN COMPONENT sy-index OF STRUCTURE wa2 to <fs2>
  IF <fs1> NE <fs2>.
  * report delta
  ENDIF.
ENDDO.

Regards,

Raymond

RichHeilman
Developer Advocate
Developer Advocate

Yes, just look at the entire work area as a whole.

If wa_1 ne wa_2.

Endif.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi Ami,

Probably you can have an additional field in each internal tables value = 1 for the first int table and value = 2 for the second int table.Now create another internal table having the structure of both the int tables move the data from the 2 internal tables to the final internal table and then have a check.

Since we have another variable in each of the internal tables deciding whjether the field is from table 1 or table 2.in the final internal table we can easily get toknow and you can check for the differences.

Revert if u did not understand my point.

Thanks and Regards

Srikanth.P

0 Kudos

Sorry but i didnt understand u

Ami

0 Kudos

Hi,

You can directly compare work areas like

if wa_1 = wa_2.

write:'Both work areas are equal'.

else.

write:'Both work areas are not equal'.

endif.

regards,

Vamsi

0 Kudos

As you can read, it is possible to compare two workareas with each other. However, this way you can only determine if both workareas are the same or not...nothing more nothing less. If you want to know how these workareas differ, you should do what Raymond is suggesting.