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

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Displaying the records from the SO by using SO temp table

(0) ShareShare
ReportReport
Posted on by

Hello,


One issue i got where i have to first find the doc no from sales line then i have to assign it to the temp table and from temp table i have to check that sales order no is there in Sales header table and if there then i have to display the records, following is my code but the cursor is not going to the line shipped oty condition: please suggest how to solve this as not getting the value in temp table field:

IF recCustomer.GET(pCustomerNo) THEN

BEGIN

       lrecSalesLine.RESET;

       lrecSalesLine.SETRANGE("Document Type",lrecSalesLine."Document Type"::Order);

       lrecSalesLine.SETRANGE("Sell-to Customer No.",pCustomerNo);

       lrecSalesLine.SETRANGE("Part/Unit",pItemTypeFilter);

       IF lrecSalesLine.FINDSET THEN

       BEGIN

         //REPEAT

             IF (lrecSalesLine."Quantity Shipped" < lrecSalesLine.Quantity) THEN        ///Cursor is not coming here

             BEGIN

                recSalesTemp."No.":=lrecSalesLine."Document No.";

                recSalesTemp.INSERT;

             END;

        // UNTIL lrecSalesLine.NEXT=0;

       END;

END;

lrecSalesHeader.RESET;

//lrecSalesHeader.COPYFILTERS(lrecSalesLine);

lrecSalesHeader.VALIDATE("No.",recSalesTemp."No.");       //directly cursor comes here after sales line filteration

IF lrecSalesHeader.FINDSET THEN

   ExpCallOffExistingOrder.SETTABLEVIEW(lrecSalesHeader);

   //MESSAGE('%1',recSalesTemp."No.");

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Amol Salvi Profile Picture
    18,698 on at
    RE: Displaying the records from the SO by using SO temp table

    Check the Sales Line Table for this condition is there any document

    IF (lrecSalesLine."Quantity Shipped" < lrecSalesLine.Quantity)

    Use Debugger and check values

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Displaying the records from the SO by using SO temp table

    Hi,

    my first tough is that the FINDSET don't return any value, try without the IF and use some MESAGE(lrecSalesLine.WHATEVERYOUWANT); in the Repeat loop.

  • Andrea Antoniazzi Profile Picture
    285 on at
    RE: Displaying the records from the SO by using SO temp table

    Hi,

    try this code:

    IF recCustomer.GET(pCustomerNo) THEN

    BEGIN

     lrecSalesLine.RESET;

     lrecSalesLine.SETRANGE("Document Type",lrecSalesLine."Document Type"::Order);

     lrecSalesLine.SETRANGE("Sell-to Customer No.",pCustomerNo);

     lrecSalesLine.SETRANGE("Part/Unit",pItemTypeFilter);

     lrecSalesLine.SETFILTER("Outstanding Quantity",'>%1',0);

     IF lrecSalesLine.FINDSET THEN

     BEGIN

       REPEAT

         IF NOT recSalesTemp.GET(lrecSalesLine."Document Type", lrecSalesLine."Document No.") THEN

         BEGIN

           recSalesTemp.INIT;

           recSalesTemp."Document Type":=lrecSalesLine."Document Type";

           recSalesTemp."No.":=lrecSalesLine."Document No.";

           recSalesTemp.INSERT;

         END;

       UNTIL lrecSalesLine.NEXT=0;

     END;

    END;

    recSalesTemp.RESET;

    IF recSalesTemp.FINDSET THEN

    BEGIN

     REPEAT

       IF lrecSalesHeader.GET(lrecSalesLine."Document Type", lrecSalesLine."Document No.") THEN

       BEGIN

  • Suggested answer
    Ashwini Tripathi Profile Picture
    4,624 on at
    RE: Displaying the records from the SO by using SO temp table

    You need to verify first below code is perfectly working:

    lrecSalesLine.RESET;

    lrecSalesLine.SETRANGE("Document Type",lrecSalesLine."Document Type"::Order);

    lrecSalesLine.SETRANGE("Sell-to Customer No.",pCustomerNo);

    lrecSalesLine.SETRANGE("Part/Unit",pItemTypeFilter);

    IF lrecSalesLine.FINDSET THEN

    Check the value of pItemTypeFilter and verify if that value is present in data.

    Verify your data is having valid value for this condition:

    IF (lrecSalesLine."Quantity Shipped" < lrecSalesLine.Quantity) THEN        

  • Suggested answer
    Rabin Profile Picture
    2,976 on at
    RE: Displaying the records from the SO by using SO temp table

    Hi

    Try using Debugger or Message out the Record and also check if the value exists in the company where you are testing your code...

    ----------------------

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Saurav.Dhyani Profile Picture

Saurav.Dhyani 2 Super User 2025 Season 2

#2
RK-25090803-0 Profile Picture

RK-25090803-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans