SAP BAPI_MATERIAL_GET_ALL Function Module for BAPI for Reading Material Data
BAPI_MATERIAL_GET_ALL is a standard bapi material get all SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for BAPI for Reading Material Data processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for bapi material get all FM, simply by entering the name BAPI_MATERIAL_GET_ALL into the relevant SAP transaction such as SE37 or SE38.
Function Group: BUS1001006
Program Name: SAPLBUS1001006
Main Program: SAPLBUS1001006
Appliation area:
Release date: 29-Apr-2003
Mode(Normal, Remote etc): Remote-Enabled
Update:
Function BAPI_MATERIAL_GET_ALL pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'BAPI_MATERIAL_GET_ALL'"BAPI for Reading Material Data.
EXPORTING
MATERIAL = "Material Number
* STGE_TYPE = "Storage Type
* LIFO_VALUATION_LEVEL = "LIFO Valuation Level
* KZRFB_ALL = "Indicator: reset buffer for Material_Pre_Fetch
* COMP_CODE = "Company Code
* VAL_AREA = "Valuation Area
* VAL_TYPE = "Valuation Type
* PLANT = "Plant
* STGE_LOC = "Storage Location
* SALESORG = "Sales Organization
* DISTR_CHAN = "Distribution Channel
* WHSENUMBER = "Warehouse Number / Warehouse Complex
IMPORTING
CLIENTDATA = "Material Data at Client Level
PRTDATA = "Production Resource Tool (PRT) Fields in the Material Master
LIFOVALUATIONDATA = "LIFO-Relevant Material Data
PLANTDATA = "Material Data at Plant Level
FORECASTPARAMETERS = "Forecast Parameters
PLANNINGDATA = "Change Document Structure for Material Master/Product Group
STORAGELOCATIONDATA = "Material Data at Storage Location Level
VALUATIONDATA = "Valuation Data
WAREHOUSENUMBERDATA = "Warehouse Number Data
SALESDATA = "Sales Data
STORAGETYPEDATA = "Storage type data
TABLES
* MATERIALDESCRIPTION = "Material Descriptions
* UNITSOFMEASURE = "Units of Measure
* INTERNATIONALARTNOS = "International Article Numbers (EANs)
* MATERIALLONGTEXT = "Long Texts
* TAXCLASSIFICATIONS = "Tax Data
* EXTENSIONOUT = "Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
* RETURN = "Return Parameters
IMPORTING Parameters details for BAPI_MATERIAL_GET_ALL
MATERIAL - Material Number
Data type: BAPI_MARA_GA-MATERIALOptional: No
Call by Reference: No ( called with pass by value option)
STGE_TYPE - Storage Type
Data type: BAPI_MLGT_GA-STGE_TYPEOptional: Yes
Call by Reference: No ( called with pass by value option)
LIFO_VALUATION_LEVEL - LIFO Valuation Level
Data type: BAPI_MYMS_GA-LIFO_VALUATION_LEVELOptional: Yes
Call by Reference: No ( called with pass by value option)
KZRFB_ALL - Indicator: reset buffer for Material_Pre_Fetch
Data type: MTCOM-KZRFBOptional: Yes
Call by Reference: No ( called with pass by value option)
COMP_CODE - Company Code
Data type: BAPI0002_1-COMP_CODEOptional: Yes
Call by Reference: No ( called with pass by value option)
VAL_AREA - Valuation Area
Data type: BAPI_MBEW_GA-VAL_AREAOptional: Yes
Call by Reference: No ( called with pass by value option)
VAL_TYPE - Valuation Type
Data type: BAPI_MBEW_GA-VAL_TYPEOptional: Yes
Call by Reference: No ( called with pass by value option)
PLANT - Plant
Data type: BAPI_MARC_GA-PLANTOptional: Yes
Call by Reference: No ( called with pass by value option)
STGE_LOC - Storage Location
Data type: BAPI_MARD_GA-STGE_LOCOptional: Yes
Call by Reference: No ( called with pass by value option)
SALESORG - Sales Organization
Data type: BAPI_MVKE_GA-SALES_ORGOptional: Yes
Call by Reference: No ( called with pass by value option)
DISTR_CHAN - Distribution Channel
Data type: BAPI_MVKE_GA-DISTR_CHANOptional: Yes
Call by Reference: No ( called with pass by value option)
WHSENUMBER - Warehouse Number / Warehouse Complex
Data type: BAPI_MLGN_GA-WHSE_NOOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BAPI_MATERIAL_GET_ALL
CLIENTDATA - Material Data at Client Level
Data type: BAPI_MARA_GAOptional: No
Call by Reference: No ( called with pass by value option)
PRTDATA - Production Resource Tool (PRT) Fields in the Material Master
Data type: BAPI_MFHM_GAOptional: No
Call by Reference: No ( called with pass by value option)
LIFOVALUATIONDATA - LIFO-Relevant Material Data
Data type: BAPI_MYMS_GAOptional: No
Call by Reference: No ( called with pass by value option)
PLANTDATA - Material Data at Plant Level
Data type: BAPI_MARC_GAOptional: No
Call by Reference: No ( called with pass by value option)
FORECASTPARAMETERS - Forecast Parameters
Data type: BAPI_MPOP_GAOptional: No
Call by Reference: No ( called with pass by value option)
PLANNINGDATA - Change Document Structure for Material Master/Product Group
Data type: BAPI_MPGD_GAOptional: No
Call by Reference: No ( called with pass by value option)
STORAGELOCATIONDATA - Material Data at Storage Location Level
Data type: BAPI_MARD_GAOptional: No
Call by Reference: No ( called with pass by value option)
VALUATIONDATA - Valuation Data
Data type: BAPI_MBEW_GAOptional: No
Call by Reference: No ( called with pass by value option)
WAREHOUSENUMBERDATA - Warehouse Number Data
Data type: BAPI_MLGN_GAOptional: No
Call by Reference: No ( called with pass by value option)
SALESDATA - Sales Data
Data type: BAPI_MVKE_GAOptional: No
Call by Reference: No ( called with pass by value option)
STORAGETYPEDATA - Storage type data
Data type: BAPI_MLGT_GAOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for BAPI_MATERIAL_GET_ALL
MATERIALDESCRIPTION - Material Descriptions
Data type: BAPI_MAKT_GAOptional: Yes
Call by Reference: Yes
UNITSOFMEASURE - Units of Measure
Data type: BAPI_MARM_GAOptional: Yes
Call by Reference: Yes
INTERNATIONALARTNOS - International Article Numbers (EANs)
Data type: BAPI_MEAN_GAOptional: Yes
Call by Reference: Yes
MATERIALLONGTEXT - Long Texts
Data type: BAPI_MLTX_GAOptional: Yes
Call by Reference: Yes
TAXCLASSIFICATIONS - Tax Data
Data type: BAPI_MLAN_GAOptional: Yes
Call by Reference: Yes
EXTENSIONOUT - Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
Data type: BAPIPAREXOptional: Yes
Call by Reference: Yes
RETURN - Return Parameters
Data type: BAPIRETURNOptional: Yes
Call by Reference: Yes
Copy and paste ABAP code example for BAPI_MATERIAL_GET_ALL Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.DATA: | ||||
lv_material | TYPE BAPI_MARA_GA-MATERIAL, " | |||
lv_clientdata | TYPE BAPI_MARA_GA, " | |||
lt_materialdescription | TYPE STANDARD TABLE OF BAPI_MAKT_GA, " | |||
lv_prtdata | TYPE BAPI_MFHM_GA, " | |||
lv_stge_type | TYPE BAPI_MLGT_GA-STGE_TYPE, " | |||
lv_lifovaluationdata | TYPE BAPI_MYMS_GA, " | |||
lv_lifo_valuation_level | TYPE BAPI_MYMS_GA-LIFO_VALUATION_LEVEL, " | |||
lv_kzrfb_all | TYPE MTCOM-KZRFB, " | |||
lv_comp_code | TYPE BAPI0002_1-COMP_CODE, " | |||
lv_plantdata | TYPE BAPI_MARC_GA, " | |||
lt_unitsofmeasure | TYPE STANDARD TABLE OF BAPI_MARM_GA, " | |||
lv_val_area | TYPE BAPI_MBEW_GA-VAL_AREA, " | |||
lv_forecastparameters | TYPE BAPI_MPOP_GA, " | |||
lt_internationalartnos | TYPE STANDARD TABLE OF BAPI_MEAN_GA, " | |||
lv_val_type | TYPE BAPI_MBEW_GA-VAL_TYPE, " | |||
lv_planningdata | TYPE BAPI_MPGD_GA, " | |||
lt_materiallongtext | TYPE STANDARD TABLE OF BAPI_MLTX_GA, " | |||
lv_plant | TYPE BAPI_MARC_GA-PLANT, " | |||
lt_taxclassifications | TYPE STANDARD TABLE OF BAPI_MLAN_GA, " | |||
lv_storagelocationdata | TYPE BAPI_MARD_GA, " | |||
lv_stge_loc | TYPE BAPI_MARD_GA-STGE_LOC, " | |||
lt_extensionout | TYPE STANDARD TABLE OF BAPIPAREX, " | |||
lv_valuationdata | TYPE BAPI_MBEW_GA, " | |||
lt_return | TYPE STANDARD TABLE OF BAPIRETURN, " | |||
lv_salesorg | TYPE BAPI_MVKE_GA-SALES_ORG, " | |||
lv_warehousenumberdata | TYPE BAPI_MLGN_GA, " | |||
lv_salesdata | TYPE BAPI_MVKE_GA, " | |||
lv_distr_chan | TYPE BAPI_MVKE_GA-DISTR_CHAN, " | |||
lv_whsenumber | TYPE BAPI_MLGN_GA-WHSE_NO, " | |||
lv_storagetypedata | TYPE BAPI_MLGT_GA. " |
  CALL FUNCTION 'BAPI_MATERIAL_GET_ALL' "BAPI for Reading Material Data |
EXPORTING | ||
MATERIAL | = lv_material | |
STGE_TYPE | = lv_stge_type | |
LIFO_VALUATION_LEVEL | = lv_lifo_valuation_level | |
KZRFB_ALL | = lv_kzrfb_all | |
COMP_CODE | = lv_comp_code | |
VAL_AREA | = lv_val_area | |
VAL_TYPE | = lv_val_type | |
PLANT | = lv_plant | |
STGE_LOC | = lv_stge_loc | |
SALESORG | = lv_salesorg | |
DISTR_CHAN | = lv_distr_chan | |
WHSENUMBER | = lv_whsenumber | |
IMPORTING | ||
CLIENTDATA | = lv_clientdata | |
PRTDATA | = lv_prtdata | |
LIFOVALUATIONDATA | = lv_lifovaluationdata | |
PLANTDATA | = lv_plantdata | |
FORECASTPARAMETERS | = lv_forecastparameters | |
PLANNINGDATA | = lv_planningdata | |
STORAGELOCATIONDATA | = lv_storagelocationdata | |
VALUATIONDATA | = lv_valuationdata | |
WAREHOUSENUMBERDATA | = lv_warehousenumberdata | |
SALESDATA | = lv_salesdata | |
STORAGETYPEDATA | = lv_storagetypedata | |
TABLES | ||
MATERIALDESCRIPTION | = lt_materialdescription | |
UNITSOFMEASURE | = lt_unitsofmeasure | |
INTERNATIONALARTNOS | = lt_internationalartnos | |
MATERIALLONGTEXT | = lt_materiallongtext | |
TAXCLASSIFICATIONS | = lt_taxclassifications | |
EXTENSIONOUT | = lt_extensionout | |
RETURN | = lt_return | |
. " BAPI_MATERIAL_GET_ALL |
ABAP code using 7.40 inline data declarations to call FM BAPI_MATERIAL_GET_ALL
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8."SELECT single MATERIAL FROM BAPI_MARA_GA INTO @DATA(ld_material). | ||||
"SELECT single STGE_TYPE FROM BAPI_MLGT_GA INTO @DATA(ld_stge_type). | ||||
"SELECT single LIFO_VALUATION_LEVEL FROM BAPI_MYMS_GA INTO @DATA(ld_lifo_valuation_level). | ||||
"SELECT single KZRFB FROM MTCOM INTO @DATA(ld_kzrfb_all). | ||||
"SELECT single COMP_CODE FROM BAPI0002_1 INTO @DATA(ld_comp_code). | ||||
"SELECT single VAL_AREA FROM BAPI_MBEW_GA INTO @DATA(ld_val_area). | ||||
"SELECT single VAL_TYPE FROM BAPI_MBEW_GA INTO @DATA(ld_val_type). | ||||
"SELECT single PLANT FROM BAPI_MARC_GA INTO @DATA(ld_plant). | ||||
"SELECT single STGE_LOC FROM BAPI_MARD_GA INTO @DATA(ld_stge_loc). | ||||
"SELECT single SALES_ORG FROM BAPI_MVKE_GA INTO @DATA(ld_salesorg). | ||||
"SELECT single DISTR_CHAN FROM BAPI_MVKE_GA INTO @DATA(ld_distr_chan). | ||||
"SELECT single WHSE_NO FROM BAPI_MLGN_GA INTO @DATA(ld_whsenumber). | ||||
Search for further information about these or an SAP related objects