‎2006 Jun 15 7:00 PM
REPORT YSDFHSH .
tables : marc,
makt,
mara.
data : begin of t_marc occurs 0,
matnr like marc-matnr,
werks like marc-werks,
maktx like makt-maktx,
zeinr like mara-zeinr,
aeszn like mara-aeszn,
end of t_marc.
select-options : s_matnr for marc-matnr,
s_werks for marc-werks,
sa_lvor for mara-lvorm.
parameters : p_spras like makt-spras.
SELECT cMATNR cWERKS tMAKTX aZEINR a~AESZN
INTO TABLE t_marc
FROM ( marc as c
INNER JOIN MAKT as t ON cMATNR = tMATNR )
INNER JOIN MARA as a ON cMATNR = aMATNR
WHERE c~MATNR IN S_MATNR
AND c~WERKS IN S_WERKS
AND a~LVORM IN Sa_LVOR
AND t~SPRAS = P_SPRAS.
if sy-subrc ne 0.
message 'What hppened' type 'S'.
endif.
loop at t_marc.
write : / t_marc-matnr,
t_marc-werks,
t_marc-maktx,
t_marc-zeinr,
t_marc-aeszn.
endloop.
‎2006 Jun 15 7:01 PM
‎2006 Jun 15 7:01 PM
‎2006 Jun 15 7:07 PM
Also, you may want to swap the MARA and MAKT join since your WHERE clause dicates that C comes first, then A, then T.
report ysdfhsh .
tables : marc, makt, mara.
data : begin of t_marc occurs 0,
matnr like marc-matnr,
werks like marc-werks,
maktx like makt-maktx,
zeinr like mara-zeinr,
aeszn like mara-aeszn,
end of t_marc.
select-options : s_matnr for marc-matnr,
s_werks for marc-werks,
sa_lvor for mara-lvorm.
parameters : p_spras like makt-spras default 'EN'.
select c~matnr c~werks t~maktx a~zeinr a~aeszn
into table t_marc
from marc as c
<b> inner join mara as a
on c~matnr = a~matnr
inner join makt as t
on c~matnr = t~matnr</b>
where c~matnr in s_matnr
and c~werks in s_werks
and a~lvorm in sa_lvor
and t~spras = p_spras.
if sy-subrc ne 0.
* message 'What hppened' type 'S'.
endif.
loop at t_marc.
write : / t_marc-matnr,
t_marc-werks,
t_marc-maktx,
t_marc-zeinr,
t_marc-aeszn.
endloop.
Regards,
Rich Heilman
‎2006 Jun 15 7:03 PM
Works ok, in my system. Were you forgetting to fill the language code on the selection screen.
report ysdfhsh .
tables : marc,
makt,
mara.
data : begin of t_marc occurs 0,
matnr like marc-matnr,
werks like marc-werks,
maktx like makt-maktx,
zeinr like mara-zeinr,
aeszn like mara-aeszn,
end of t_marc.
select-options : s_matnr for marc-matnr,
s_werks for marc-werks,
sa_lvor for mara-lvorm.
<b>parameters : p_spras like makt-spras default 'EN'.</b>
select c~matnr c~werks t~maktx a~zeinr a~aeszn
into table t_marc
from ( marc as c
inner join makt as t on c~matnr = t~matnr )
inner join mara as a on c~matnr = a~matnr
where c~matnr in s_matnr
and c~werks in s_werks
and a~lvorm in sa_lvor
and t~spras = p_spras.
if sy-subrc ne 0.
* message 'What hppened' type 'S'.
endif.
loop at t_marc.
write : / t_marc-matnr,
t_marc-werks,
t_marc-maktx,
t_marc-zeinr,
t_marc-aeszn.
endloop.
Regards,
Rich Heilman
‎2006 Jun 15 7:05 PM
when i execute the selection screen (without entering values), no data is displayed. Could you please explain why?
‎2006 Jun 15 7:06 PM
Rich gave you the answer then. You have a '=' comparison in your WHERE clause and for it to work, you need a value for language that is maintained for the material.
Message was edited by: Srinivas Adavi
‎2006 Jun 15 7:08 PM
If you don't want to take into account the lauguage key, remove it from the selection screen and just change the WHERE clause like this.
select c~matnr c~werks t~maktx a~zeinr a~aeszn
into table t_marc
from marc as c
inner join mara as a
on c~matnr = a~matnr
inner join makt as t
on c~matnr = t~matnr
where c~matnr in s_matnr
and c~werks in s_werks
and a~lvorm in sa_lvor
<b> and t~spras = sy-langu.</b>
Regards,
Rich Heilman