Introduction To illustrate the solution, we will be appending the MVKE table of Sales Data for Material with two append fields MVGR6 and MVGR7.This solution can also be applied to other Material Master tables like MARC,MARA,MBEW etc. 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 v alues of the Append fields to enhanced IDOC segments of IDOC type MATMAS05. To process the enhanced IDOC during its posting in ALE inbound process, customer exit EXIT_SAPLMV01_002 of enhancement MGV00001 can be used. Include name is ZXMGVU04.Customization for Field selection group and addition of the append fields to the field list available for updating, through transaction MASSOBJ and OMSR is also needed for integrating the fields for mass maintenance and append the fields in both transaction.
MVKE table we have added the two fields .(MVGR6 and MVGR7)
As per the recommendation re commendation we have used SAP notes 414020 and 57 6160 but still facing problems updating the custom fields through MM17.
IDOC Enhancements
Create a new segment for the two append fields using transaction WE31. Let’s name it ZE1M VKE and ZE1MARCM.
2. Create a new extension type by extending the IDOC MATMAS05 by adding the new segment ZE1MVKE and using transaction WE30.
i. Give a name for extension type, select Extension radio button and click create.
ii. I have used the R/3 system with version 4.7 so I have created the new segment ZE1MVKE by copying through segment MATMAS05 also we have added E1MVKEM under ZE1MVKE. In the following popup screen, select cr eate new radio button and enter MATMAS05 as linked basic type. iii. IDOC structure displaying the structure of the extension appears in the following screen. Select the first level node (E1MVKEM) and add the newly created segment as child segment of E1MVKEM by clicking create button.
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.
Following code is below: types: lty_idoc_data type edidd. types: begin of lty_e1maram, docnum type edidc-docnum, pointer type sy-tabix. include type e1maram as data. types: end of lty_e1maram. types: lty_e1maram_tab type standard table of lty_e1maram. types: begin of lty_e1mvkem, docnum type edidc-docnum, pointer type sy-tabix. include type e1mvkem as data. types: end of lty_e1mvkem. types: lty_e1mvkem_tab type standard table of lty_e1mvkem. types: begin of lty_ze1mvke, docnum type edidc-docnum, pointer type sy-tabix. include type ze1mvke as data. "<<< INSERT LINE * INCLUDE TYPE e1mvkem AS data. "<<< DELETE LINE types: end of lty_ze1mvke. types: lty_ze1mvke_tab type standard table of lty_ze1mvke. **************************************************************** *** End Types declaration of customer specific IDoc segments * ************************************************************** data : wa_tab type mass_wa_tabdata, ls_idoc_data type lty_idoc_data, fieldnames like line of wa_tab-fieldnames, wa_newseg like line of wa_tab-newsegments, lt_e1mvkem type lty_e1mvkem_tab, ze1mvkem type lty_ze1mvke, "customer specific wze1mvkem type lty_ze1mvke, "customer specific
lt_ze1mvkem type lty_ze1mvke_tab, we1mvkem type lty_e1mvkem, lt_e1maram type lty_e1maram_tab, we1maram type lty_e1maram, e1maram type lty_e1maram, e1mvkem type lty_e1mvkem, lv_matnr type matnr. *. data : ls_smvke like line of smvke, docnum type edidc-docnum, found, fname type dcobjdef-name, segname type dcobjdef-name, wsegname type dcobjdef-name. **
* local Field Symbols field-symbols type any. field-symbols type any. data: t1(32), t2(32),findex like sy-tabix.
* lt_e1maram = t_e1maram. lt_e1mvkem = t_e1mvkem . *fieldnames[] = seldata-fieldnames[]. segname = 'ZE1MVKE'.
* customer specific MVKE Appendfields in MM17 mass change ** ** ZSMBEW ** read table seldata into wa_tab with key tabname-name = 'MVKE' . loop at smvke into ls_smvke. clear: ze1mvkem , docnum. * clear newstat. read table wa_tab-newsegments into wa_newseg index sy-tabix. if not sy-subrc is initial. "old segment do. sy-index = sy-index + 2. assign component sy-index of structure ze1mvkem to . if sy-subrc ne 0. exit. endif. = '/'. enddo. *fill key fields *fill data fields loop at wa_tab-fieldnames into fname. concatenate 'LS_SMVKE' '-' fname into t1. assign (t1) to . if not sy-subrc is initial. continue. endif. concatenate 'ZE1MVKEM' '-' fname into t2. assign (t2) to . if not sy-subrc is initial. continue. endif. = . endloop. else. "new segment, take all fields
move-corresponding ls_smvke to ze1mvkem . endif. *work our way up the hierachy, if there is one clear: found, findex. *fill parent key fields clear e1maram. e1maram-matnr = ls_smvke-matnr . e1mvkem-vkorg = ls_smvke-vkorg . e1mvkem-vtweg = ls_smvke-vtweg . we1maram-matnr = ls_smvke-matnr . we1mvkem-vkorg = ls_smvke-vkorg . we1mvkem-vtweg = ls_smvke-vtweg . move '004' to e1maram-msgfn . * search the corresponding MVKE segment read table lt_e1maram with key matnr = e1maram-matnr into we1maram transporting docnum pointer matnr. read table lt_e1mvkem with key docnum = we1maram-docnum vkorg = e1mvkem-vkorg vtweg = e1mvkem-vtweg into e1mvkem. call function 'I_MASS_GET_INDEX' exporting pointer = e1mvkem-pointer importing tabix = findex. findex = findex + 1. docnum = e1mvkem-docnum . *end of hierarchy work *collection of append statements if ze1mvkem-docnum is initial. e1mvkem-docnum = docnum. ls_idoc_data-segnam = 'ZE1MVKE' . ls_idoc_data-sdata = ze1mvkem-data . ls_idoc_data-docnum = docnum. if findex is initial. findex = 1. endif. insert ls_idoc_data into t_idoc_data index findex. call function 'I_MASS_SET_INDEX' exporting tabix = findex importing pointer = ze1mvkem-pointer.
append ze1mvkem to lt_ze1mvkem. endif. endloop.
Enhance Function Module EXIT_SAPLMV02_002 of Customer exit MGV00001 Add code in Function Module EXIT_SAPLMV02_002 (SMOD enhancement MGV00001) for populating MVKE structure back from IDOC during ALE processing. Through this code, the field values of customer specific append fields must be transferred from the customer-specific IDOC segment to the internal tables of the ALE inbound processing. I have created the project through CMOD (ZMM17) and activate the user exist.
Sample code in below of EXIT_SAPLMV02_002. data: x_ze1mvke type ze1mvke. if f_cust_segment-segnam = 'ZE1MVKE'. x_ze1mvke = f_cust_segment-sdata. if x_ze1mvke-mvgr6 = c_nodata. clear x_ze1mvke-mvgr6. else. if x_ze1mvke-mvgr6 is initial. res_fields-feldname = 'MVKE-MVGR6'. append res_fields. endif. endif. f_mvke_ueb-mvgr6 = x_ze1mvke-mvgr6. if x_ze1mvke-mvgr7 = c_nodata. clear x_ze1mvke-mvgr7. else. if x_ze1mvke-mvgr7 is initial. res_fields-feldname = 'MVKE-MVGR7'. append res_fields. endif. endif. f_mvke_ueb-mvgr7 = x_ze1mvke-mvgr7. endif.
After that you will update the custom fields in MM17 transaction.