06-03-2009 3:58 PM
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
06-03-2009 4:06 PM
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
06-03-2009 4:06 PM
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
06-03-2009 4:10 PM
06-03-2009 4:11 PM
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
06-03-2009 4:16 PM
06-03-2009 4:36 PM
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
06-03-2009 4:54 PM
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.