‎2006 Apr 12 7:39 AM
Dear firends
How are you,,,
I am facing a problem in inner join...please have a look at the code:
select aequnr atplnr a~werk
bequnr bwerks b~stlnr
from v_equi as a
inner join eqst as b
on aequnr = bequnr
into corresponding fields of table it_eqst
where equnr in equp_no.
if sy-subrc = 0.
select stlnr stlkn idnrk posnr
from stpo
into corresponding fields of table t_stpo
for all entries in t_eqst
where stlnr = t_eqst-stlnr and
stlty = 'E'.
this code should give me equipment number as well as functional location, but i am having this message
"The column name "EQUNR" has two meanings. ABAP/4 Open SQL statement."
plese tell me where i am doing mistake, apart from inner join this query will be this way:
"select equnr from v_equi
into corresponding fields of table t_equi
where tplnr in s_tplnr and
equnr in s_equnr.
if sy-subrc = 0.
select equnr stlnr
from eqst
into corresponding fields of table t_eqst
for all entries in t_equi
where equnr = t_equi-equnr.
if sy-subrc = 0.
select stlnr stlkn idnrk posnr
from stpo
into corresponding fields of table t_stpo
for all entries in t_eqst
where stlnr = t_eqst-stlnr and
stlty = 'E'.
but it didnt produce me functional location..
please help me to solve this problem any code, suggestion , will be greate help of mine
thanking you,
regards,
naim
‎2006 Apr 12 7:44 AM
Naim,
Its a simple mistake
select aequnr atplnr a~werk
bequnr bwerks b~stlnr
from v_equi as a
inner join eqst as b
on aequnr = bequnr
into corresponding fields of table it_eqst
where <b>a~equnr</b> in equp_no.
if sy-subrc = 0.
select stlnr stlkn idnrk posnr
from stpo
into corresponding fields of table t_stpo
for all entries in t_eqst
where stlnr = t_eqst-stlnr and
stlty = 'E'.
Every field that exist in both the tables should be accompanied by the table name.
Regards,
Ravi
Note : Please close the thread if this solves the issue.
‎2006 Apr 12 7:41 AM
select aequnr atplnr a~werk
b~stlnr
from v_equi as a
inner join eqst as b
on aequnr = bequnr
into corresponding fields of table it_eqst
where a~equnr in equp_no.
if sy-subrc = 0.
select stlnr stlkn idnrk posnr
from stpo
into corresponding fields of table t_stpo
for all entries in t_eqst
where stlnr = t_eqst-stlnr and
stlty = 'E'.
just delete bequnr than it is ok .... because thee is already aequnr
‎2006 Apr 12 7:43 AM
hi naim,
select aequnr atplnr a~werk
bequnr bwerks b~stlnr
from v_equi as a
inner join eqst as b
on aequnr = bequnr
into corresponding fields of table it_eqst
where <b>a-equnr</b> in equp_no.
if sy-subrc = 0.
select stlnr stlkn idnrk posnr
from stpo
into corresponding fields of table t_stpo
for all entries in t_eqst
where stlnr = t_eqst-stlnr and
stlty = 'E'.
<b>reward if useful..</b>
‎2006 Apr 12 7:44 AM
Naim,
Its a simple mistake
select aequnr atplnr a~werk
bequnr bwerks b~stlnr
from v_equi as a
inner join eqst as b
on aequnr = bequnr
into corresponding fields of table it_eqst
where <b>a~equnr</b> in equp_no.
if sy-subrc = 0.
select stlnr stlkn idnrk posnr
from stpo
into corresponding fields of table t_stpo
for all entries in t_eqst
where stlnr = t_eqst-stlnr and
stlty = 'E'.
Every field that exist in both the tables should be accompanied by the table name.
Regards,
Ravi
Note : Please close the thread if this solves the issue.
‎2006 Apr 12 7:44 AM
Just make the following correction:
select aequnr atplnr a~werk
bequnr bwerks b~stlnr
from v_equi as a
inner join eqst as b
on aequnr = bequnr
into corresponding fields of table it_eqst
**where equnr in equp_no.
where <b>a~equnr</b> in equp_no.