Showing posts with label AX 2009. Show all posts
Showing posts with label AX 2009. Show all posts

Tuesday, May 26, 2015

Over delivery of line is 100 percent, but the allowed over delivery is only 0 percent.

Q: I am getting the following error in AX 2009, how can I fix it?
"Over delivery of line is 100 percent, but the allowed over delivery is only 0 percent."

A:
Use the following script
static void fixPurchaseOrders(Args _args)
{
   PurchParmTable purchParmTable;
   PurchParmLine purchParmLine;
   ;
   ttsbegin;
   while select forupdate purchParmTable
       join forupdate purchParmLine
       where purchParmLine.ParmId == purchParmTable.ParmId
       && purchParmLine.TableRefId == purchParmTable.TableRefId
       && purchParmTable.PurchId == ""
       && purchParmTable.ParmJobStatus == ParmJobStatus::Waiting
       && purchParmTable.Ordering == DocumentStatus::Invoice
   if(purchParmTable.RecId || purchParmLine.RecId)
   {
       purchParmTable.delete();
       purchParmLine.delete();
   }
   ttscommit;

}

Thursday, November 27, 2014

How to build a User List Lookup / Drop Down in AX 2009

User List Lookup / Drop Down
Step 1:Create a method in the form to get the user list lookup
void userListLookup(FormStringControl control)
{
    Args                args;
    MenuFunction        menuFunction;
    Object              formRun;
;

    args = new Args();

    menuFunction = new MenuFunction(menuitemdisplaystr(WorkflowUserListLookup), MenuItemType::Display);
    args = new Args(menuFunction.object());
    args.caller(element);
    args.parm(control.text());

    formRun = ClassFactory::formRunClassOnClient(args);
    formRun.init();
    formRun.run();
    formRun.wait();

    if (formRun.closedOk())
    {
        control.text(formRun.parmTo());
        element.redraw();
    }
}

Step 2: Call the method in the lookup event of the EDT
public void lookup()
{
    element.userListLookup(this);
}


Alternative Method: Just select WorkflowUserListLookup as formhelp on your EDT

Tuesday, November 18, 2014

How to import and compile an xpo from Start Up


How to import and compile an xpo from Start Up
In order to import an XPO from command line in AX 2009 we can use AX32.exe StartUp command;
ax32.exe -StartupCmd=AutoRun_c:\Configuration.XML

The configuration XML would contain path to the AOT object to compile after import the XPO.
    exitWhenDone="true"
    version="4.0"
    logFile="C:\Temp\AxaptaAutorun.log">

     file="C:\Temp\CodeFile.xpo" />