Technical Articles
QM Open Note – #3 – Next Inspection Date update (code level)
QM Open Note
QM Open Note is a blog post series about topics, which can be useful when working with Quality Management.
Overview
Current blog post contains some scenarios with code places, where the Next Inspection Date for a batch is updated (MCHA-QNDAT).
In detail
Documentation of Data element ‘QNPDAT’:
“Next Inspection Date
Defines the date for the next recurring inspection for the batch.
Dependencies
There is a program that runs on a cyclical basis for monitoring the date. If necessary, this program creates an inspection lot.
You can also use the following functions for deadline monitoring:
- The job overview display function
- The job planning maintenance function”
Scenarios:
-
Usage decision is made for an inspection lot (transaction QA11):
- Call Stack:
8 FORM WIEDERKEHRENDE_PRUEFUNG SAPMQEVA MQEVAF40
7 FORM CHARGE_KLASSIFIZIEREN SAPMQEVA MQEVAF40
6 FORM OK_FCODE_BUCHEN SAPMQEVA MQEVAF30
5 FORM FCODE_BEARBEITEN SAPLV00F LV00FF0F - Code:
*/Nächstes Prüfdatum ist heute plus Prüfintervall aus Materialstamm g_npruefdatum = sy-datum + marc-prfrq. WRITE g_npruefdatum DD/MM/YY TO l_datum_aufbereitet. */Customer-Function für 'Neues Prüfdatum' CALL CUSTOMER-FUNCTION '003' EXPORTING i_qals = qals i_qave = qave i_prfrq = marc-prfrq i_zeugnisbis = qals-zeugnisbis i_qndat = g_mchar-qndat IMPORTING e_qndat_neu = l_qndat2.
Customer Exit for Calculating Next Inspection Date is EXIT_SAPMQEVA_003 (Enhancement QEVA0003).
- Call Stack:
-
Goods receipt for a purchase order (transaction MIGO or MIGO_GR):
- Call Stack:
14 FORM CHARGENDATEN_MAT_SETZEN SAPFM07M FM07MFCL_CHARGENDATEN_MAT_SETZ
13 FORM MATERIAL_PRUEFEN SAPFM07M FM07MEM0_MATERIAL_PRUEFEN
12 FORM LAGERORTDATEN SAPMM07M MM07MFL0_LAGERORTDATEN
11 FUNCTION MB_CREATE_GOODS_ISSUE_ITEM SAPLMBWL LMBWLU04
10 FUNCTION MB_CREATE_GOODS_MOVEMENT SAPLMBWL LMBWLU14
9 FUNCTION MB_CREATE_GOODS_MOVEMENT SAPLMBWL LMBWLU14
8 METHOD DOCUMENT_OPERATION SAPLMIGO LMIGOKD1 - Code:
* Set next inspection date via BAdI MB_BATCH_MASTER DATA: lv_qndat_keep TYPE xfeld. "1947010 TRY. GET BADI g_badi_batch_master. CALL BADI g_badi_batch_master->maintain_inspection_date EXPORTING is_vm07m = vm07m is_mbefu = mbefu is_dm07m = dm07m is_mcha_buf = loc_mcha_buf IMPORTING ev_qndat = vm07m-qndat ev_qndat_keep = lv_qndat_keep. "1947010 CATCH cx_badi_not_implemented. ENDTRY. * Setzten des nächsten Prüfdatums wenn noch nicht gesetzt IF lv_qndat_keep IS INITIAL. "1947010 IF vm07m-qndat IS INITIAL AND NOT mbefu-prfrq IS INITIAL AND mbefu-qndat IS INITIAL AND NOT vm07m-lwedt IS INITIAL. vm07m-qndat = vm07m-lwedt + mbefu-prfrq. ENDIF. ENDIF.
Setting of Batch Data on Goods Movement with BAdI MB_BATCH_MASTER, including Next Inspection Date. (Interface IF_EX_MB_BATCH_MASTER, Enhancement Spot MB_GOODSMOVEMENT)
- Call Stack:
-
Enter production order confirmation (transaction CO15 with goods movement):
- Call Stack:
22 FORM CHARGENDATEN_MAT_SETZEN SAPFM07M FM07MFCL_CHARGENDATEN_MAT_SETZ
21 FORM MATERIAL_PRUEFEN SAPFM07M FM07MEM0_MATERIAL_PRUEFEN
20 FORM LAGERORTDATEN SAPMM07M MM07MFL0_LAGERORTDATEN
19 FUNCTION MB_CREATE_GOODS_ISSUE_ITEM SAPLMBWL LMBWLU04
18 FUNCTION MB_CREATE_GOODS_MOVEMENT SAPLMBWL LMBWLU14
17 FUNCTION MB_CREATE_GOODS_MOVEMENT SAPLMBWL LMBWLU14
16 FUNCTION CO_RU_GOODS_MOVEMENT SAPLCORF LCORFU42
15 FORM VB_GOODS_MOVEMENT SAPLCORF LCORFF4S
14 FUNCTION CO_RU_CONF_POST SAPLCORF LCORFU46
13 FUNCTION PROCESS_CC234_MESSAGES SAPLCOPD LCOPDU13
12 FUNCTION PLANT_DATA_ANALYZE SAPLCOPD LCOPDU06
11 FUNCTION CO_RU_CONFIRMATION_POST SAPLCORF LCORFU08 - Code: same as in Scenario 2.) with the MIGO, as same function modules and forms are called.
- Call Stack:
Known problem & solution
Transaction QA07 (Program RQAAAS10) can be used to trigger recurring inspection / deadline monitoring of batches.
There are some requirements for the successful selection of batches according to the program documentation:
“…
The batch master data corresponds to the selection conditions.
Only those batches that fulfill the following conditions are examined:
- The batch status is “released”.
- The unrestricted-use stock is greater than zero.
- The stock is not in an HU storage location.
- The stock is not special stock.
…”
See SAP Note about possible room for custom development:
608830 – BIC: BAdI implementation for the recurring inspection
Feel free to share your experience/feedback in the Comment Section. Thank you.