InventTransferMultiShip inventTransferMultiShip;
inventTransferMultiReceive inventTransferMultiReceive;
InventTransferMultiPick InventTransferMultiPick;
parmId parmId;
List list = new List(Types::String);
WMSPickingRoute localWMSPickingRoute;
numberSequenceReference numberSequenceReference;
NumberSeq numberSeq;
InventTransferTable inventTransferTable;
InventTransferLine inventTransferLine;
InventDim inventDim;
Num num;
inventTransferParmUpdate inventTransferParmUpdate;
inventTransferParmTable inventTransferParmTable;
;
inventTransferTable.clear();
inventTransferTable.initValue();
ttsBegin;
numberSeq = NumberSeq::newGetNum(InventParameters::numRefTransferId());
num = numberSeq.num();
ttsCommit;
inventTransferTable.TransferId = num;
inventTransferTable.InventLocationIdFrom = "AUSTIN";
inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdFrom));
inventTransferTable.InventLocationIdTo = "CINCINN";
inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdTo));
inventTransferTable.TransferStatus = InventTransferStatus::Created;
//inventTransferTable.lin = 1;
inventTransferTable.insert();
inventTransferLine.clear();
inventTransferLine.initFromInventTransferTable(inventTransferTable,
NoYes::Yes);
inventTransferLine.ItemId = "0001";
inventDim.inventSiteId = "CENTRAL";
inventDim.InventLocationId = "AUSTIN";
inventDim = inventDim::findOrCreate(inventDim);
inventTransferLine.initFromInventTable(InventTable::find("0001"));
inventTransferLine.InventDimId = inventDim.inventDimId;
inventTransferLine.QtyTransfer = 2;
inventTransferLine.QtyShipNow = 2;
inventTransferLine.QtyReceiveNow = 2;
inventTransferLine.QtyRemainShip = 2;
inventTransferLine.QtyRemainReceive = 2;
inventTransferLine.insert();
//Update transfer order as shipped
//Generate ParmId
parmId = RunBaseMultiParm::getSysParmId();
//inventTransferMultiShip
inventTransferParmUpdate.ParmId = parmId;
inventTransferParmUpdate.insert();
inventTransferParmTable.initValue();
inventTransferParmTable.ParmId = parmId;
inventTransferParmTable.TransferId = inventTransferTable.TransferId;
inventTransferParmTable.PickUpdateQty = InventTransferPickUpdateQty::All;
inventTransferParmTable.EditLines = NoYes::Yes;
inventTransferParmTable.AutoReceiveQty = NoYes::No;
inventTransferParmTable.TransDate = systemDateGet();
inventTransferParmTable.UpdateType = InventTransferUpdateType::PickingList;
inventTransferParmTable.insert();
InventTransferMultiPick = new InventTransferMultiPick();
InventTransferMultiPick.runUpdate(inventTransferParmTable);
//Picking list registration
select localWMSPickingRoute
where localWMSPickingRoute.transRefId == inventTransferTable.TransferId;
list.addEnd(localWMSPickingRoute.PickingRouteID);
WMSPickingRoute::finishMulti(list.pack());//Note - this is not in a single tts, so some routes might be posted and others fail
wmsDeliverPickedItems::checkDeliverPickedItems(localWMSPickingRoute.PickingRouteID,list.pack());
//Update transfer order as shipped
//Generate ParmId
parmId = RunBaseMultiParm::getSysParmId();
//inventTransferMultiShip
inventTransferParmUpdate.ParmId = parmId;
inventTransferParmUpdate.insert();
inventTransferParmTable.clear();
inventTransferParmTable.initValue();
inventTransferParmTable.ParmId = parmId;
inventTransferParmTable.TransferId = inventTransferTable.TransferId;
inventTransferParmTable.ShipUpdateQty = InventTransferShipUpdateQty::All;
inventTransferParmTable.EditLines = NoYes::Yes;
inventTransferParmTable.AutoReceiveQty = NoYes::No;
inventTransferParmTable.TransDate = systemDateGet();
inventTransferParmTable.UpdateType = InventTransferUpdateType::Shipment;
inventTransferParmTable.insert();
inventTransferMultiShip = new inventTransferMultiShip();
inventTransferMultiShip.runUpdate(inventTransferParmTable);
//Update transfer order as received
//Generate ParmId
parmId = RunBaseMultiParm::getSysParmId();
inventTransferParmUpdate.ParmId = parmId;
inventTransferParmUpdate.insert();
inventTransferParmTable.clear();
inventTransferParmTable.initValue();
inventTransferParmTable.ParmId = parmId;
inventTransferParmTable.TransferId = inventTransferTable.TransferId;
inventTransferParmTable.ReceiveUpdateQty = InventTransferReceiveUpdateQty::All;
inventTransferParmTable.EditLines = NoYes::Yes;
inventTransferParmTable.AutoReceiveQty = NoYes::No;
inventTransferParmTable.TransDate = systemDateGet();
inventTransferParmTable.UpdateType = InventTransferUpdateType::Receive;
inventTransferParmTable.insert();
inventTransferMultiReceive = new inventTransferMultiReceive();
inventTransferMultiReceive.runUpdate(inventTransferParmTable);
Wednesday, October 28, 2015
Thursday, November 22, 2012
How to clear user cache in AX 2012
Wednesday, August 22, 2012
Tuesday, July 24, 2012
Courtesy of David
//DGU - Released Picked transaction
while select inventTransOrigin
where
InventTransOrigin.InventTransId == this.InventTransId &&
InventTransOrigin.ItemId == this.ItemId &&
inventTransOrigin.ReferenceCategory == InventTransType::ProdLine &&
inventTransOrigin.ReferenceId == this.ProdId
{
while select forUpdate inventTrans
where
inventTrans.InventTransOrigin == inventTransOrigin.RecId &&
inventTrans.inventDimId == this.InventDimId &&
inventTrans.StatusIssue == StatusIssue::Picked &&
inventTrans.VoucherPhysical == "" &&
inventTrans.Voucher == ""
{
inventMovementPicked = inventTrans.inventMovement();
inventDimPicked = inventMovementPicked.inventdim();
inventDimParmPicked.initFromInventDim(inventDimPicked);
inventUpd_Picked = InventUpd_Picked::newParameters(inventMovementPicked,inventDimPicked,inventDimParmPicked,
inventDimPicked,inventDimParmPicked,inventTrans.Qty * -1);
inventUpd_Picked.updateNow();
}
}
//End
Sunday, July 22, 2012
Microsoft SQL Server 2008 Setup: The following error has occurred: A network error occurred while attempting to read from the file: [install-device-name--and-root-of-path-here]\x64\setup\x64\sqlncli[1].msiSolution :
Uninstall SQL Native Client
Tuesday, July 10, 2012
Useful Classes for Modifications
1. To modify ListPages, look for its Interaction classes. i.e : for PurchReqTableListPage, look for PurchReqTableListPageInteraction class.
2. To change whether an Inventory Dimension required to be mandatory or not, look for InventDimCtrl_Frm class. i.e : for ForecastSales class, look for InventDimCtrl_Frm_Forecast.
Monday, July 9, 2012
How to find On Hand Qty in AX 2012
display Real itemOnHand(){
ItemId itemId;
InventDimParm inventDimParm;
InventSumDatePhysicalDim inventSumDatePhysicalDim;
;
inventDimParm.initFromInventDim(this.inventDim());
return inventSumDatePhysicalDim::onHandQty(today(),this.ItemId,this.inventDim(),inventDimParm);}
Thursday, July 5, 2012
How to enable Remote Errors in AX 2012 SSRS
Open SQL Server Management Studio and run this query in the Reporting Service Database. You have to restart your SSRS instance service before it's going to take effect.
UPDATE ConfigurationInfo
SET Value = 'TRUE'
WHERE Name = 'EnableRemoteErrors'
Wednesday, February 22, 2012
How to access an Access MDB Database from Microsoft Dynamics AX 2009
static void ConnectToAccess(Args _args)
{
//Declare connection object CCADOConnection cn = new CCADOConnection();
CCADOCommand command = new CCADOCommand();
CCADORecordset rs = new CCADORecordset();
str Name;
;//open connection and execute SQL command
cn.open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Sample.mdb;Persist Security Info=False");
command.activeConnection(cn);
command.commandText("SELECT * FROM DEPARTMENTS");
rs = command.execute();
while (!rs.EOF())
{
info(Strfmt("%1",rs.fields().itemIdx(1).value())); //will display query value
rs.recordSet().moveNext();
}
cn.close();
}
Monday, February 13, 2012
Authorization Checks Code
Microsoft Dynamics AX 2009 performs automatic authorization when a user
accesses data through data sources on forms or reports. X++ code can also call
these checks in cases where automatic authorization does not occur.
if (hasSecurityKeyAccess(securitykeyNum(mySecurityKey),
AccessType::View))
{
//code requiring authorization goes here...
}
if (hasMenuItemAccess(menuItemDisplayStr(myMenuItem),
MenuItemType::Display)))
{
//code requiring authorization goes here...
}
DictTable dictTable = new DictTable(tablenum(myTable));
if (dictTable.rights >= AccessType::Insert))
{
//code requiring authorization goes here...
}
if
(isConfigurationkeyEnabled(configurationkeyNum(myConfigKey)
)
{
//code requiring authorization goes here...
}
Wednesday, February 1, 2012
Troubleshooting in the Development Workspace
To use the -development switch to start in the Development Workspace, you must have a
valid developer license code installed (X++ Source Code or MorphX Development Suite).
The Command menu is not available
The Command menu is only available if an Application Object Tree (AOT) window is open.
Press CTRL+D to open the AOT.
The Workspace menu items are not available
You must have a developer license code (X++ Source Code or MorphX Development Suite) to
open a Development Workspace.
The Application Workspace icon is not available
You must have a developer license code (X++ Source Code or MorphX Development Suite) to
open a Development Workspace.
Pressing CTRL+W does not open an Application Workspace.
No more than a total of eight workspaces can be opened in the same client session.
The Workspace toolbar is not available
To enable or disable the workspace toolbar, on the Tools menu, click Customize, and then
select or clear Workspace.
Troubleshooting in the Application Workspace
The Development Workspace icon is not available
There is no toolbar for workspace icons in the Application Workspace. To open a
Development Workspace from the Application Workspace, press CTRL+SHIFT+W.
The Workspace menu items are not available
You must have a developer license code (X++ Source Code or MorphX Development Suite) to
open a Development Workspace. Pressing CTRL+SHIFT+W does not open a Development
Workspace.
No more than eight workspaces can be opened in the same client session.
To open a Development Workspace using X++
You can also open a Development Workspace directly from X++ code. For example, you can
add a customized button in the client Application Workspace to open a Development
Workspace. The following X++ code can be used to open a Development Workspace.
static void OpenDevWorkspace(Args _args)
{
int hWorkspace;
;
hWorkspace = infolog.createDevelopmentWorkspaceWindow();
}
Friday, January 13, 2012
Monday, January 9, 2012
What is Prompt Fields in Dynamics AX Reports
Wednesday, January 4, 2012
Unable to create ActiveX Control error
and when we open AX this error(Unable to create ActiveX Control. cmx phone Control) occurs.
Solution: To remove this error just copy smmphone.ocx from other system where AX 4.0 is still installed and put this on same path as-Installed Drive\Program Files\Microsoft Dynamics AX\40\Client
Wednesday, December 14, 2011
Sometimes AX doesn't work as expected even if changes has been made to a code. Here are some suggestions
Compile
Compile and recompile.
License
While coding in a class, make sure that you have a x++ license, otherwise every changes made to a class will not be used.
Close the debugger
Sometimes, when the debugger is active, AX will keep executing ‘old’ code. Close the debugger to make sure the latest code is executing.
Synchronize data dictionary
Open the specific tables and synchronize or if everything else fails, just synchronize the whole AOT.
Restart AX
Simple as that, close the AX client and start it again.
Reset usage data
Go to options screen (AX button > Extra > Options) and click the Usage Data button. Click reset to remove this data.
Check the application event log for clues
Open the event viewer on the AOS to see if the AOS service has logged something in it. Messages here can help you a great deal. You can also check the event log on the database server or your client pc.
Delete AUC file
The application Unicode object cache file, if there is one, is located at C:\Documents and Settings\[USERNAME]\Local Settings\Application Data for xp, or C:\Users\USERNAME\AppData\Local for vista. Delete this file while the AX client is closed.
Full compile
Restart AOS
Remove .aoi file
Thursday, December 8, 2011
New Line in Report
Monday, December 5, 2011
Terbilang Function in Dynamics Ax in Indonesian
static TempStr numeralsToTxt_Indo(Real _num){
int numOfPennies = frac(_num)*100 mod 100;
int test = round(_num,0);
int numOfTenths;
str 20 ones[19], tenths[9], hundreds, thousands, millions, billions;
int temp;
str 200 returntxt;
int checkPower(int _test, int _power)
{
int numOfPower;
if (_test >= _power)
{
numOfPower = _test DIV _power;
if (numOfPower >= 100)
{
temp = numOfPower DIV 100;
returntxt = returntxt + ' ' + ones[temp] + ' ' + hundreds;
numOfPower = numOfPower MOD 100;
}
if (numOfPower >= 20)
{
temp = numOfPower DIV 10;
returntxt = returntxt + ' ' + tenths[temp];
numOfPower = numOfPower MOD 10;
}
if (numOfPower >= 1)
{
returntxt = returntxt + ' ' + ones[numOfPower];
numOfPower = numOfPower MOD 10;
}
switch(_power)
{
case 1000000000 :
{
returntxt = returntxt + ' ' + billions;
_test = _test MOD 1000000000;
break;
}
case 1000000 :
{
returntxt = returntxt + ' ' + millions;
_test = _test MOD 1000000;
break;
}
case 1000 :
{
returntxt = returntxt + ' ' + thousands;
_test = _test MOD 1000;
break;
}
case 100 :
{
returntxt = returntxt + ' ' + hundreds;
_test = _test MOD 100;
break;
}
}
}
return _test;
}
ones[1] = "Satu";
ones[2] = "Dua";
ones[3] = "Tiga";
ones[4] = "Empat";
ones[5] = "Lima";
ones[6] = "Enam";
ones[7] = "Tujuh";
ones[8] = "Delapan";
ones[9] = "Sembilan";
ones[10] = "Sepuluh";
ones[11] = "Sebelas";
ones[12] = "Dua Belas";
ones[13] = "Tiga Belas";
ones[14] = "Empat Belas";
ones[15] = "Lima Belas";
ones[16] = "Enam Belas";
ones[17] = "Tujuh Belas";
ones[18] = "Delapan Belas";
ones[19] = "Sembilan Belas";
tenths[1] = 'Not used';
tenths[2] = "Dua Puluh";
tenths[3] = "Tiga Puluh";
tenths[4] = "Empat Puluh";
tenths[5] = "Lima Puluh";
tenths[6] = "Enam Puluh";
tenths[7] = "Tujuh Puluh";
tenths[8] = "Delapan Puluh";
tenths[9] = "Sembilan Puluh";
hundreds = "Ratus";
thousands = "Ribu";
millions = "Juta";
billions = "Miliar";
test = checkPower(test, 1000000000);
test = checkPower(test, 1000000);
test = checkPower(test, 1000);
test = checkPower(test, 100);
if (test >= 20)
{
numOfTenths = test DIV 10;
returntxt = returntxt + ' ' + tenths[numofTenths];
numOfTenths = numOfTenths MOD 10;
test = test MOD 10;
}
if (test >= 1)
{
numOfTenths = test;
returntxt = returntxt + ' ' + ones[numOfTenths];
}
if (numOfPennies)
{
//returntxt = '***' + returntxt + ' ' + "@SYS5534" + ' ' + num2str(numOfPennies,0,0,0,0) + '/100';
//returntxt = returntxt + ' ' + num2str(numOfPennies,0,0,0,0) + '/100';
returntxt = returntxt + numeralstotxt_indo(numofpennies) + ' Sen';
}
if (strscan(strltrim(returntxt),"Satu Ribu",1,15)==1)
{
returntxt = strReplace(returntxt, "Satu Ribu", "Seribu");
}
returntxt = strReplace(returntxt, "Juta Satu Ribu", "Juta Seribu");
returntxt = strReplace(returntxt, "Satu Ratus", "Seratus");
return returntxt;
}
Monday, November 21, 2011
Executing application from Dynamics AX
WINAPI::shellExecute("iexplore.exe","yahoo.com");System does not support setup 'continuous' of number sequence Error
System does not support setup 'continuous' of number sequence error :
