‎2007 Apr 30 8:49 PM
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 Apr 30 8:59 PM
can u pls make ur question more clear ?
do you mean this ?
select lfa1lifnr ekkoebeln ekpoebelp maramatnr
into corresponding fields of table itab
from lfa1 <b>inner</b> join ekko on lfa1lifnr = ekkolifnr
<b>inner</b> join ekpo on ekkoebeln = ekpoebeln
<b>inner</b> join matnr on ekpomatnr = maramatnr.
‎2007 Apr 30 9:21 PM
hi auistine,
for this we can write select statement with out using corresponding fields, by using simply inner joins. but wat is the diff b/w these.at the same time instead of all these can we use nested select by declaring diff internal tables for diff table-fields.i need nested selct statement also. if help full full points...urgent.
thanx
lokanadhan
‎2007 Apr 30 9:23 PM
hi augustine,
in the above code i din't mention inner key word , in select statemnt.is there any problem without tht?
thanx
lokanadhan.k
‎2007 Apr 30 10:01 PM
data : begin of t_lfa1 occurs 0,
lifnr like lfa1-lifnr,
end of t_lfa1.
data : begin of t_ekko occurs 0,
ebeln like ekko-ebeln,
lifnr like lfa1-lifnr,
end of t_ekko.
data : begin of t_ekpo occurs 0,
ebeln like ekko-ebeln,
ebelp like ekpo-ebelp,
matnr like ekpo-matnr,
end of t_ekpo.
select-options : s_lifnr for lfa1-lifnr.
select lifnr from lfa1 into table t_lfa1 where lifnr in s_lifnr.
if not t_lfa1[] is initial.
select ebeln lifnr from ekko into table t_ekko for all entries in t_lfa1 where
lifnr = t_lfa1-lifnr.
endif.
if not t_ekko[] is initial.
select ebeln ebelp from ekpo into table t_ekpo for all entries in t_ekko where
ebeln = t_ekko-ebeln.
endif.
if not t_ekpo[] is initial.
select ebeln ebelp matnr from ekpo into table t_ekpo for all entries in t_ekko where
ebeln = t_ekko-ebeln.
endif.
‎2007 Apr 30 10:40 PM
hi augustine,
data : begin of t_lfa1 occurs 0,
lifnr like lfa1-lifnr,
end of t_lfa1.
data : begin of t_ekko occurs 0,
ebeln like ekko-ebeln,
lifnr like lfa1-lifnr, <--- why r u repeating this table field
end of t_ekko.
data : begin of t_ekpo occurs 0,
ebeln like ekko-ebeln,<--- why r u repeating this table field
ebelp like ekpo-ebelp,
matnr like ekpo-matnr,
end of t_ekpo.
-
> while writing the select statements i can write the conditions.r u sure tht we need to write compulasary.
select-options : s_lifnr for lfa1-lifnr.
select lifnr from lfa1 into table t_lfa1 where lifnr in s_lifnr.
if not t_lfa1[] is initial. <---- what is the use of this statement
select ebeln lifnr from ekko into table t_ekko for all entries in t_lfa1 where
lifnr = t_lfa1-lifnr.
endif.
if not t_ekko[] is initial.
select ebeln ebelp from ekpo into table t_ekpo for all entries in t_ekko where
ebeln = t_ekko-ebeln.
endif.
if not t_ekpo[] is initial.
select ebeln ebelp matnr from ekpo into table t_ekpo for all entries in t_ekko where
ebeln = t_ekko-ebeln.
endif.
pls explain the doubts tht i marked with arrows.once clear full points..urgent.
thanx
lokanadhan