Dynamics AX Blog - Dynamics AX 2012 - Microsoft Dynamics AX (Axapta)

These posts are machine-translated.
Currently, only posts from category »Microsoft Dynamics AX (Axapta)« are displayed Filter entfernen

In recent years, i spent a lot of time in developing in the environment of Microsoft Dynamics AX (formerly Axapta). During this time i created a lot of code, from which I could imagine, that it might be very useful for other AX developers too. But I will present also tips and tricks round the powerful ERP system.

Subscribe to RSS feed of this category
Currently, only posts are displayed, which are relevant for Dynamics AX version »Dynamics AX 2012« Filter entfernen

RSS-Feed of this version

"OpenPrinter" error when displaying a report on the screen

If the following error occurs when displaying a report on the screen, you must set up a default printer in Windows.

OpenPrinter_1: rc:0 LastError:3012(0xbc4) No printer were found.


 
 
 

Picking list registration of a sales order by code

The code example below shows how you can use code to post an entry for a picking list (assuming that all necessary information such as the picking location has already been entered).

Screenshot

static void pickingListRegistration(Args _args)
{
    WMSPickingRouteID pickingRouteID = "00061";    // Route id to be picked
    List list = new List(Types::String);

    list.addEnd(pickingRouteID);

    WMSPickingRoute::finishMulti(list.pack());

    wmsDeliverPickedItems::checkDeliverPickedItems(pickingRouteID, list.pack());
}

 


 
 
 

Create picking list for specific lines in a sales order

I do not know how to create a picking list by code only for certain order items.

Therefore I use the following approach:

I create the pick list using the SalesFormLetter framework and before the decisive step (executing the run() method) I delete those entries in the SalesParmLine table that I do not need.

Screenshot

static void createSalesPickingListSingleLine(Args _args)
{
    SalesTable salesTable = salesTable::find("001862"); // Sales order
    container inventTransIdCon = ["014015", "014016"];  // LOT-IDs to pick
    SalesFormLetter salesFormLetter;
    SalesParmLine salesParmLine;
    
    salesFormLetter = SalesFormLetter::construct(DocumentStatus::PickingList);

    // Do the steps manually, which normally are done in method
    // salesFormLetter.update()
    salesFormLetter.salesTable(salesTable);
    salesFormLetter.initParmSalesTable(salesFormLetter.salesTable());
    salesFormLetter.transDate(systemDateGet());
    salesFormLetter.specQty(SalesUpdate::All);
    salesFormLetter.proforma(salesFormLetter.salesParmUpdate().Proforma);
    salesFormLetter.printFormLetter(salesFormLetter.printFormLetter());
    salesFormLetter.printCODLabel(NoYes::No);
    salesFormLetter.printShippingLabel(NoYes::No);
    salesFormLetter.usePrintManagement(false);
    salesFormLetter.creditRemaining(salesFormLetter.creditRemaining());

    salesFormLetter.createParmUpdateFromParmUpdateRecord(
        SalesFormletterParmData::initSalesParmUpdateFormletter(
            salesFormLetter.documentStatus(),
            salesFormLetter.pack(),
            true,
            false,
            false));

    salesFormLetter.initParameters(
        salesFormLetter.salesParmUpdate(),
        Printout::Current);

    salesFormLetter.initLinesQuery();

    // Delete unwanted records in SalesParmLine
    while select forupdate salesParmLine
        where salesParmLine.ParmId == salesFormLetter.parmId()
    {
        if (conFind(inventTransIdCon, salesParmLine.InventTransId) == 0)
        {
            salesParmLine.delete();
        }
    }

    // Let's go
    salesFormLetter.run();
}

 


 
 
 

Create a picking list for all lines in a sales order

The code example below shows how to create a picking list for all lines of a sales order by code.

Screenshot

static void createSalesPickingList(Args _args)
{
    SalesTable salesTable = SalesTable::find("000752");
    SalesFormLetter salesFormLetter;

    salesFormLetter = SalesFormLetter::construct(DocumentStatus::PickingList);
    salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::All);
}

 


 
 
 

Register picking list for selected lines of a sales order

The code example below shows how code can be used to register a picking list and process only partial quantities.

My approach is to create a separate line in the WMSOrderTrans table for the required quantity (using the Split function) and to cancel the currently not needed quantity.

Screenshot

static void pickingListRegistrationPartly(Args _args)
{
    WMSPickingRouteID pickingRouteID = "00066";    // Route id to be picked
    Map inventTransMap = new Map(Types::String, Types::Real);
    MapEnumerator me;
    InventTransId inventTransId;
    Qty pickQty;
    List list = new List(Types::String);
    WmsOrderTrans wmsOrderTrans;
    WmsOrderTrans wmsOrderTransNew;

    list.addEnd(pickingRouteID);

    // Build map containing the lot-ids and quantity to pick
    inventTransMap.insert("014023", 7);
    inventTransMap.insert("014026", 3);
    
    // Change quantity
    me = inventTransMap.getEnumerator();
    while (me.moveNext())
    {
        inventTransId = me.currentKey();    
        pickQty = me.currentValue();
        
        ttsBegin;
        select forupdate wmsOrderTrans
            where wmsOrderTrans.RouteId == pickingRouteID &&
                  wmsOrderTrans.inventTransId == inventTransId &&
                  wmsOrderTrans.FullPallet == NoYes::No &&
                 (wmsOrderTrans.ExpeditionStatus == WMSExpeditionStatus::Registered ||
                  wmsOrderTrans.ExpeditionStatus == WMSExpeditionStatus::Activated  ||
                  wmsOrderTrans.ExpeditionStatus == WMSExpeditionStatus::Started);        
        
        // Split line
        wmsOrderTransNew = wmsOrderTrans.split(pickQty);        
        ttsCommit;
        
        ttsBegin;
        // Cancel remaining line
        wmsOrderTrans.cancel();
        ttsCommit;
    }
    
    // Update
    WMSPickingRoute::finishMulti(list.pack()); 

    wmsDeliverPickedItems::checkDeliverPickedItems(pickingRouteID, list.pack());
}

 
 
 

Extending the Context Menu of the X++ Editor in Dynamics AX 2012

Some years ago I had already written an article about the class EditorScripts. This is the one with which you can easily extend the functionality of the X++ editor.

For example, you can easily extend the context menu of the editor by creating methods in the class.

These methods only have to meet a few criteria, such as

  • The first and only parameter must be of type Editor.
  • The method must be public
  • The method must not return anything (void)

X++-Editor


 
 
 

Requesting information on SSRS reports via the Microsoft Dynamics AX 2012 Management Shell

Microsoft Dynamics AX 2012 Management ShellWith the Microsoft Dynamics AX 2012 Management Shell you can get a lot of information about your Dynamics AX 2012 instance.

For example, you can use the command below to display a list of all SSRS reports or just one specific report (for example, SalesInvoice).

get-AXReport -reportname *
get-AXReport -reportname salesinvoice

 
 
Pages 1 2 3 4 ... 22 » 

 

 
 
 
Posts of the actual month
April 2024
MoTuWeThFrSaSu
1234567
891011121314
15161718192021
22232425262728
2930 
 
© 2006-2024 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.