Quantcast
Channel: AX Developer Forum
Viewing all articles
Browse latest Browse all 9880

While PO positng getting error as "cannot edit a record in Purchase orders (PurchTable).Operation canceled "

$
0
0

Through job am trying to invoice one PO.Once po is posted then i can go for invoice if am not wrong.

So for PO posting my code is...

   PurchTable  purchTable;
   PurchFormLetter purchFormLetter;
     ;

    Select purchTable where purchTable.PurchId == '00010241_072';
    purchFormLetter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);
    purchFormLetter.update(purchTable, purchTable.PurchId);

But failed to do posting as am getting the error "cannot edit a record in Purchase orders (PurchTable).Operation canceled "

By debugging and came across that PurchFormLetter ->update()->then createParmUpdate()

In this method am getting parmid as "00180524_001"  then at end cursor comes to insert()

 purchParmUpdate.ParmId                   = this.parmId();

if (! PurchParmUpdate::exist(purchParmUpdate.ParmId))
        purchParmUpdate.insert();

when i went inside it goes PurchLineType.insert()

purchTable = purchLine.purchTable(update); Again going inside i found that purchid is taking parmid  00180524_001 it should take purchid,so as it is not there in purchTable so record is null.

 PurchTable purchTable(boolean  update = false)
{
    return PurchTable::find(this.PurchId, update);
}

Why this.purchid is taking parmid instead  of purchid ?


Viewing all articles
Browse latest Browse all 9880

Trending Articles