This is my join. I join VBAK with VBFA, VBAK with VBUK and then join VBFA with LIKP
JOIN
LEFT_OUTER SAP_VBAK.VBAK.VBAK_VBELN IN SAP_VBAK TO MULTIPLE
SAP_VBFA.VBFA.VBFA_VBELV IN SAP_VBFA TAG J0 AS J0
END
JOIN
LEFT_OUTER SAP_VBAK.VBAK.VBAK_VBELN IN SAP_VBAK TO MULTIPLE
SAP_VBUK.VBUK.VBUK_VBELN IN SAP_VBUK TAG J1 AS J1
END
JOIN
LEFT_OUTER SAP_VBFA.VBFA.VBFA_VBELN IN SAP_VBFA TO MULTIPLE
LIKP.LIKP.LIKP_VBELN IN SAP_VBUK TAG J2 AS J2
END
TABLE FILE SAP_VBAK
PRINT
SAP_VBAK.VBAK.VBAK_VBELN
J1.VBUK.VBUK_LFSTK
J1.VBUK.VBUK_GBSTK
J2.LIKP.LIKP_WADAT_IST
WHERE ( J1.VBUK.VBUK_LFGSK NE 'C' ) OR ( J1.VBUK.VBUK_GBSTK NE 'C' );
END
The issue I got is when I used OR to filter record from VBUK, I got the correct result. EX : Output I got
VBELN LFSTK GBSTK WADAT_IST
1111 A C
2222 C B
But if I used 1 more OR with LIKP, I will not get those records ( 1111 and 2222) which suppose to be there.
WHERE ( J1.VBUK.VBUK_LFGSK NE 'C' ) OR ( J1.VBUK.VBUK_GBSTK NE 'C' ) OR (J2.LIKP.LIKP.WADAT_IST EQ '');
For me, It sounds like I only can use OR in one table. Anybody has suggestion for me. Thanks.This message has been edited. Last edited by: hainguyen,
WebFOCUS 7.7.03 Windows, All Outputs
February 14, 2014, 12:54 PM
njsden
This may be related with dealing with a MISSING segment on J2 on not really with the number of OR's in your filter.
You're using LEFT_OUTER joins so I assume you expect records on either J1 or J2 to not exist for a given VBAK_VBELN. Try to test on J2.LIKP.LIKP.WADAT_IST EQ '' may be forcing the whole record to be excluded due to a missing segment on that end.
SET ALL=PASS is terrific at dealing with cases like that *if* you were dealing with FOCUS files but doesn't always help when using DBMS tables.
What happens if you do this instead? :
WHERE ( J1.VBUK.VBUK_LFGSK NE 'C' ) OR ( J1.VBUK.VBUK_GBSTK NE 'C' ) OR (J2.LIKP.LIKP.WADAT_IST EQ MISSING);
This message has been edited. Last edited by: njsden,