Skip to Content
0
Former Member
May 12, 2008 at 09:41 AM

pronlem with join for 4 tables

320 Views

Hi Experts,

how to join 4 tables like a <-> b, b <-> c, c<->d.

below i ve given 2 querys, in that 1st one is working, but 2nd one is not getting data.

actually i ve 2 internal tables and 1 final table.

it_tab1 having 10 fields, it_tab2 having 15 fields ( First table 10 fields + 5 fields )

my final table having 15 fields.

for this am using 2 select quirys, here am getting data into 1st table, bt am not able to get into 2nd table.

  • ( a <-> b, b <-> c, )

SELECT a~pspnr

a~pspid

a~post1

b~pspnr

b~posid

b~objnr

b~psphi

c~objnr

c~lednr

c~wlp01

c~wlp02

FROM proj AS a INNER JOIN prps AS b ON ( bpsphi = apspnr )

INNER JOIN rpsco AS c ON ( bobjnr = cobjnr )

INTO CORRESPONDING FIELDS OF TABLE it_tab1

WHERE avbukr IN s_ccode AND cgjahr EQ p_year.

This on is getting data into it_tab1.

The problem is below one.

  • ( a <-> b, b <-> c, c<->d )

SELECT a~pspnr

a~pspid

a~post1

b~pspnr

b~posid

b~post1

b~objnr

b~psphi

c~objnr

c~wrttp

c~gjahr

c~beltp

c~wlp01

c~wlp02

d~pspel

d~objnr

d~bukrs

FROM proj AS a INNER JOIN prps AS b ON ( bpsphi = apspnr )

INNER JOIN rpsco AS c ON ( bobjnr = cobjnr )

INNER JOIN aufk AS d ON ( dobjnr = cobjnr )

INTO CORRESPONDING FIELDS OF TABLE it_tab2

WHERE avbukr IN s_ccode AND cgjahr EQ p_year.

here i am not able to getting data into it_tab2.

is there any mistake in my join.

once i get data into 2nd table then how to pass 2tables data into final table.

Thanks in advance.

sudeer.