web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Display production order status responsible for transfer order

(0) ShareShare
ReportReport
Posted on by

Hi,

I have a display method in the reqtranspo form which displays the status of a production order for planned purchase orders, this works fine:

Display str ProdStatus(reqtrans _reqTrans)

{

   ReqTransCov _reqTransCov;

   ReqRefType  reqRefType;

 ;

   select firstonly _reqTransCov

       where _reqTransCov.ReqPlanId == _ReqTrans.ReqPlanId

       &&    _reqTransCov.ReceiptRecid == _ReqTrans.RecId;

   if (ReqTrans.reqTransSettled(_reqTransCov).RefType == ReqRefType::ProdLine)

   {

       return enum2str(ProdTable::find(ReqTrans.reqTransSettled(_reqTransCov).RefId).ProdStatus);

   }

   else

       return "";

}

I can't however seem to get this to work for transfer orders..

Anyone got a clue on how to hook those two up?

Thanks in advance,


Mike

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    I've made a mistake here, it works for transfer orders but doesn't work for purchase orders..

    Regards,

    Mike

  • Verified answer
    Community Member Profile Picture
    on at

    Solved (I think..)

    I have to do an upwards explosion first based on the reqtrans record that has scope. After that I can iterate the reqtrans records and check to see if it's a production line. Didn't test complex situations though..

    private void FindReqProdStatus()

    {

    ReqTransExplode reqTransExplode;

    Map mapReqTransLocal;

    MapEnumerator enumerator;

    container conMapReqTrans;

    Map mapReqTrans;

    reqTrans reqTrans;

    ReqPO reqPo;

    Map plannedOrderMap = new Map(Types::Int64, Types::Record);

    ;

    reqPo = ReqPO::find('Hoofdplan', '00001052_079');

    while (reqPo)

    {

    if (!plannedOrderMap.exists(reqPo.RecId) )

    {

    reqTransExplode = reqTransExplode::newReqTrans(reqPo.reqTrans(),ReqExplodeType::Up);

    reqTransExplode.run();

    conMapReqTrans = reqTransExplode.packMapReqTrans();

    mapReqTransLocal = (conMapReqTrans) ? Map::create(conMapReqTrans) : new Map(typeId2Type(typeid(recId)), Types::Record);

    mapReqTrans = new Map(typeId2Type(typeid(recId)), Types::Record);

    enumerator = mapReqTransLocal.getEnumerator();

    while(enumerator.moveNext())

    {

    reqTrans = reqTrans::findRecId(enumerator.currentKey());

    if (reqTrans.RefType == ReqRefType::ProdLine)

    {

    Info(enum2str(ProdTable::find(reqtrans.RefId).ProdStatus));

    }

    }

    }

    next reqPo;

    }

    }

    credits to Pawan's AX Blog for a AX 2012 solution (changed it to AX 2009)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans