1

I have several POs that are in "Approved" status.

When I open it just to review (I'm not going to change anything, but just to see some details) whatever I do it gives me an error message "Changes to the document are only allowed in state Draft, because change management is activated", doesn't matter where I click. Is it normal? Can't we just open Approved PO to see it?

Also another strange thing is that, after I'm getting this error I can't close the form even with esc button which also gives same error message.

Here is the call stack:

(S)\Classes\VersioningDocument\change   33 
(S)\Classes\VersioningPurchaseOrder\change  26 
(S)\Data Dictionary\Tables\PurchLineForeignTradeCategory\Methods\Update 3 
(S)\Classes\xRecord\dbOpInTransaction   0 
(C)\Classes\FormDataSource\write    0 
(C)\Forms\PurchTable\Data Sources\PurchLineForeignTradeCategory\Methods\write   0 
(C)\Classes\FormDataSource\leaveRecord  0 
(C)\Classes\FormDataSource\leaveRecord  0 
(C)\Classes\FormRun\selectControl   0 
(C)\Forms\PurchTable\Methods\selectControl 0

Do anyone experienced same problem and what I can do to resolve it?

Benjamin Diele
  • 1,177
  • 1
  • 10
  • 26
AYETY
  • 698
  • 4
  • 23
  • 38
  • Have you tried to analyze the code that generates the error message? – FH-Inway Oct 27 '15 at 16:52
  • It gives error from VersioningDocument.change() method, but I'm not trying to change anything, I just need to open the PO and see some values.. – AYETY Oct 28 '15 at 07:12
  • I was not able to reproduce this behavior on my system. Are you sure there are no customizations that could influence this? You could also add a breakpoint to the code line where the error gets generated and then post the call stack from the Debugger into your question. You could also debug the conditions that must be fulfilled so this error gets generated. – FH-Inway Oct 28 '15 at 16:31
  • This error is from PREPROD environment and unfortunately we are not able to use debugger, so I got call stack using code: S)\Classes\VersioningDocument\change 33 (S)\Classes\VersioningPurchaseOrder\change 26 (S)\Data Dictionary\Tables\PurchLineForeignTradeCategory\Methods\Update 3 (S)\Classes\xRecord\dbOpInTransaction 0 (C)\Classes\FormDataSource\write 0 (C)\Forms\PurchTable\Data Sources\PurchLineForeignTradeCategory\Methods\write 0 (C)\Classes\FormDataSource\leaveRecord 0 (C)\Classes\FormDataSource\leaveRecord 0 (C)\Classes\FormRun\selectControl 0 (C)\Forms\PurchTable\Methods\selectControl 0 – AYETY Oct 29 '15 at 06:01
  • First of all please edit your question to add the stack trace to it because it is vital information and other people might not read through all the comments when they try to answer your question. Second try to reproduce the problem in a system where you can use the debugger. Third the stack trace now shows you that the update of table `PurchLineForeignTradeCategory` (which is one of the data sources of form `PurchTable`) causes the problem. You could try to prevent this update if you are sure that nothing has been changed. – FH-Inway Oct 29 '15 at 10:10

3 Answers3

0

Disable the Change Management using the below code and then try again;

PurchTable       purchTable;

;

select forUpdate purchTable where purchTable.PurchId == '000532';

if(purchTable) {

    purchTable.ChangeRequestRequired = NoYes::No;
    purchTable.update();

}
0

The following code will help to change the document state to Draft.

 if (purchTable.ChangeRequestRequired && purchTable.DocumentState >= VersioningDocumentState::Approved)
    {
        VersioningPurchaseOrder::newPurchaseOrder(purchTable).createChangeRequest();
    }
}
venkat pasumarti
  • 138
  • 1
  • 1
  • 12
-2

I believe that this error occurred when AX is trying to update the total PO balance, which means it did not continue the "Totals" before the moment of submitting the PO.

While you open the PO and in another cases while you are trying to re-submit a PO after "Request change" and making any change affects the PO balance, AX is trying to calculate the balance and trying to type it in the respective fields, along with that AX prevent any change in any field while not in "Draft", that's why AX is giving you this error.

Resolution

After create the PO, user have to click on "Totals" button, then Submit the PO workflow. Or, you can add that piece of code in the Submit action, if applicable.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • we receive this error while we are receiving a purchase order after posting arrival journal. I think your solution works but my question is what happens in Arrival overview that causes this error raised? – Nastaran Hakimi Jan 04 '20 at 10:55