Skip to main content

Notifications

Supply chain | Supply Chain Management, Commerce
Answered

On-hand quantity for SalesLine

(1) ShareShare
ReportReport
Posted on by 1,883
Hi Experts,
 
I am trying to get inventory sum on SalesTable Form by site , warehouse and inventory dimension.
 
I have created display method
 
[ExtensionOf(tableStr(SalesLine))]

final public class SFA_SalesLine_Extension
{
    [SysClientCacheDataMethod(true)]

    display Qty SFA_Physical()
    {
        InventDim            inventDim;
        InventDimParm       inventDimParm;

        inventDim.InventSiteId          =   this.salesTable().InventSiteId;
        inventDim.InventLocationId      =   this.salesTable().InventLocationId;
       inventDim.inventDimId            =  this.InventDimId;
       inventDim                        =   InventDim::findOrCreate(inventDim);
        inventDimParm.initFromInventDim(InventDim::find(inventDim.inventDimId));
       
        
        return InventSum::findSum(this.ItemId,inventDim,inventDimParm).AvailPhysical;
    
    }

}
But Inventory sum is not checking inventory dimension from SalesLine.
 
 
It is summing all quantities ignoring item dimension from SalesLine . Our Item/Product is Product Master type means it have Size, color, Style etc.
 
Please help me.
 
Thanks,
Faiz
  • faiz7049 Profile Picture
    faiz7049 1,883 on at
    On-hand quantity for SalesLine
    Hi Martin,
     
    Thank you so much.
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,370 Most Valuable Professional on at
    Display method on SalesLine
    I see that your code uses the default site and warehouse on sales order header and it ignores the actual site and warehouse used by the particular sales line. That's wrong. If you want all dimensions, get the InventDim buffer simply by this.inventDim(). If you want just some dimensions, copy values from there, not from SalesTable.

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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans