1. A method for modeling a defect management routine in a production process and for handling the defect during the production process based on the defect management routine, both the modeling and the handling being executed within a manufacturing execution system, which comprises the steps of: during an engineering phase, performing the steps of: modeling the production process as well as creating a library of possible defect types which may occur during the production process; assigning the defect types to at least one defect group representing a hierarchical clustering to collect different but related defect types; creating a library of defect specifications, each defect specification being linked to the defect types; creating a library of defect type specification details assigning the defect types to a resource-related context; creating at least one runtime defect criteria used to link the defect type to a certain production volume; creating a runtime defect measurement routine monitoring a result of a corrective measure executed after an identification of the defect type; and during a runtime production phase, performing the steps of: evaluating a product produced according to the production process against predetermined quality criteria; identifying the respective defect type out of the library of defect types in case of a violation of the predetermined quality criteria; using an identified defect type to determine a corrective measure, to determine a runtime defect criteria identifying a resource causing the defect type, to determine a production volume possibly affected by the defect type, and to run the runtime defect measurement routine.