Skip to Content
Author's profile photo Former Member

Function Module reading all details of any Material

Introduction


Case 1 – Create a material with reference to some existing material in the ECC system.

Case 2 – Create a report with data from MARC, MARD, MVKE, MBEW, etc.

Case 3 – Get the existing Purchase Order text of any material.

To suit the above needs, SAP has given a wonderful Function Module ‘CRS_MATERIAL_READ_ALL’. Using this function module we can pass the Material Number and get all the details of that material.

Code example for the same is :-

Form get_material_details.

DATA :

*-for CRS_MATERIAL_READ_ALL Function Module ————–*

*– Sales Data

               lt_mvke    TYPE STANDARD TABLE OF    mvke,

*– Valuation Data

               lt_mbew    TYPE STANDARD TABLE OF    mbew,

*– Plant Data

               lt_marc    TYPE STANDARD TABLE OF    marc,

*– Storage Location Data

               lt_mard    TYPE STANDARD TABLE OF    mard,

*– Material Description Data

               lt_makt    TYPE STANDARD TABLE OF    makt,

*– Units oF Measure Data

               lt_marm    TYPE STANDARD TABLE OF    marm,

*– International Article Numbers Data

               lt_mean    TYPE STANDARD TABLE OF    mean,

*– Tax Classifications Data

               lt_mlan    TYPE STANDARD TABLE OF    mlan,

*– Purchase Order Text Data

               lt_cdtxt   TYPE STANDARD TABLE OF    cdtxt.

CALL FUNCTION ‘CRS_MATERIAL_READ_ALL’

   EXPORTING

     iv_matnr           = ‘000000000000000010’  ” Pass the material Number here.

   TABLES

     et_mvke            = lt_mvke

     et_mbew            = lt_mbew

     et_marc            = lt_marc

     et_mard            = lt_mard

     et_makt            = lt_makt

     et_marm            = lt_marm

     et_mean            = lt_mean

     et_mlan            = lt_mlan

     et_icdtxt_material = lt_cdtxt.

Endform.

Disclaimer :- The simple reason for posting this was that i was unable to find proper example of this very powerful function module. It can reduce lots of Inner Joins and FAE on the concerned tables.

Also if you are planning to use this for Case 1 it can be used a sub step for it.


Thanks.



Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Eitan Rosenberg
      Eitan Rosenberg

      Hi,

      I think that it will be fair to say that this function is "Not released"

      Regards.

      Author's profile photo Former Member
      Former Member

      Hi Eitan,

      You are true that this FM has not been released yest but still it can be used with comfort is what i feel.

      BR.

      Author's profile photo Eitan Rosenberg
      Eitan Rosenberg

      Hi,

      This is ok.

      But there are organizations that are very strict about "Not released" policy .

      After checking "where used" I found that this function is hardly used.

      Regards.

      Author's profile photo Former Member
      Former Member

      Hi Eitan,

      It is an alternative which i suggested. Using this blog i just want to spread the word about this powerful FM.

      BR.

      Author's profile photo Former Member
      Former Member

      Instead of using this "powerful, yet unreleased" FM, i would rather use BAPI_MATERIAL_GETALL 😐

      Author's profile photo Former Member
      Former Member

      Just an alternative 🙂 .

      Author's profile photo Shwetabh Narayan
      Shwetabh Narayan

      If we are using BAPI_MATERIAL_GETALL, and passing the following fields: MATNR, BWKEY, BWTAR, LGORT, LGTYP, VKORG and LGNUM in BODS to the FM. Is it possible that all the export views of the module will be extracted or only specific fields should be passed ?

      As when passing all the fields to the function call, all data in the views is not exporting.

       

      Author's profile photo Shwetabh Narayan
      Shwetabh Narayan

      Hello Suhas,

       

      If we are using BAPI_MATERIAL_GETALL, and passing the following fields: MATNR, BWKEY, BWTAR, LGORT, LGTYP, VKORG and LGNUM in BODS to the FM. Is it possible that all the export views of the module will be extracted or only specific fields should be passed ? Request you help in this regards.