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

03 June 2011

Update planned order upon modified salesline

by Patrik Luca 1 comments

Tag



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()
}
}

Comments 1 comments
Anonymous said...

Good Job Patrick, thanks ! :)

Except the first parameter of the void "ReqPlanSched::defaultDynamicsId()".

It doesn't work ; so I replaced it by : "ReqPlanVersion::findActiveReqPlanIdDynamic().RecId"

++

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

Subscribe feeds rss Recent 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