‎2007 Sep 12 2:12 PM
Hi all,
I have a parameters like
Matnr
Mtart
Plant on my selection screen
I need to fetch list of materials from MARA based on input selection.
But there is no PLANT field available in MARA.
How can I write the select statement ..
select matnr
spart
mtart
from mara into table int_mara
where matnr in p_matnr and
spart in p_spart and
mtart in p_mtart.
Instead of this.
Vkr.
‎2007 Sep 12 2:26 PM
hi
good
if there is no plant in MARA table than you cant able to access any plant data from that table,yes check with y our functional consultant whether there is any other table which contain similar plant so that you can use that table and access the plant data.
Your select statement is correct.
thanks
mrutyun^
‎2007 Sep 12 2:16 PM
Hi!
gt_main table contains the relevant fields from mara and marc also.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE gt_main
FROM mara
INNER JOIN marc ON mara~matnr = marc~matnr
WHERE mara~matnr IN p_matnr AND
marc~werks IN p_werks AND
...
Regards
Tamás
Message was edited by:
Tamás Nyisztor
‎2007 Sep 12 2:18 PM
hi
u can use joins
select p1~matnr
p1~mtart
p2~werks
into table itab
from ( mara as p1
join marc as p2 on p1matnr = p2matnr )
where matnr in s_matnr and
matart eq p_matart and
werks eq p_werks.
‎2007 Sep 12 2:23 PM
Hi,
You need to create the Internal tables
then
Select MATNR MTART <fields which you likw> into talbe ITAB1 from MARA
where MATNR = P_MATNR and
MTART = P_MTART.
IF not ITAB[] is initial.
SELECT MATNR MTART WERKS <fields which you want > into table IT_MARC
from MARC for all entries in ITAB where
MATNR = ITAB-MATNR and
WERKS = P_WERKS
Regards
Sudheer
‎2007 Sep 12 2:26 PM
hi
good
if there is no plant in MARA table than you cant able to access any plant data from that table,yes check with y our functional consultant whether there is any other table which contain similar plant so that you can use that table and access the plant data.
Your select statement is correct.
thanks
mrutyun^