I got this code working pretty good......
report zrich_0001. data begin of i_mara occurs 0. include structure mara_ueb. "Basic Data Views data end of i_mara. data begin of i_marc occurs 0. include structure marc_ueb. "Plant Views data end of i_marc. data: i_marcx type table of marc with header line. data: tranc(10) value '0000000001'. parameters: p_matnr type mara-matnr, p_werks type marc-werks, p_plifz type marc-plifz. select * into corresponding fields of table i_marcx from marc where matnr = p_matnr and werks = p_werks. tranc = '0000000001'. loop at i_marcx. * Reset I_Mara to new material number clear i_mara. refresh i_mara. select * into corresponding fields of table i_mara from mara where matnr = p_matnr. read table i_mara index 1. i_mara-tcode = 'MM02'. i_mara-tranc = tranc. modify i_mara index 1. * Get Plant Data clear i_marc. refresh i_marc. select * into corresponding fields of table i_marc from marc where matnr = i_marcx-matnr and werks = i_marcx-werks. read table i_marc index 1. i_marc-plifz = p_plifz. i_marc-tranc = tranc. modify i_marc index 1. tranc = tranc + '0000000001'. *Create Plant associated views perform create_material_views. endloop. ************************************************************************ * CREATE_MATERIAL_VIEWS ************************************************************************ form create_material_views. * Variable for "Maintain_Material_Dark" Function Module data: numerror like tbist-numerror. data: last_matnr type mara-matnr. data: begin of i_delfields occurs 20. include structure mfieldres. data: end of i_delfields. data: begin of i_errors occurs 20. include structure merrdat. data: end of i_errors. call function 'MATERIAL_MAINTAIN_DARK' exporting sperrmodus = ' ' kz_prf = 'W' max_errors = ' ' p_kz_no_warn = 'X' kz_verw = 'X' kz_aend = 'X' kz_dispo = 'X' kz_test = ' ' flag_muss_pruefen = ' ' call_mode = 'ACT' importing number_errors_transaction = numerror matnr_last = last_matnr tables amara_ueb = i_mara "Basic Data * amakt_ueb = i_makt "Descriptions amarc_ueb = i_marc "Plant * amard_ueb = i_mard "Storage Location * AMFHM_UEB = I_MFHM "Production Tools * amarm_ueb = i_marm "Units of Measure * AMEA1_UEB = I_MEA1 "Internal Mangagement - EANs * ambew_ueb = i_mbew "Accounting/Costing * asteu_ueb = i_steu "Tax Data * astmm_ueb = i_steumm "Tax Data * AMLGN_UEB = I_MLGN "Warehouse Data * AMLGT_UEB = I_MLGT "Storage Type Data * AMPGD_UEB = I_MPGD "Change Documents * AMPOP_UEB = I_MPOP "Forcast Parameters * AMVEG_UEB = I_MVEG "Total Consumption Data * AMVEU_UEB = I_MVEU "Unplanned Consumption Data * amvke_ueb = i_mvke "Sales Data * altx1_ueb = i_ltx1 "Sales Text * AMPRW_UEB = I_MPRW "Forcast Values amfieldres = i_delfields amerrdat = i_errors exceptions kstatus_empty = 01 tkstatus_empty = 02 t130m_error = 03 internal_error = 04 update_error = 05 too_many_errors = 06. if sy-subrc <> 0. rollback work. call function 'DEQUEUE_ALL'. else. commit work and wait. call function 'DEQUEUE_ALL'. endif. clear: i_mara, i_marc. refresh: i_mara, i_marc. endform.
Regards,
Rich Heilman
Do you need to use Bapi?? I know there is a function that available from SAP that can update MARC/WRPL/MPOP...but this function only available in 4.7.. otherwise.. search oss note for this function..
"MATERIAL_UPDATE_LOGISTICS_DATA".. This is a mass update function and it only update thousands of MARC records within a few seconds....
Add a comment