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)

Show Intercompany sales order value using X++

(0) ShareShare
ReportReport
Posted on by 1,260

Hi,

I want to display a qty value which is in transit using the following conditions.

sum of PurchLine.PurchQty, where PurchTable.StoreId == thisPurchTable.StoreId, PurchTable.FulfillmentStatus == ‘Placed’, PurchTable.PurchStatus = ‘open order’, PurchLine.ItemId == thisPurchLine.ItemId and PurchTable.dataAreaId == thisdataAreaId, SalesTable.DocumentStatus = (‘packing slip’ or ‘invoice’ enums), where PurchTable/PurchLine record joins via intercompany

Here, my code works fine till it is linked within the Purchline and PurchTable, but as soon as I link to salestable I get output as 0


I am using following code to display the quantity in transit:

display InventQty LSH_InTransit()
{
    PurchTable              purchTableLoc;
    PurchLine               purchLineLoc;
    PurchQty purchQty;
    SalesTable salesTable;
    SalesLine salesLine;
    SalesStatus salesStatus;
    LSH_InterCompanyStatus intercompanyStatus;
    InventTrans inventTrans;
   
    InventQty               ret = 0;
    {

   while select sum(PurchQty) from purchLineLoc
        where 
        purchLineLoc.PurchStatus == PurchStatus::Backorder &&
        purchLineLoc.ItemId == this.ItemId &&
        purchLineLoc.dataAreaId == this.dataAreaId
        join purchTableLoc
        where purchTableLoc.purchid == purchLineLoc.PurchId
        && purchTableLoc.FulfillmentStatus == LSHFulfillmentStatus::Placed
       && purchTableLoc.PurchStatus == PurchStatus::Backorder
       && purchTableLoc.DocumentStatus == DocumentStatus::PurchaseOrder
       
        join salesTable
               where
salestable.intercompanypurchid == purchtableloc.purchid && salesTable.DocumentStatus == DocumentStatus::PackingSlip || salesTable.DocumentStatus == DocumentStatus::Invoice ret = purchLineLoc.PurchQty; } return ret; }


Can someone let me know if I joined the salestable incorrect. It is an intercompany salestable that I am joining with and the condition on the salesid is Documentstatus on the intercompany salestable is either packing slip or invoice and salestable.intercompanypurchid is equal to purchtable.purchid

*This post is locked for comments

I have the same question (0)

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans