2020 Dec 22 7:00 AM
I wrote a SQL like below.
FIELD-SYMBOLS:
<datarow> TYPE ANY,
<datafield> TYPE ANY.
SELECT adrc~street FROM ekko left join lfa1 on ekko~lifnr = lfa1~lifnr
left join adrc on lfa1~adrnr = adrc~addrnumber
INTO <datarow>.
And it has error 'If new OPEN SQL syntax used it must used throughtput, including using @ for host variable' I wonder what caused this error, because I tried other SQL clauses and it worked fine. Thx.
2020 Dec 22 5:12 PM
It's using the strict SQL syntax because of the table ADRC which is left-joined on the already left-joined table LFA1. I'm not sure why it's so bad, but the syntax with INNER JOIN is accepted and should do exactly what you want (+ I added ENDSELECT):
SELECT adrc~street
FROM ekko
LEFT JOIN lfa1 ON ekko~lifnr = lfa1~lifnr
INNER JOIN adrc ON lfa1~adrnr = adrc~addrnumber
INTO <datarow>.
ENDSELECT.
2020 Dec 22 7:12 AM
FIELD-SYMBOLS:
<datarow> TYPE ANY,
<datafield> TYPE ANY.
SELECT adrc~street FROM ekko left join lfa1 on ekko~lifnr = lfa1~lifnr
left join adrc on lfa1~adrnr = adrc~addrnumber
INTO @<datarow>.
ENDSELECT.
it need host variable. host variable is your defined variable,it need @.
2020 Dec 22 7:14 AM
FIELD-SYMBOLS:
<datarow> TYPE ANY,
<datafield> TYPE ANY.
SELECT adrc~street FROM ekko left join lfa1 on ekko~lifnr = lfa1~lifnr
left join adrc on lfa1~adrnr = adrc~addrnumber
INTO @<datarow>.
ENDSELECT.
in join table,need it.
2020 Dec 22 11:54 AM
You need to mention @ before mentioning the internal table or work area
2020 Dec 22 5:12 PM
It's using the strict SQL syntax because of the table ADRC which is left-joined on the already left-joined table LFA1. I'm not sure why it's so bad, but the syntax with INNER JOIN is accepted and should do exactly what you want (+ I added ENDSELECT):
SELECT adrc~street
FROM ekko
LEFT JOIN lfa1 ON ekko~lifnr = lfa1~lifnr
INNER JOIN adrc ON lfa1~adrnr = adrc~addrnumber
INTO <datarow>.
ENDSELECT.