Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

select?

Former Member
0 Likes
620

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
590

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^

4 REPLIES 4
Read only

Former Member
0 Likes
590

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

Read only

Former Member
0 Likes
590

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.

Read only

Former Member
0 Likes
590

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

Read only

Former Member
0 Likes
591

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^