Dynamics AX Blog

These posts are machine-translated.
Schau auf dich, bleib zu Hause
 

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

 
 
 

Release to warehouse

To call the function "Release to warehouse" for one or more orders by code, you can use the following code.
Screenshot
static void releaseToWareHouse(Args _args)
{
    SalesTable salesTale = SalesTable::find('002162');
    CustCreditMaxCheck creditMaxCheck;
    List listSalesTable = new List(Types::Record);
    container packedData;
    
    // Release to warehouse
    creditMaxCheck = WHSParameters::getCreditMaxCheck();
    listSalesTable.addEnd(salesTale);

    // Must use value of enum when going through IL
    packedData = [enum2int(creditMaxCheck), listSalesTable.pack()];

    WHSWarehouseRelease::salesFormReleaseCallCIL(packedData);
}

 


 
 
 

Entry "RPC exception 1702 occurred" in the event log

Object Server 01:  RPC error: RPC exception 1702 occurred in session 4 process is Ax32Serv.exe thread is 8788(User: admin, ClientType: Worker)

This entry may indicate the use of client-side code on the server, such as calling a WinApi function from a batch job.

It can also be triggered by calling info(), Warning() or error() within a batch job, if the option "Enable global breakpoint" is enabled at the respective AOS.

Screenshot AX 2012 Server Configuration Utility


 
 
 

SQL error when synchronizing after updating from AX 2012 to CU13

During the upgrade of an AX 2012 R3 CU9 instance to CU13 (February release) I had the following error at the point Synchronize database of the upgrade checklist:

SQL error description: [Microsoft][SQL Server Native Client 11.0][SQL Server]The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.LEDGERPERIODMODULEACCESSCONTROL' and the index name 'I_7375LEDGERFISCALCALENDARPERIODIDX'. The duplicate key value is (5637144576, 22565421332).

SQL statement: CREATE UNIQUE  INDEX I_7375LEDGERFISCALCALENDARPERIODIDX ON "DBO".LEDGERPERIODMODULEACCESSCONTROL (PARTITION,LEDGERFISCALCALENDARPERIOD)

The solution is to leave this error for now and start with the next step of the checklist, the data upgrade. One of the jobs to be executed cleans up the data records that lead to the error.

After the data upgrade, the database can now be synchronized without errors.

Screenshot
 


 
 
 

SysOperation-Framework: Controlling ExecutionMode and server method to be executed using the MenuItem

If you want to control the SysOperationExecutionMode and/or the server method to be executed via the MenuItem in a SysOperation construct, you can control this via the properties of the MenuItem.

Scenario: Without own controller

The following two MenuItems show how to set the properties for them:

This MenuItem calls the runService() method of a service class and sets the SysOperationExecutionMode to Synchronous:

Screenshot


 
 
Pages 1 2 3 4 ... 23 » 

 

 
 
 
Posts of the actual month
April 2020
MoTuWeThFrSaSu
 12345
6789101112
13141516171819
20212223242526
27282930 
 
© 2006-2020 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.