03-26-2007 6:36 PM
Hi Experts,
I created a query with a join on 2 tables( Table A and B). B may not have records all the time so I joined them with left outer join. Now I get all records from A based on selection criteria showing blank in fields from B if no entries are found in B.
Now I have entires from B that repeat in output. I want to stop multiple entries from B (Eg: value field). I have 2 entries in table B, with value 0 and value $$. <b>I want all entries from A with entries from B ( but only those entries from B that have value $$) AND blank entries but NOT entries with value=0.</b> I cannot select value field in <i>selection</i> and do an exclusion as this will exclude my blank entries from table B.
Is there a way to select entries from 1 table based on a field entry eg: Select only those fields with value $$ but NOT Value 00, while joining tables in Query.
Thanks
ABAP, Query, Joins, Field selection, Exclusion
03-26-2007 7:10 PM
May be like this
select * from B into table itabB where <<condition>>
loop at itabB
<<<< filter records according your condition
endloop
select * from a into table itabA for all entries in itabB where <<condition if any>>
aRs
03-26-2007 6:54 PM
you can do a where condition as below example..
SELECT
SALESREP.EMPID,
ORDERNO,
CUSTID,
ORDDATE,
BILLED,
PAID
FROM
SJD.SALESREP SALESREP
LEFT OUTER JOIN SJD.SALESORD SALESORD
ON
SALESREP.EMPID = SALESORD.EMPID
WHERE
SALESORD.PAID NE 00.
03-26-2007 7:00 PM
Will this get me the entries 1, 2 , 4, 5 & 6 ( See Below)
<b>A______B__________B <--Tables
X _______Y _______Z <--Fields
1_______ - -_________ --
2_______ - -_________ --
<b>3______ 30_________00</b>
4_______30_________100$
5_______50_________200$
6_______60_________300$
03-26-2007 7:06 PM
if the VALUE field is numc then in where condition, here SPACE considered as 00
WHERE
SALESORD.PAID NE 00. " << here 00 also considered as space
aRs
03-26-2007 7:10 PM
May be like this
select * from B into table itabB where <<condition>>
loop at itabB
<<<< filter records according your condition
endloop
select * from a into table itabA for all entries in itabB where <<condition if any>>
aRs