‎2016 Jan 29 8:55 AM
Hello mates,
i would like to Join two tables like those below. I only want the values from the table LT who are not in the Table RT.
Am i right doing a Join like this?:
SELECT x
FROM LT
WHERE NOT EXISTS (SELECT y FROM RT Where ..)
and ...
| table LT, field x | table RT, field y |
|---|---|
| ABC/A | ABC/E |
| ABC/B | ABC/E |
| ABC/C | ABC/E |
| ABC/D | ABC/F |
| ABC/E | ABC/F |
| ABC/F | ABC/G |
| ABC/G | ABC/H |
Kind Regards
Emre
‎2016 Jan 29 9:32 AM
hi,
select * from Lt into it_Lt (Intenal table of LT)
select * from Rt into it_Rt (Internal table of RT)
Loop at it_LT into wa_lt (work area of Lt).
read table it_RT into Wa_RT with key field x(Right table fieldx) = wa_LT-fieldx(Left table fieldx)
if sy-subrc ne 0.
append it to the new table.
endif.
endloop.
‎2016 Jan 29 9:20 AM
Hi,
You can use Joins Like this
SELECT T1~FIELD1
T1~FIELD2
T2~FIELD1
T2~FIELD2
INTO TABLE <ITAB>
FROM T1 INNER JOIN T2 ON ( T1~FIELD1 = T2~FIELD )
WHERE T1~FIELD = <SOME VALUE> .
‎2016 Jan 29 9:32 AM
hi,
select * from Lt into it_Lt (Intenal table of LT)
select * from Rt into it_Rt (Internal table of RT)
Loop at it_LT into wa_lt (work area of Lt).
read table it_RT into Wa_RT with key field x(Right table fieldx) = wa_LT-fieldx(Left table fieldx)
if sy-subrc ne 0.
append it to the new table.
endif.
endloop.
‎2016 Jan 29 9:56 AM
Yeah, it should work good.
SELECT x
FROM LT
WHERE NOT EXISTS (SELECT * FROM RT
WHERE y = lt~x)
‎2016 Jan 29 10:06 AM
‎2016 Jan 29 11:26 AM
Thank you all for your replies, I have tried it with the loop over itab and the subselect.
Both work fine. I use the subselect now
Emre