{"id":7912,"date":"2025-09-26T01:17:11","date_gmt":"2025-09-25T19:47:11","guid":{"rendered":"https:\/\/www.sapewmhelp.com\/?question=user-exit-check-quantity-before-creating-and-modifying-the-sales-order"},"modified":"2025-09-26T01:17:11","modified_gmt":"2025-09-25T19:47:11","slug":"user-exit-check-quantity-before-creating-and-modifying-the-sales-order","status":"publish","type":"question","link":"https:\/\/www.sapewmhelp.com\/?question=user-exit-check-quantity-before-creating-and-modifying-the-sales-order","title":{"rendered":"User Exit &#8212; Check Quantity before creating and modifying the sales order"},"content":{"rendered":"<ol>\n<li>\n<p>User enters Sales Order \u2192 goes to item screen.<\/p>\n<\/li>\n<li>\n<p>User enters <strong>Material + Quantity<\/strong>.<\/p>\n<\/li>\n<li>\n<p>SAP validates item \u2192 calls <strong><code>USEREXIT_CHECK_VBAP<\/code><\/strong>.<\/p>\n<ul>\n<li>\n<p>Your enhancement runs.<\/p>\n<\/li>\n<li>\n<p>If <code>xvbap-kwmeng &lt; 10<\/code>, show error\/warning.<\/p>\n<\/li>\n<li>\n<p>If OK \u2192 continue.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>User clicks <strong>Save<\/strong>.<\/p>\n<\/li>\n<li>\n<p>SAP calls <code>USEREXIT_SAVE_DOCUMENT_PREPARE<\/code> \u2192 do final checks.<\/p>\n<\/li>\n<li>\n<p>SAP calls <code>USEREXIT_SAVE_DOCUMENT<\/code> \u2192 write any custom data.<\/p>\n<\/li>\n<li>\n<p>Standard commit \u2192 sales order saved in tables (VBAK, VBAP, VBEP, etc.).<\/p>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><!--StartFragment --><span><span>FORM\u00a0<\/span>userexit_move_field_to_vbak<span>.<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<p><!--StartFragment --><span><span>&#8220;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;$&#8221;$\\SE:(4)\u00a0Form\u00a0USEREXIT_MOVE_FIELD_TO_VBAK,\u00a0End\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0A<\/span><br \/><span>*$*$-Start:\u00a0(4)&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;$*$*<\/span><br \/><span>ENHANCEMENT\u00a0<\/span><span>1\u00a0\u00a0<\/span>ZAUG_IMP_EN<span>.\u00a0\u00a0\u00a0\u00a0<\/span><span>&#8220;active\u00a0version<\/span><br \/><span>*<\/span><br \/>\u00a0\u00a0<span>if\u00a0<\/span>sy<span>&#8211;<\/span>uname\u00a0=&#8217;77USER67&#8242;<span>.<\/span><br \/>\u00a0\u00a0<span>MESSAGE\u00a0<\/span>&#8216;Enhancement\u00a0trigger&#8217;\u00a0<span>type\u00a0<\/span>&#8216;I&#8217;<span>.<\/span><br \/>\u00a0\u00a0<span>endif<\/span><span>.<\/span><\/p>\n<p><span>ENDENHANCEMENT<\/span><span>.<\/span><br \/><span>ENHANCEMENT\u00a0<\/span><span>1\u00a0\u00a0<\/span>ZSEP_IMP_ENH<span>.\u00a0\u00a0\u00a0\u00a0<\/span><span>&#8220;active\u00a0version<\/span><\/p>\n<p><span>ENDENHANCEMENT<\/span><span>.<\/span><br \/><span>*$*$-End:\u00a0\u00a0\u00a0(4)&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;$*$*<\/span><br \/><span>ENDFORM<\/span><span>.<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>once you implement this code logic in the explicit enhancement and try to do any create and modify operation you will get a message.<\/p>\n<p><img decoding=\"async\" class=\"content-img\" src=\"https:\/\/www.sapewmhelp.com\/wp-content\/uploads\/2025\/09\/en1.png\" \/><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","question-category":[158],"question_tags":[178,293,177,439],"class_list":["post-7912","question","type-question","status-publish","hentry","question-category-abap","question_tags-abap","question_tags-enhancement","question_tags-sap","question_tags-user-exit"],"_links":{"self":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/question\/7912","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/question"}],"about":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7912"}],"wp:attachment":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7912"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fquestion-category&post=7912"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fquestion_tags&post=7912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}