‎2007 Mar 29 12:14 PM
I simplify my problem as much as it is possible.
I have two tables TABLE1 and TABLE2. In both table key look:
key1 key2.
I have also an internal table INT_TABLE2 which is of type of TABLE2 which have some entries.
I want to select from TABLE1 all not existing pairs (TABLE1.key1 = TABLE2.key1 AND TABLE1.key2 = TABLE2.key2) for all entries in INT_TABLE2.
I tried
SELECT T2~key1
INTO CORRESPONDING FIELDS OF TABLE et_not_pairs
FOR ALL ENTRIES IN INT_TABLE2
FROM ( TABLE1 AS T1 OUTER JOIN TABLE2 AS T2
ON T1~KEY1 = T2~KEY1 AND
T1~KEY2 = T2~KEY2 )
WHERE T2~KEY1 = INT_TALBE2-KEY1 AND
T2~KEY2 = INT_TALBE2-KEY2.
but without effect (error)
‎2007 Mar 29 12:25 PM
Hi!
Always check, is the internal table empty or not, because with an empty internal table, SAP will read ALL entries from T1 and T2, and this will cause bad performance, and/or abap dump (due to the long runtime).
IF NOT INT_TABLE2 IS INITIAL.
SELECT T2~key1
INTO CORRESPONDING FIELDS OF TABLE et_not_pairs
FROM TABLE1 AS T1 OUTER JOIN TABLE2 AS T2
ON T1~KEY1 = T2~KEY1 AND
T1~KEY2 = T2~KEY2
FOR ALL ENTRIES IN INT_TABLE2
WHERE T2~KEY1 = INT_TABLE2-KEY1 AND
T2~KEY2 = INT_TABLE2-KEY2.
ENDIF.
Regards
Tamá
‎2007 Mar 29 1:25 PM
I know I check it is empty, but I didn't paste this checking here
‎2007 Mar 29 4:02 PM
Hello
Try with this code.
SELECT T2~key1
INTO CORRESPONDING FIELDS OF TABLE et_not_pairs
FROM ( TABLE1 AS T1 INNER JOIN TABLE2 AS T2
ON T1KEY1 = T2KEY1 AND
T1KEY2 = T2KEY2 ).
Regards
shibino sooryan.k
‎2007 Mar 30 8:49 AM
But INNER JOIN return existing pairs, I need not existing pairs
‎2007 Apr 03 3:36 PM