Skip to Content
0
Former Member
Jan 09, 2007 at 02:07 PM

Comparison amoung two tables

345 Views

Ok, I'm attempting to write my first ABAP report. I am trying to write a report that allows a user to input a unit of measure and a material group. Then it will look at every material in that group. If a material's base unit of measure or alternate unit of measure(s) do not equal the user-supplied unit then that material will be written to the screen. Otherwise nothing will happen. Here is what I have so far:

REPORT ZBASE_UNIT_SELECT.

PARAMETERS: PA_MATKL TYPE MARA-MATKL, PA_UNIT TYPE MARA-MEINS.

DATA: IT_MARA TYPE TABLE OF MARA,

WA_MARA LIKE LINE OF IT_MARA.

DATA: IT_MARM TYPE TABLE OF MARM,

WA_MARM LIKE LINE OF IT_MARM.

START-OF-SELECTION.

SELECT * FROM MARA INTO TABLE IT_MARA WHERE MATKL = PA_MATKL.

LOOP AT IT_MARA INTO WA_MARA.

if wa_mara-meins = pa_unit.

This is where I get stuck. I need to determine of the base unit of measure (MARA-MEINS) equals the supplied unit (PA_UNIT) and if it does then I need to move on to the next one. If it doesn't match then I need to compare the alternate unit of measures (MARM-MEINH) to the supplied unit (PA_UNIT). How can I do this comparison using two different tables?

Any help is more than appreciated!

Thanks,

Aaron