Dynamics AX Blog
Picking list registration of a sales order by code
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 orderI 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.
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
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
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 2012Some 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
|
Requesting information on SSRS reports via the Microsoft Dynamics AX 2012 Management Shell
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 |
|
|
|
|
|
|



With the Microsoft Dynamics AX 2012 Management Shell you can get a lot of information about your Dynamics AX 2012 instance.
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.