Disable Edit Of Sales Order Using Status Profile

Problem:

How to disable editing of the sales order using status profile once the order is approved by approver for delivery/ billing?

Solution:

You may need to use user exit USEREXIT_SAVE_DOCUMENT_PREPARE or USEREXIT_SAVE_DOCUMENT in program MV45AFZZ.

You can conveniently do this in USEREXIT_READ_DOCUMENT in MV45AFZZ. This user exit is called after the Sales order number is entered in the initial screen of VA02 and before the order details screens are shown. So it is ideally suited for your purpose.

We have similar coding in our production system where we show error message to the user if he tries to open the sales order in VA02 and the sales order is already released/signed, captured by a status in our custom status profile.

The coding may look like. You can make appropriate changes to suit your requirement.

Code:

if vbak-auart = 'ZOR' and sy-tcode = 'VA02'. 

   concatenate 'VB' vbak-vbeln '000000' into zobjnr.

   select single stat into jest-stat

      from jest

       where objnr = zobjnr

              and stat = 'E0003'

            and inact = space.
 

   if sy-subrc = 0.

* Order status is E0003 - cannot change

      message id 'Z5' type 'E' number '134'.

   endif.

endif.

SAP SD Tips

See Also
Language Picked For Material Description

Get help for your SAP SD problems
SAP SD Forums - Do you have a SAP SD Question?

SAP Sales and Distribution Books
SAP SD Books  - Certification, Interview Questions and Configuration

Delivery Hints
SAP Logistics Execution

SAP Sales and Distribution Tips
SAP SD Discussion Forum and Sales/Distribution Tips

Main Index
SAP Basis, ABAP Programming and Other IMG Stuff

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.