Skip to Content
author's profile photo Former Member
Former Member

Create change log on Sales order in exit MV45AFZZ

Hello all,

We use userexit MV45AFZZ (FORM USEREXIT_SAVE_DOCUMENT_PREPARE) to set a reason for rejection. We do this by updating the itab xvbap setting abgru.

This works fine.

Now we want that is visible in the change log of the sales order when this reason for rejection is done. How can I fill the sales order change log in a standard sap way?

I've already found FM "VERKBELEG_WRITE_DOCUMENT" but I don't have a clou if it's the correct one and if it is what do I have to fill?

Any help would be great!

Kind regards,

Patrick Keltjens

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Dec 17, 2010 at 03:24 PM

    You don't need to call the change document write function directly - SAP will take care of it as long as you set the value correctly since the filed is flag'd for change docs. I would not do it in the save user exit though because rejecting an item affects pricing, confirmations, etc. What is the trigger/criteria for setting the rejection reason? Can you use USEREXIT_MOVE_FIELD_TO_VBAP instead?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 17, 2010 at 10:43 AM


    If you need to highlight that VBAP-ABGRU was set by userexit and not by the user, you should store this information in an application log (SLG1) programmatically.

    At first you have to configure your specific application log via SLG0.

    Further info can be found here:




    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 20, 2010 at 06:54 AM

    The trigger for setting the reason for rejection in this case is the stock level. If the availability check has turned out that there isn't enough stock we set a reason for rejection and send out a message to the customer. We want the change log to be filled because we also set reason for rejection manually and by the change log we then can see who did set it and then we know if it's done manuallly or by the interface.

    I don't know if the user exit you provided is executed before or after the availability check has taken place. I will have to look into it...

    Add a comment
    10|10000 characters needed characters exceeded

    • In form-routine USEREXIT_SAVE_DOCUMENT_PREPARE, check the values in internal table structure YVBAP which should hold the old values (from DB). If you are changing only the REJECTION REASON through the user-exit, there is a chance that YVBAK will not be populated with old values ( which happens automatically when you update the REASON OF REJECTION through the screen option). The change history will be updated in CDHDR & CDPOS only if there is a difference between values in YVBAP & XVBAP.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.