Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem in relating tables

Former Member
0 Likes
490

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
471

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

3 REPLIES 3
Read only

Former Member
0 Likes
471

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.

Read only

Former Member
0 Likes
472

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

Read only

Former Member
0 Likes
471

Hi Harish,

use a inner join between the three tables ZTABLE1 MARA and ZTABLE2. I think It will solve your purpose.