Create two internal tables in your program.
The first will be filled through a SELECT.
For the second one, look for a function module called RFC_READ_TABLE (I think it's called that way). Then learn how to call a function module from an external SAP system (check the help of CALL FUNCTION: you will find a clause called DESTINATION, read it)
Once you have both your tables full, create an algorithm to compare both tables. Hints: LOOP INTO and READ TABLE
And take into consideration Jürgen's advice in your other thread.