‎2006 Oct 10 9:14 AM
hi everybody
i have to compare the fields of 2 tables(to check whether the values have changed for the fields).
The tables are of type vbap and contain all the fields of the table vbap.
does anybody know how to compare all the fields of the 2 tables?
i was thinking of using loops but I guess there may be an easier way
Regards
Anjali
‎2006 Oct 10 9:28 AM
i guess u have to loop to compare
loop at itab1 into wa_itab1.
loop at itab2 into wa_itab2.
if wa_itab1 = wa_itab2.
*all the fields are equal
else.
*fields r not same.
endloop.
endloop.
‎2006 Oct 10 9:20 AM
Hi Sia,
You can get all the table fields from table -DD03L and then compare...
Hope this helps.
Manish
‎2006 Oct 10 9:20 AM
Hi,
You can use <itab1> <operator> <itab2>
where operator = [(EQ, =, NE, <>, ><, GE, >=, LE, <=, GT, >, LT, <)]
Example:
DATA: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
DATA: ITAB LIKE TABLE OF LINE,
JTAB LIKE TABLE OF LINE.
DO 3 TIMES.
LINE-COL1 = SY-INDEX.
LINE-COL2 = SY-INDEX ** 2.
APPEND LINE TO ITAB.
ENDDO.
MOVE ITAB TO JTAB.
LINE-COL1 = 10. LINE-COL2 = 20.
APPEND LINE TO ITAB.
IF ITAB GT JTAB.
WRITE / 'ITAB GT JTAB'.
ENDIF.
Regards,
Ruthra
‎2006 Oct 10 9:28 AM
i guess u have to loop to compare
loop at itab1 into wa_itab1.
loop at itab2 into wa_itab2.
if wa_itab1 = wa_itab2.
*all the fields are equal
else.
*fields r not same.
endloop.
endloop.
‎2006 Oct 10 9:33 AM