we were facing problem regarding duplicate material creation since our MM end user were not co-ordinating with each other and
moreover there was no check and measures to stop creating duplicate material since Material number is a auto generated number.
We solved this problem by using an exit in SAP where you can check the material by its Description before posting data.
Please note that this is useful if the current material description is same to the previously created material Description.
Step 1: create a project using CMOD
Step 2: Use enhancement MGA00001
Step 3: Use exit EXIT_SAPLMGMU_001
Step 4: Double click on the include and write the below code in INCLUDE ZXMG0U02.
DATA: wa_stext TYPE short_desc,
s_maktx TYPE maktx.
READ TABLE stext INTO wa_stext INDEX 1.
IF sy–subrc = 0.
SELECT SINGLE maktx FROM makt
CLIENT SPECIFIED INTO s_maktx
WHERE mandt = sy–mandt
AND maktx = wa_stext–maktx.
IF s_maktx IS NOT INITIAL AND sy–tcode = ‘MM01’.
MESSAGE ‘ERROR: Material already exists …’ TYPE ‘E’ .
** Note: you can use CONDENSE if you want to compress spaces and then check.