jueves, 31 de mayo de 2012

Configuring the Company Information Report Folder

While configuring the M-15 report for the Russia GLS layer in Ax 2009  I ran into the following error:

File C:\Exports\en-us_SalesInvoice_M15.xlt not found

I had set up the Company Information (CompanyInfo) Report Folder value incorrectly, and it should point to a directory 'inside' the Ax installation, holding report templates.  The location on the server will be similar to:

C:\Program Files\Microsoft Dynamics AX\50\Appliation\Share\Include\template\

In our case only two templates exist for the M15 report, in Russian and American English.  I really need to investigate this functionality for future development as it's a very versatile way of creating client reports.

jueves, 17 de mayo de 2012

Item type change from Item to Service

We've generated an error changing an item type to that of a Service.

In English:
Item type cannot be changed to %1 because inventory value has been posted for the item.
First set inventory value to 0.
In Spanish:
No se puede cambiar el tipo de artículo a %1, ya que el valor del inventario se ha registrado para el artículo.
Primero fijar el valor del inventario en 0.

Navigating to the item form (InventTable) and searching for the item we can see that the Availability of the item is not set to zero, we have some in stock.  We found a suggestion that we should therefore close off the inventory (MSDN), although manually updating the available quantity to zero (Inventory management > Forms > Item details > Available > Adjust Quantitywould work if there was no asociated inventory value in the purchase or sales order line for example...  Instead of closing the inventory I opted to adjust the posted value in the transactions to zero (Inventory management > Periodic > Closing and adjustment > Adjust > Transactions). 


In code use the InventItemTypeChange class to update item types, although in the job below I changed the visibility on the buildConfirmTxt static method to public...  For brevity and changes applied by the Eastern Europe/Russia GLS layer (GEEU tags in the code).
static void Job1(Args _args)
{
    InventItemTypeChange    iitc;
    container               confirmTxt;
    ItemType                itemType = ItemType::Service;
    ItemId                  itemId   = "YourItemId";
    #define.posCanChangeType(1)
    ;

    confirmTxt = InventItemTypeChange::buildConfirmTxt(itemId, itemType);
    if (conpeek(confirmTxt, #posCanChangeType) == true)
    {
        iitc        = new InventItemTypeChange();
        iitc.parmItemId(itemId);
        iitc.parmItemType(itemType);
        iitc.run();
    }
}