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

Material's plant

Former Member
0 Kudos


How can i get the plant(s) against a material number??

- Umair


Former Member
0 Kudos

- <b>MARC</b> table with the material Number.

Former Member
0 Kudos

Hi Umair,

You will have to go to MARC table to do that.

If u want to find out that a plant has been created for a material number, select matnr( material number), werks ( plant code ) from marc table in your select statement and comapare matnr in where clause with ur select option material number or the material taken from MARA table.

And check sy-subrc = 0 condition after ur select statement.

Try it out and u will get the desired results.



Former Member
0 Kudos

Isnt there any BAPI thorugh which we can get the plants in which a specific material is produced??

Secondly could you guide me how do we query a specific tabel to get the information though BAPIs like in this scenario??

Former Member
0 Kudos


A slightly more non-technical answer -

Go to the transaction MM03, enter the material number and select the <i>Sales: General/Plant Data</i> view. In the pop-up, hit F4 for the plant field. You will get all the plants for which the material has been maintained.


Anand Mandalika.

0 Kudos

Doesn't look like there is a BAPI for this, but you can just use the following code.

Data: begin of itab occurs 0,
      matnr type marc-matnr,
      werks type marc-werks,
      end of itab.

Select matnr werks into corresponding fields 
          of table itab from marc
                  where matnr = Your_material_Number.
check sy-subrc  = 0.


Rich Heilman

Former Member
0 Kudos

Thanks guyz for the replies but i am afraid i cannot directly query the table from db as i have to do this through my win Application and its discouraged to query the table there through .Net connector!!!

I actually have to get a mterial's price through Material.GetDetail BAPI and it requires the plant number in case of dealing with the valuation. All i have with me is the material number.

Though i know this is the pure ABAP forum but will be glad to know if somebody knows any wprkaround.



0 Kudos

Ok, then put the code into a RFC enabled function module, then call this function module from your .net application.


Rich Heilman

0 Kudos

Hi Umair,

You can use the RFC function RFC_READ_TABLE. You need to pass it the following:




OPTIONS - One row with the following entry:

TEXT = 'MATNR = <zero padded material number>'

FIELDS - One row with the following entries:


OFFSET = '000000'

LENGTH = '000004'

TYPE = 'C'


The result table DATA will have all the plants for the given material.

This should get you exactly what you need. You can use this function for getting data from any SAP table without going to the database directly.

Hope that helps.



Message was edited by: Brad Williams

0 Kudos

Hi Umair,

a price determination is something totally different!

You need much more (process) definition, before you can get (and display) correct price.

Do you look for a purchase price / sales price / value of stock? That will be 3 different values.

In case of purchase or sales, it's generally amount dependent (scales: 10 cost 1,90 each, 1 cost 1,99).

Date! Tomorrow it might be more expensive.

Who is asking? Are you looking as customer? There might be special customer agreements...

If several vendors / sites can deliver, who will be source of supply -> different transport costs...

Get a more detailed definition and you will get a better answer for your problem.

With all these explanations for MARC selects (e.g. via own RFC-function, that's good) you can't get nearer to your solution.



0 Kudos

Hi Umair,

Use RFC MATERIAL_READ_PLANTS to read all the plants for a material.

Then use CK_RFC_GET_PRICE to get the material price.

Now if you are talking about a sales item price, then that will be a whole different set of FMs.

Let us know how it goes.