Académique Documents
Professionnel Documents
Culture Documents
I am trying to join a db table with dynamic db table. But i am getting syntax error.
DATA g_viewname(30) type c.
g_viewname = 'V_EQUI'.
*Select Query
SELECT * into table i_equi FROM (g_viewname)
INNER JOIN jest
ON (g_viewname)~objnr eq jest~objnr.
Thanks in advance.
Regards,
Asokan.
Back to top
Google
Sponsor
Back to top
Raju Chitae
Guest
Post subject:
HI,
Can you just post the exact code so that it can be investigated.
Regards
Raju Chitale
Back to top
Asokan
Guest
Hi,
Thank you for the reply. I am posting the source code and the exact error msg i am
getting.
Report zdemo.
Tables: vbrk,
vbrp.
Data g_tablename(30) type c.
Types: Begin of ty_equi,
vbeln like vbrk-vbeln,
end of ty_equi.
Data: i_equi
type Standard table of ty_equi
with header line.
g_tablename = 'VBRK'.
* Below commented code working fine
*SELECT vbrk~vbeln
* into table i_equi
* FROM vbrk
* inner join vbrp
* on vbrk~vbeln EQ vbrp~vbeln.
* Above Commented code working fine
* Dynamic table selection in Select Query
SELECT * into corresponding fields of table i_equi
FROM (g_tablename)
INNER JOIN VBRP
ON (g_tablename)~VBELN eq VBRP~VBELN.
Loop at i_equi.
write :/ i_equi-vbeln.
endloop.
*end of program zdemo
SYNTAX ERROR
Program ZDEMO
Wrong expression "INNER" in FROM clause. WHERE condition.
Includes ZDEMO
Post subject:
Ashokan,
As far as i know a dynamic table name specification is not possible for inner joins.
Back to top
VLozano
Post subject:
Humm... try to approach it through a macro, maybe it works... You will not be able to
debug it but debug an SQL sentence is useless.
Something like
Code:
DEFINE myJoin.
SELECT *
FROM &1 INNER JOIN mytab
ON &1~field = mytabl~field.
END-OF-DEFINITION.
As any of my codes, it's not checked, and will not be checked (almost by me).
_________________
Brief History of the Tuly Idiots
Bad advices, wrong answers, bigotism
sapfans GD
Ad by Viiiiiic
Back to top
Asokan
Guest
Hi all,
Thank you all for the reply's and special thanks to Vlozano. I have added the code for ur
reference and let me know if any other simple method available instead of macro. The
below code working fine.
Report zmademo.
DEFINE myJoin.
Data : begin of i_int occurs 0,
vbeln like vbrp-vbeln,
end of i_int.
SELECT * into corresponding fields of table i_int
FROM &1 INNER JOIN vbrp
ON &1~vbeln = vbrp~vbeln.
Loop at i_int.
write:/ i_int-vbeln.
endloop.
END-OF-DEFINITION.
DATA vbrk(4) TYPE C VALUE 'VBRK'.
myjoin vbrk.
Regards,
Asokan
Back to top
VLozano
Post subject:
Back to top