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)

how to add available physical field in backorder line form in ax 2012

(0) ShareShare
ReportReport
Posted on by

Hello guys,

In Inventory management module a form named On hand. in this form  have field named Available Physical , below screenshot related to this.  

6305.123.jpg

I want to add above mentioned Available physical Field in BackOrderLine form which is available in sales and marketing module.

In On hand form available physical field  is displaying through  method , in InventOnhandItem  form. in this form have a datasource named inventsum.

for  adding  this field in Backorderline form, I am using availPhysical method which is use in inventsum .butI am facing below error . Please  anyone suggest me the exact step to achieve this.

0361.222.jpg

Thanks.

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at

    Hi PraveenAx,

    Could you please share your code ? It's hard to say what's wrong without seeing it.

    I can assume that you add new data source to the form but have no idea how did you use it.

    Actually there is another approach for your requirements you can use display method to show available physical.

    Please refer to this blog post community.dynamics.com/.../ax2012-x-code-to-get-on-hand-on-an-item to see how you can get it using InventOnHand  class.

  • Community Member Profile Picture
    on at

    Hi ievgen Miroshnikov,

    Thanks for Reply.

    As per your given link I am written the code in job , so by this code Available Physical field value is looking fine.

    But when i am using this code as a display method in Inventsum table and use this method as a field in backorderLine form , Available Physical field value is incorrect.  

    I am using below display method. please suggest where i am wrong.

    display public InventQtyAvailPhysical  availPhysicalCalculated()

    {

       InventOnhand          inventOnhand;

       InventDim                inventDim  ;

       InventDimParm        inventDimParm ;

       ItemId                      itemId ;

       InventQty                 availQty;

       itemId = this.ItemId;

       inventDim.InventSiteId     =  this.inventSiteId();

       inventDim.InventLocationId = this.inventLocationId();

        inventDimParm.initFromInventDim(inventDim);

        inventOnhand = InventOnhand::newParameters(itemId,inventDim,inventDimParm);

        availQty = inventOnhand.availPhysical();

        return availQty;

    }

    Thanks.

  • Mea_ Profile Picture
    60,284 on at

    Hi PraveenAx,

    If you want to go with display method you don't need inventSum DS at all, just put new method on SalesLine DS.

  • Community Member Profile Picture
    on at

    Hi ievgen Miroshnikov,

    When I put new method on SalesLine DS , No value is showing in form .

    is this my display method is correct or not ?  

    Please Suggest exact solution to resolve  this .

    Thanks again.

  • Mea_ Profile Picture
    60,284 on at

    Can you please post your code here  ? So we can check what is wrong.

  • Community Member Profile Picture
    on at

    Hi Praveen,

    I would place the display method on the SalesLine table something like this.

    public display InventQty displayAvailPhysical()

    {

       InventOnhand   inventOnhand;

       InventDimParm  inventDimParm;

       ;

       inventDimParm.initFromInventDim(InventDim::find(this.InventDimId));

       inventOnhand = InventOnhand::newParameters(this.ItemId, this.inventDim(), inventDimParm);

       return inventOnHand.availPhysical();

    }

    then drag the method onto your grid and remember to set the DataSource on the field in the design.

  • Community Member Profile Picture
    on at

    Hi ievgen Miroshnikov,

    When I write below code In job and  run it , output is looking perfect in infolog .

    static void FindOpenSalesLineAvailPhys(Args _args)

    {

       SalesLine salesline;

       InventDim inventDim;

       InventDimParm inventDimParm;

       InventOnHand inventOnHand;

       InventSum  InventSum;

       ;

       while select InventSum

       {

           inventDim = InventSum.inventDim();

           inventDimParm.initFromInventDim(inventDim);

           inventDimParm.WMSLocationIdFlag = NoYes::No;

           inventOnHand = InventOnHand::newItemDim(InventSum.ItemId, inventDim,

           inventDimParm);

          if (inventOnHand.availPhysical())

           {

               info(strfmt("Item Id %1 Site id %2 Location Id %3  Available Physical %4 ",

                   InventSum.ItemId, inventDim.InventSiteId,inventDim.InventLocationId,

                 inventOnHand.availPhysical()));    

           }

       }

    }

    But when I write above code as display method in salesLine  DS. then output is wrong.

    Below is my display method , Please check and suggest.

    display public InventQtyAvailPhysical availPhysicalCalculated55()

    {

       SalesLine salesline;

       InventDim inventDim;

       InventDimParm inventDimParm;

       InventOnHand inventOnHand;

       InventSum  InventSum;

      anytype    store;

       ;

       while select InventSum

       {

           inventDim = InventSum.inventDim();

           inventDimParm.initFromInventDim(inventDim);

           inventDimParm.WMSLocationIdFlag = NoYes::No;

           inventOnHand = InventOnHand::newItemDim(InventSum.ItemId, inventDim,

           inventDimParm);

          if (inventOnHand.availPhysical())

           {

              store=  inventOnHand.availPhysical();    

           }

       }

       return store;

    }

    Thanks.

  • Mea_ Profile Picture
    60,284 on at

    Hi PraveenAx,

    Your method does not make sense for me, you just iterate through all onhand records in the system. Please follow Soren Normann Rasmussen advice, his method looks good, so you can create it on SalesLine table and drop to a grid as he proposed.

  • Naveen Mishra Profile Picture
    4 on at

    Hi ievgen Miroshnikov,

    I have already tested  method in SalesLine table and drop to a grid  as suggested by Soren Normann Rasmussen .

    But that method not showing any record , Field is Totally blank.

  • Mea_ Profile Picture
    60,284 on at

    Did you try to debug ? If something is not working that's the only way to find a reason.

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