Application Development 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: 

Join tables

Former Member
0 Kudos
82

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&regds,

sree.

3 REPLIES 3

Former Member
0 Kudos
50

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

0 Kudos
50

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&regds,

Sree.

Former Member
0 Kudos
50

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,