‎2007 Aug 17 6:51 AM
Hello,
I am working on CO object.
I need help in relationships. I need to show the data in two Z tables which contains no com,mon field..
In previous program, the data in 1 Z table has been shown and only MATNR field in MARA has been displayed.i.e. The common field between Ztable1 and MARA is MATNR. Now I need to show the data in ZTABLE2 using MARA. The common field between ZTABLE2 and MARA is MATKL.
ZTABLE1 doesn't contain MATKL and ZTABLE 2 doesn't contain MATNR.
Please help me in solving this problem.Is inner join required?
I am asking this because I need to change the original code cannot do the coding with my logic.
regards,
Harish
‎2007 Aug 17 7:02 AM
ok
MARA - MATNR : Ztable1 -MATNR
MARA-MATKL : ZTABLE2-MATKL...
NOW select matnr fld1 from ztabl1 into itab1 where matnr in s_matnr.
if itab1[] is not initail.
select matnr matkl from mara into table itab2 for all enteries in itab1 where matnr eq itab1-matnr.
endif.
if itab2[] is not initial.
select mtakl fld2 from ztabl2 into table itab3 for all entries in itab2 where matkl eq itab2-matkl.
endif.
reward points to all helpful answers
kiran.M
‎2007 Aug 17 7:00 AM
hi,
It is Not Possible to relate the tables ztable1 and ztable2 coz we dont have any common fields.so , use MARA table fields by inner joining the tables.
Cheers,
Rohith.
‎2007 Aug 17 7:02 AM
ok
MARA - MATNR : Ztable1 -MATNR
MARA-MATKL : ZTABLE2-MATKL...
NOW select matnr fld1 from ztabl1 into itab1 where matnr in s_matnr.
if itab1[] is not initail.
select matnr matkl from mara into table itab2 for all enteries in itab1 where matnr eq itab1-matnr.
endif.
if itab2[] is not initial.
select mtakl fld2 from ztabl2 into table itab3 for all entries in itab2 where matkl eq itab2-matkl.
endif.
reward points to all helpful answers
kiran.M
‎2007 Aug 17 7:03 AM
Hi Harish,
use a inner join between the three tables ZTABLE1 MARA and ZTABLE2. I think It will solve your purpose.