My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

09 August 2011

Intercompany with direct delivery and WMS setup

Problem description: Intercompany orders with direct delivery cannot be created because of the WMS setup

Creation of a direct delivery purchase order for an intercompany vendor may fail with following error message: Intercompany orders with direct delivery cannot be created because of the WMS setup on dimension group for item ….

This error occurs because the item being traded has one (or both) storage dimensions Location or Pallet ID active on its Dimension group and Blank receipt allowed and Blank issue allowed aren’t checked.

Solutions

You can easily solve this problem by allowing blank receipt and issue on the items Dimension group.

However, in some cases this isn’t possible, for example, you cannot allow blank receipt/issue on a storage dimension which is part of the financial inventory.

If it is a storage dimension with only Location active, then you can tweak the code a bit like this in the class PurchCreateFromSalesOrder, method run:



...
if (salesTableLocal.InterCompanyDirectDelivery
&& SalesTableType::construct(
salesTableLocal).canCreatePurchOrder()
&& VendTable::find(
tmpPurchLinePrice.AccountNum).interCompanyAccountExist())
{
select firstonly RecId from inventTable
where inventTable.ItemId == salesLineLocal.ItemId
join inventDimGroup
where inventDimGroup.DimGroupId ==
inventTable.DimGroupId
join inventDimSetup
where inventDimSetup.DimGroupId ==
inventDimGroup.DimGroupId
// no check for location: if the warehouse has a
// default issue and receipt location or the
// items have a default issue and receipt
// location, then check isn't needed
//&& (inventDimSetup.DimFieldId ==
// fieldNumWMSLocationId
// || inventDimSetup.DimFieldId ==
// fieldNumWMSPalletId)
&& (inventDimSetup.dimFieldId ==
fieldNumWMSPalletId)
&& inventDimSetup.Active == true
&& (inventDimSetup.AllowBlankIssue == false
|| inventDimSetup.AllowBlankReceipt == false);
if (inventTable.RecId)
{
throw error(strfmt("@SYS99182",
salesLineLocal.ItemId));
}
}
...

Just make sure that your setup for your warehouse always has a default receipt and issue location: as such it isn’t a problem that there is no check anymore on the location field, as it will be filled up always.





Or make sure each such item has a default receipt and issue location




Continue reading......

by Patrik Luca 3 comments

13 July 2011

X++ Code Snippet: create PurchTable

This X++ Code Snippet describes how to create a PurchTable.


PurchTable purchTable;
NumberSeq numberseq = NumberSeq::newGetNumFromCode(
PurchParameters::numRefPurchId().NumberSequence,
true);

purchTable.clear();

purchTable.PurchId = numberSeq.num();
purchTable.initValue();
purchTable.OrderAccount = "0001";
purchTable.initFromVendTable();
purchTable.insert();

numberSeq.used();


Continue reading......

by Patrik Luca 0 comments

08 July 2011

Extract date from a DateTime field

This post is a code snippet showing how to extract the date from a DateTime field

myDate = DateTimeUtil::date(ContactPerson.LastEditAxDateTime)


Continue reading......

by Patrik Luca 0 comments

10 June 2011

Set mail recipient and mail subject during posting

Business requirement: automatic setting of mail recipient and mail subject during posting

This post describes how to set the mail recipient and mail subject dynamically, but in an automatic way upon posting the packing slip for a purchase order. The printed packing slip is added as PDF to the created mail message. The solution is on an Axapta 3.0 installation, but probably the same can work for other Dynamics AX versions.

Solution

Create a new method in the class PurchFormLetter_PackingSlip.

void initPrintJobSettings()
{
PrintJobSettings printJobSettings;
;
printJobSettings =
new PrintJobSettings(printerSettingsFormletter);
// set the output format of the packing slip to PDF
printJobSettings.preferredMailFormat(PrintFormat::PDF);
// set the mail recipient (this could be parameterised,
// in the example it is hardcoded)
if (purchTable)
printJobSettings.mailTo(“foo@hotmail.com")
// set the mail subject if (purchTable)
printJobSettings.mailSubject(‘@SYS72882’
+ “ “ + purchTable.PurchId);
this.updatePrinterSettingsFormLetter(
printJobSettings.packPrintJobSettings());
}

Add a new method in the class PurchFormLetter.


void initPrintJobSettings()
{
}

Call the method in the main method of the class PurchFormLetter.


{
…
purchFormLetter.parmId(parmId);
purchFormLetter.transDate(systemDateGet());
purchFormLetter.initPrintJobSettings();
if (purchFormLetter.prompt())
{
…
}


Continue reading......

by Patrik Luca 3 comments

03 June 2011

Update planned order upon modified salesline

Business requirement: update planned order
upon modification of a salesline
without master scheduling

Sometimes you want to see changes made on a SalesLine immediately on the
reference Planned Order, without Master Scheduling. This post describes
how you can make a little code adaptation to achieve this. The changed planned
order belongs to the dynamic master plan, which seems most logic in
these cases.

Solution: X++ code to be added

Add following method to the class SalesLineType and call it in the update
method of the class SalesLineType.

void synchPO (SalesLine _salesLine) 
{
    ReqPO reqPO;
    ;

    reqPO = ReqPO::find(ReqPlanSched::defaultDynamicId(),
_salesLine.reqTrans().reqTransSettled(
salesLine.reqTrans().selectCov()).RefId
,true);

if (reqPO)
{
// whatever field in reqPO to be updated based on
// some information on the referenced SalesLine
reqPO.Qty = _salesLine.SalesQty;
if (reqPO.validateWrite()
reqPO.update()
}
}


Continue reading......

by Patrik Luca 1 comments

21 April 2011

Fill utility only works for primary datasource

Problem description: fill utility not working

Upon using the Fill utility in Dynamics AX 2009, you may notice it didn’t update your selected values. Nevertheless you didn’t receive an error or message. Probably the cause is the field you want to mass update is not part of the primary datasource of your form.

Solution: adapt SysRecordInfo form

As this behaviour may be very confusing for end users, you can adapt some code on Form SysRecordInfo. As such, the Fill Utility button won’t appear anymore, just as it doesn’t appear for display fields on a Form.

Add following code in method fillUtilityInit on Form SysRecordInfo:

… 
if (object.dataMethod())
{

    fillGrp.visible(false);
    return;
}


// BEGIN Fill utility only works for primary datasource
if (getDataSourceNo(object.dataSource()) != 1)

{
    fillGrp.visible(false);
    return;

}
// END Fill utility only works for primary datasource

dictTableLocal = new SysDictTable(tblId);
….


Continue reading......

by Patrik Luca 0 comments

10 March 2011

Remove HTML tags from string

Problem description: how to remove HTML tags from a string with X++ code

How to remove HTML tags from a string with X++ code.

Solution: Web::stripHTML

There is a nice X++ function: just call Web::stripHTML(string), which will return the string without the HTML tags.


Continue reading......

by Patrik Luca 0 comments

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Categories

Recommended Books


Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Blog Archive

My Blog List

Followers

Links