MV50AFZ1 Delivery User Exit Patterns
Use delivery user exits safely for validation, delivery block and batch-related checks.
Explanation
MV50AFZ1 is commonly used in delivery processing. Delivery exits are used for checks during delivery creation/change, delivery block assignment, batch validation, item category checks and custom status handling. Delivery processing may happen manually through VL01N/VL02N, through collective processing, through background jobs or through interfaces. Logic that works in manual testing may break background processing if assumptions are wrong. Always check delivery type, item category, batch relevance and available structures such as LIKP and XLIPS.
Code example
* Purpose:* Delivery save validation pattern in MV50AFZ1.* Validate only relevant outbound delivery type. FORM userexit_save_document_prepare. * Guard condition: * Run only for outbound delivery type LF. IF likp-lfart <> 'LF'. RETURN. ENDIF. LOOP AT xlips ASSIGNING FIELD-SYMBOL(<ls_lips>). * Business rule: * Batch must be available before saving delivery item. IF <ls_lips>-matnr IS NOT INITIAL AND <ls_lips>-charg IS INITIAL. MESSAGE 'Batch is required before delivery save' TYPE 'E'. ENDIF. ENDLOOP. ENDFORM.Real project scenario
A delivery save exit blocks delivery when batch determination is missing for batch-managed items.
Common mistakes
- Testing only VL01N and ignoring background delivery creation. - Missing delivery type guard condition. - Assuming all item data is available at every point. - Not checking item category or batch relevance.
Best practices
- Check delivery type. - Check item category and batch relevance. - Test manual and background creation. - Avoid heavy DB calls in save flow.
Interview angle
A strong answer should mention MV50AFZ1 for delivery and explain timing, structures and background impact.