‎2007 May 01 7:33 AM
Hi guru's,
here iam trying to write some code for the following requirement,but at select statement i want to use innerjoin how can i? and wat will happen if i'll use this corresponding .is there any chance to write a select statement as nested select if possible how pls help me . full points.urgent
if usefull full points.to all
thanx regards
lokanadhan
Req: by using classical report
-
vendor from -
to -
-
output:-
-
vno p.o itemno material
-
-
tables : lfa1,ekko,ekpo,mara.
parameters : vendor like lfa1-lifnr.
data : begin of itab occurs 0,
lifnr like lfa1-lifnr,
ebeln like ekko-ebeln,
ebelp like ekpo-ebelp,
matnr like mara-matnr,
end of itab.
select lfa1lifnr ekkoebeln ekpoebelp maramatnr
into corresponding fields of table itab
from lfa1 join ekko on lfa1lifnr = ekkolifnr
join ekpo on ekkoebeln = ekpoebeln
join matnr on ekpomatnr = maramatnr.
loop at itab.
write : / itab-lifnr ,itab-ebeln,itab-ebelp,itab-matnr.
endloop.
‎2007 May 01 7:37 AM
HI..,
No need to use the CORRESPONDING FIELDS OF here..
Nested SELECTS and INTO CORRESPONDING FIELDS degrades the performance..
just check this..
tables : lfa1,ekko,ekpo,mara.
parameters : vendor like lfa1-lifnr.
data : begin of itab occurs 0,
lifnr like lfa1-lifnr,
ebeln like ekko-ebeln,
ebelp like ekpo-ebelp,
matnr like mara-matnr,
end of itab.
select lfa1lifnr ekkoebeln ekpoebelp maramatnr
into table itab
from lfa1
inner join ekko on lfa1lifnr = ekkolifnr
inner join ekpo on ekkoebeln = ekpoebeln
inner join mara on ekpomatnr = maramatnr
where lfa1~lifnr eq vendor.
loop at itab.
write : / itab-lifnr ,itab-ebeln,itab-ebelp,itab-matnr.
endloop.
regards,
sai ramesh
‎2007 May 01 7:37 AM
HI..,
No need to use the CORRESPONDING FIELDS OF here..
Nested SELECTS and INTO CORRESPONDING FIELDS degrades the performance..
just check this..
tables : lfa1,ekko,ekpo,mara.
parameters : vendor like lfa1-lifnr.
data : begin of itab occurs 0,
lifnr like lfa1-lifnr,
ebeln like ekko-ebeln,
ebelp like ekpo-ebelp,
matnr like mara-matnr,
end of itab.
select lfa1lifnr ekkoebeln ekpoebelp maramatnr
into table itab
from lfa1
inner join ekko on lfa1lifnr = ekkolifnr
inner join ekpo on ekkoebeln = ekpoebeln
inner join mara on ekpomatnr = maramatnr
where lfa1~lifnr eq vendor.
loop at itab.
write : / itab-lifnr ,itab-ebeln,itab-ebelp,itab-matnr.
endloop.
regards,
sai ramesh
‎2007 May 01 7:42 AM
hi ramesh,
for the same code i need an nested select statement.how can i write tht...,is there any chance to go with for all entries.if possible how?
thanx
yogi
‎2007 May 01 7:45 AM
hi ramesh,
is there any difference b/w inner join and join.
thanx
yogi
‎2007 May 01 7:38 AM
Hi,
use the inner join statemnet only.its better to use join statement compared to nested selection statements.this is the efficient way in performance wise.
select lfa1lifnr ekkoebeln ekpoebelp maramatnr
into corresponding fields of table itab
from lfa1 inner join ekko on lfa1lifnr = ekkolifnr
inner join ekpo on ekkoebeln = ekpoebeln
inner join mara on ekpomatnr = maramatnr.
rgds,
bharat.
‎2007 May 01 7:40 AM
HI..
Just paste this code...<b>which is modified..</b>
select-options:
vendor for lfa1-lifnr.
data : begin of itab occurs 0,
lifnr like lfa1-lifnr,
ebeln like ekko-ebeln,
ebelp like ekpo-ebelp,
matnr like mara-matnr,
end of itab.
select lfa1lifnr ekkoebeln ekpoebelp maramatnr
into corresponding fields of table itab
from lfa1 join ekko
on lfa1lifnr = ekkolifnr
join ekpo
on ekkoebeln = ekpoebeln
join mara
on ekpomatnr = maramatnr.
loop at itab.
write : / itab-lifnr ,itab-ebeln,itab-ebelp,itab-matnr.
endloop.
‎2007 May 01 7:41 AM
Hi ..
join mara <i>(mistake matnr</i>) on ekpomatnr = maramatnr.