2008 Apr 21 5:25 AM
Hi All,
How to join tables without having common fields,I am facing this problem several times I don't know how to fetch the data from these tables.
Thanks®ds,
sree.
2008 Apr 21 5:32 AM
Hi,
Why do you want to join tables if you dont have any condition specified. Select the entries separately and proceed with the query.
If you have such a query,post the requirement here.We could try and help your problem get solved.
Thanks,
Anon
2008 Apr 21 5:49 AM
Hi All,
Here is my query ,I am using ADDRNUMBER to join LFA1 and ADRC but LFA1 having the field ADRNR how to join these tables,I need to join LFM1,ADRC,ADR6.
REPORT ZMMTEST2.
tables:lfm1,lfa1,adrc,adr6.
data : itab1 type lfm1 occurs 0.
data : itab2 type lfa1 occurs 0.
data : itab3 type adrc occurs 0.
data : itab4 type adr6 occurs 0.
data : begin of Itab occurs 0,
lifnr like lfm1-lifnr,
ekorg like lfm1-ekorg,
ernam like lfm1-ernam,
ekgrp like lfm1-ekgrp,
lifnr like lfa1-lifnr,
adrnr like lfa1-adrnr,
addrnumber like adrc-addrnumber,
addrnumber like adr6-addrnumber,
smtp_addr like adr6-smtp_addr,
end of itab.
SELECT alifnr aekorg aernam aekgrp blifnr badrnr cADDRNUMBER dADDRNUMBER d~SMTP_ADDR
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( ( lfm1 AS a
INNER JOIN lfa1 AS b ON alifnr = blifnr )
INNER JOIN lfm1 AS c ON badrnr = cADDRNUMBER )
INNER JOIN adrc AS d ON cADDRNUMBER = dADDRNUMBER ).
Thanks®ds,
Sree.
2008 Apr 21 5:43 AM
Hi,
Find the check table of the promary keys of the tables.
Try to find the common fields from one of the check tables of the primary keys.
Example,
If you want to join tables A and B.
Both tables don't contain common fields.
A has primary key fields X and Y.
go to check table of X or Y.
Let check table of X is C.
check any field in C which are exist in table B.
Join tables A and C.
Based on this pick the data from B.
Regards,