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.
cancel
Showing results for 
Search instead for 
Did you mean: 

Updating material master-BADI

Former Member
0 Kudos

Hi Friends,

I am workig on interface which will recieve a flat file contians customs material master data. And many of the those fileds are newly appended to MARC table.

I have already read the data from the file which is in APPLICATION SERVER.

Now my problem is the updation of material master with that data.

can anybody give suggestion on this issue.

I am trying with BADI(BADI_MATERIAL_REF). But i don know how to link my program and the BADI which i implemented(ZBADI_MATERIAL_REF).

Please help me in solving this issue.

regards,

Anil.

5 REPLIES 5

Former Member
0 Kudos

no need to link, When u activate BADI , It automatically creates link , that will be tiggerd when u create Mat frm MM01.

Regards

Prabhu

0 Kudos

Hi Prabhu,

My fields are custom fileds. When i am debugging control is not coming to the break point.

thanks,

anil

0 Kudos

Please help

Former Member
0 Kudos

Hi

If you read the documentation of this BADI - BADI_MATERIAL_REF.

You will get answers to most of your questions.

<b>Incase you need to add more custom fields to MARC table, You need to create Append structure in that table. {Path GoTo -> Append Structure > Create (Click F5 Key)].</b>


*-------------------------------- BADI Documentation -----------------------------*

The business add-in BADI_MATERIAL_REF can be used to create default data of your own for a material. For example, it can be used to propose material data from certain tables of your own. It can be used only for the material master for industry, not for the material master for retail.

When a material master record is created or extended in the standard R/3 System, default data is essentially determined from Customizing tables and from a reference material (if one has been specified). This default data is proposed on the views maintained in the material master record. However, you may want the values for certain data fields to be proposed differently from the standard R/3 System, or you may also want values to be proposed for data fields for which values are not proposed in the standard R/3 System.

Default data is created in dialog mode and also during data transfer (though default data is not proposed from the reference material in data transfer). The business add-in BADI_MATERIAL_REF runs in dialog mode and in data transfer. This means that default data of your own is also determined during data transfer. In data transfer, the default data is proposed before the data explicitly transferred for the material is merged so that default values are overwritten if specific values are transferred.



*-------------------------------------*

BAdI Interface: Reference Handling for Materials
All material data that can be proposed is contained as export parameters or as change parameters in the interface. In each case, the complete table structures are contained (for example, C_MLGN for material data for each warehouse number) with the exception of three tables for which an update structure is used to ensure that only fields allowed for maintenance can be proposed (E_MARAU, E_MARCU, E_MARDU). In general, you must take care to ensure that only maintainable dialog fields are proposed.

You normally want to offer default data to the user when a material is maintained in dialog mode so that the user has to enter only changes or additional data. However, if the user does not maintain all of the screens for the user department selected (for example, the user maintains only the first MRP screen), the default data for the remaining user department screens must be added when the material is saved (that is, in the update task). For this reason, reference data is determined on the individual dialog screens and in the update task. The business add-in runs this way too.

On the dialog screens, reference data is determined for each subscreen contained on the screen (with the exception of subscreens with key fields for the screen).

In the update task, reference data is determined only once for the material. Values may not be proposed for fields if values have already been proposed for them on the dialog screens (see parameter CT_MAT_REFTAB).

Besides the actual material data, the interface contains further parameters that can be used to control how reference data is determined. All parameters are explained below. Since the material tables MARA, MARC, and MARD in particular contain many internal fields that may not be changed by default values, structures containing only changeable fields have been included as export parameters to protect these tables.

Import parameters

I_MATERIAL_STATUS
This parameter contains all material statuses for which the material is to be created. The material statuses correspond to the user departments, and are coded by letter. The material statuses are contained as a character string in parameter I_MATERIAL_STATUS.
A = work scheduling
B = accounting
C = classification
D = material requirements planning (MRP)
E = purchasing
F = production resources/tools
G = costing
K = basic data
L = storage
P = forecasting
Q = quality management
S = warehouse management
V = sales
On the dialog screens, I_MATERIAL_STATUS contains only those statuses relevant to the current subscreen.
I_REF_MATERIAL
This parameter contains the material number of the reference material if a reference material has been specified on the initial screen. Reference materials cannot be used in data transfer.
IT_MATERIAL_TABLES
The table contains all material tables relevant to the maintenance transaction. For each table, it is specified whether and for which maintenance statuses the material already exists in the database (BISTSTAT). On the dialog screens, I_MATERIAL_TABLES contains only those material tables relevant to the current subscreen.
IT_FIELD_SELECTION
The table contains all fields relevant to the maintenance transaction. The field attributes are contained for each field (for example, input). This table can be used to ensure that only fields ready for input are proposed.
I_MARA
Data valid client-wide (MARA) on the current material.
I_MARC
Plant-specific material data (MARC) on the current material.
I_MARD
Storage location data (MARD) on the current material.
Export parameters

E_MARAU
Changed MARA for the current material (only changeable fields). This parameter should only contain an entry if MARA data is to be proposed.
E_MARCU
Changed MARC for the current material (only changeable fields). This parameter should only contain an entry if MARC data is to be proposed.
E_MARDU
Changed MARD for the current material (only changeable fields). This parameter should only contain an entry if MARD data is to be proposed.
Change parameters

CT_MAT_REFTAB
This table is used to record the material tables for which reference data has already been determined (so that data is not proposed twice, and to prevent changed data from being overwritten by a second default). The table is used by the material master, but can also be used for customer-specific reference handling. An entry is created for each table and material status for which data has already been proposed. (A corresponding reference ID must also be specified. Here, the ID C can be used for a customer-specific reference.)
C_MBEW
Accounting data and costing data (MBEW) on the current material.
C_MPOP
Forecasting data (MPOP) on the current material.
C_MLGN
Warehouse management data (MLGN) on the current material.
C_MLGT
Warehouse management data (MLGT) on the current material.
C_MVKE
Sales data (MVKE) on the current material.
C_MFHM
Production resource/tool data (MFHM) on the current material.
C_MAKT
Material description in the logon language. Since the description in the logon language is contained on the key field subscreens where no reference data is determined, this description cannot be proposed on the dialog screens.
CT_STEXT
Descriptions of the current material.
CT_UOM
Units of measure of the current material.
CT_SALES_TAX
Sales taxes for the current material.
CT_PUR_TAX
Purchasing taxes for the current material.
CT_EAN
*-------------------------------------------------------------* *---------------------------------------------------8

Hope this will help.

Please reward suitable points.

Regards

- Atul

0 Kudos

Hi Atul,

I have to dispaly material description when I select a class in classification tab, In this class we have created 1 to 6 fields and one field is material description. can I display this material description when I select the class automatically from material description of basic data 1 tab through the BADI BADI_MATERIAL_REF.

if yes could you send me the sample code as what parameters to be passed else any other way to do it.

thanks

bobby