Skip to Content

Read material data residing in MARA


To create a purchase requistion from an external application, I used RFC.

But I have to read material data first, so I read them from MARA table using database queries. But, sometimes when I try to create a requistion, I get a message telling me that the material is not activated.

I tried to read materials using BAPI_MATERIAL_GET_DETAIL, BAPI_MATERIAL_GET_ALL and BAPI_MATERIAL_GETALL but all of those functions module require a material number as input and I want to get all materials.

How can I check if a material is active using database queries ? Or is there any function module that I can use to read all materials without putting material number as input?


Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jul 22, 2020 at 06:17 PM

    You can use RFC_READ_TABLE function to ready any database table. It is possible to call the function with SQL WHERE conditions and you don’t need to provide material number when reading MARA.

    Notice that the function is not officially released by SAP. Make sure to read related OSS notes.

    Best regards

    Dominik Tylczynski

    Add a comment
    10|10000 characters needed characters exceeded

    • Hello Dominik,
      Thank you for replaying. but what's the condition in the clause WHERE and from what table?
      When I execute the function module RFC_READ_TABLE, I get the description of the table and the column having "Deactivated" description (which is called ENTAR) is empty.

  • Posted on Jul 23, 2020 at 01:58 PM

    Hi Malek Guenichi

    You can use RFC_READ_TABLE to read material master data from MARA table. Specify table name in QUERY_TABLE parameter.

    In the FIELDS parameter you can specify which fields of the table you want to read.

    If you need to read only specific materials e.g. from a specific material group, you can put that in OPTIONS parameter e.g. MATKL = 'material group'. The syntax of OPTIONS parameter is the same as SQL syntax of WHERE condition.

    Alternatively you can use BAPI_MATERIAL_GETLIST function to read material list based on selection criteria. The function is quite well documented.

    Best regards

    Dominik Tylczynski

    Add a comment
    10|10000 characters needed characters exceeded

    • The actual issue is, for some materials, when I create a purchase requisition via RFC, I get the message saying that my materiel is not activated. (see the description above and my comment of your first reply)
      So I want to retreive only the activated materiels and I didn't know what column is responsible of that.
      Which means that the issue is not resolved yet.
      Thank you anyway, it was kind that you tried to help me.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.