Skip to main content

Notifications

Announcements

No record found.

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 Microsoft Employee

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

  • Suggested answer
    Rabin Profile Picture
    Rabin 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...

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

  • Suggested answer
    Ashwini Tripathi Profile Picture
    Ashwini Tripathi 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        

  • Andrea Antoniazzi Profile Picture
    Andrea Antoniazzi 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
    Community Member Profile Picture
    Community Member Microsoft Employee 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.

  • Suggested answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 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

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,387 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans