You are on page 1of 10

Enabling Mass Maintenance of Append Fields of Material Master Tables

Applies to:
All releases of software component SAP_APPL (Logistics and Accounting) above Release 470. For more information, visit the Enterprise Resource Planning homepage.

Summary
This article illustrates the changes to be done to enable mass maintenance transaction MM17 to update the append fields of the Material Master Tables. Author: Manoj K S

Company: Applexus Technologies Created on: 04 April 2011.

Author Bio
Manoj K S is currently working as Technology Consultant at Applexus Technologies. He has total 8 years of experience out of which more than 3 years of experience is in SAP ABAP consulting.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 1

Enabling Mass Maintenance of Append Fields of Material Master Tables

Table of Contents
Introduction ......................................................................................................................................................... 3 IDOC Enhancements .......................................................................................................................................... 3 Implement BAdI MG_MASS_NEWSEG ............................................................................................................. 5 Enhance Function Module EXIT_SAPLMV02_002 of Customer exit MGV00001 ............................................. 5 Customization for Mass Object: MASSOBJ Transaction. ................................................................................. 7 Customization for Field Selection Group in SPRO ............................................................................................. 7 Related Content .................................................................................................................................................. 9 Disclaimer and Liability Notice .......................................................................................................................... 10

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 2

Enabling Mass Maintenance of Append Fields of Material Master Tables

Introduction
To illustrate the solution, we will be appending the MARA table of Material Master with two append fields ZZCOLOR and ZZPAINT. This solution can also be applied to other Material Master tables like MARC. Material master mass maintenance transaction saves the changes to the materials via ALE inbound processing. The save module of mass maintenance calls methods of BAdI MG_MASS_NEWSEG before calling ALE inbound processing. In the BAdI methods the system can transfer the field values of the Append fields to enhanced IDOC segments of IDOC type MATMAS03. To process the enhanced IDOC during its posting in ALE inbound process, customer exit EXIT_SAPLMV01_002 of enhancement MGV00001 can be used. Customization for Field selection group and addition of the append fields to the field list available for updating, through transaction MASSOBJ is also needed for integrating the fields for mass maintenance.

IDOC Enhancements
1. Create a new segment for the two append fields using transaction WE31. Lets name it ZE1MARA.

2. Create a new extension type by extending the IDOC MATMAS03 by adding the new segment ZE1MARA using transaction WE30. i. Give a name for extension type, select Extension radio button and click create.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 3

Enabling Mass Maintenance of Append Fields of Material Master Tables

ii.

In the following popup screen, select create new radio button and enter MATMAS03 as linked basic type. Give a description and press enter

iii. IDOC structure displaying the structure of the extension appears in the following screen. Select the first level node (E1MARAM) and add the newly created segment as child segment of E1MARAM by clicking create button.

iv. Enter the attributes of the child segment in the popup screen and press enter.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 4

Enabling Mass Maintenance of Append Fields of Material Master Tables

Link message type MATMAS, idoc type MATMAS03 and new extension type using transaction WE82.

Implement BAdI MG_MASS_NEWSEG


Create a BAdI implementation for BAdI MG_MASS_NEWSEG using transaction SE19 and add code in the method ADD_NEW_SEGMENT of the implementation class for inserting data to the new segment of IDOC. For the code, copy the example implementation of method ADD_NEW_SEGMENT delivered with the BAdI (SE18 -> Definition name MG_MASS_NEWSEG -> Display -> menu ->Goto -> Sample code -> Display). Adjust the example implementation to our requirements. Refer comments in the sample code for guidance. In R/3 Systems that are not IS-OIL-specific, all source code passages that are flagged as IS-OIL-specific must be deleted.

Enhance Function Module EXIT_SAPLMV02_002 of Customer exit MGV00001


Add code in Function Module EXIT_SAPLMV02_002 (SMOD enhancement MGV00001) for populating MARA structure back from IDOC during ALE processing. Through this code, the field values of customerspecific append fields must be transferred from the customer-specific IDOC segment to the internal tables of the ALE inbound processing.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 5

Enabling Mass Maintenance of Append Fields of Material Master Tables

Sample code:DATA: x_ze1mara TYPE ze1mara. IF f_cust_segment-segnam = 'ZE1MARA'. x_ze1mara = f_cust_segment-sdata. IF x_ze1mara-zzpaint = c_nodata. CLEAR x_ze1mara-zzpaint. ELSE. IF x_ze1mara-zzpaint IS INIITAL. res_fields-feldname = 'MARA-ZZPAINT'. APPEND res_fields. ENDIF. ENDIF. f_mara_ueb-zzpaint = x_ze1mara-zzpaint. IF x_ze1mara-zzcolor = c_nodata. CLEAR x_ze1mara-zzcolor. ELSE. IF x_ze1mara-zzcolor IS INIITAL. res_fields-feldname = 'MARA-ZZCOLOR'. APPEND res_fields. ENDIF. ENDIF. f_mara_ueb-zzcolor = x_ze1mara-zzcolor. ENDIF.

The repetitive code for each field can be simplified by using the following Macro definition and sample call for each append field. Macro definition:
DEFINE setfield. IF &2 = c_nodata. CLEAR &2. ELSE. IF &2 is initial. res_fields-feldname = &3. APPEND res_fields. ENDIF. ENDIF. &1 = &2. END-OF-DEFINITION.

Macro call : setfield f_mara_ueb-zzcoexper x_ze1mara-zzcolor 'MARA-ZZCOLOR'.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 6

Enabling Mass Maintenance of Append Fields of Material Master Tables

Customization for Mass Object: MASSOBJ Transaction.


Execute transaction MASSOBJ and perform the following: i. Select Object type BUS1001 and go to Field list dialog

ii. Add custom fields here: BUS1001, MARA, <append field name> and save

Customization for Field Selection Group in SPRO


Perform the following in the customizing activity: Logistics General ->Material Master ->Field Selection -> Assign Fields to Field Selection Groups :-

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 7

Enabling Mass Maintenance of Append Fields of Material Master Tables

3. Add entries for each custom field (MARA-ZZfield) here and assign a selection group same as in other standard fields which have similar property (assigning sel. group is mandatory). For this you may copy the existing record of the standard field. 4. In the detail screen set the following:Propose field cont = X Maintenance status = KEDVALBQPSZXFG Select the characters depending on departments to maintain the data:-

ALE field group = GR_GLOB

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 8

Enabling Mass Maintenance of Append Fields of Material Master Tables

Related Content
Mass Maintenance of Procurement Data in SAP Customer Exits Concepts and Working with BADI For more information, visit the Enterprise Resource Planning homepage.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 9

Enabling Mass Maintenance of Append Fields of Material Master Tables

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 10