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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Copy Blanket Sales order gives error

(0) ShareShare
ReportReport
Posted on by 400

We want to copy an existing Blanket Sales Order gives error

We have an existing Blanket Sales Order, SB20003.

Then we want to copy (the lines) in a new Blanket Sales Order, SB200004

We have created the new Blanket Sales Order header. Then we use the copy document action. (Action -> Functions -> Copy Document)

pastedimage1585727864873v1.png

When we click on OK, we receive the following error.

pastedimage1585727896733v2.png

We noticed that in the functions copy document a wrong filter has been set. The filter Order is set in stead of Blanket Sales Order.

This needs to be fixed in standard Business Central.

I have the same question (0)
  • Community Member Profile Picture
    on at

    To resolve this problem, follow these steps:

    Change the code in Properties in the Sales-Quote to Order Codeunit (86) as follows:

    Existing code 1

    ...

    Opp@1004 : Record 5092;

                 OpportunityEntry@1006 : Record 5093;

                 TempOpportunityEntry@1005 : TEMPORARY Record 5093;

                 Cust@1008 : Record 18;

               BEGIN

                 TESTFIELD("Document Type","Document Type"::Quote);

                 Cust.GET("Sell-to Customer No.");

                 Cust.CheckBlockedCustOnDocs(Cust,"Document Type"::Order,TRUE,FALSE);

    ...

    Replacement code 2

    ...

    Opp@1004 : Record 5092;

                 OpportunityEntry@1006 : Record 5093;

                 TempOpportunityEntry@1005 : TEMPORARY Record 5093;

                 Cust@1008 : Record 18;

    // Add the following line.          

    Item@1010 : Record 27;

    // End of the added line.

               BEGIN

                 TESTFIELD("Document Type","Document Type"::Quote);

                 Cust.GET("Sell-to Customer No.");

                 Cust.CheckBlockedCustOnDocs(Cust,"Document Type"::Order,TRUE,FALSE);

    ...

    Existing code 2

    ...

    SalesQuoteLine.SETRANGE(Type,SalesQuoteLine.Type::Item);

                 SalesQuoteLine.SETFILTER("No.",'<>%1','');

                 IF SalesQuoteLine.FINDSET THEN

                   REPEAT

                     IF (SalesQuoteLine."Outstanding Quantity" > 0) THEN BEGIN

                       SalesLine := SalesQuoteLine;

                       SalesLine.VALIDATE("Reserved Qty. (Base)",0);

                       SalesLine."Line No." := 0;

    ...

    Replacement code 2

    ...

    SalesQuoteLine.SETRANGE(Type,SalesQuoteLine.Type::Item);

                 SalesQuoteLine.SETFILTER("No.",'<>%1','');

                 IF SalesQuoteLine.FINDSET THEN

                   REPEAT

                    IF Item.GET(SalesQuoteLine."No.") THEN         //add line

    // Add the following line.              

    Item.TESTFIELD(Blocked,FALSE);  

    // End of the added line.

                     IF (SalesQuoteLine."Outstanding Quantity" > 0) THEN BEGIN

                       SalesLine := SalesQuoteLine;

                       SalesLine.VALIDATE("Reserved Qty. (Base)",0);

                       SalesLine."Line No." := 0;

    ...

    Change the code in Properties in the Blanket Sales Order to Order Codeunit (87) as follows:

    Existing code 1

    ...

    Cust@1001 : Record 18;

                 TempSalesLine@1002 : TEMPORARY Record 37;

                 Reservation@1005 : Form 498;

                 PrepmtMgt@1004 : Codeunit 441;

               BEGIN

                 TESTFIELD("Document Type","Document Type"::"Blanket Order");

                 Cust.GET("Sell-to Customer No.");

                 Cust.CheckBlockedCustOnDocs(Cust,"Document Type"::Order,TRUE,FALSE);

    ...

    Replacement code 1

    ...

    Cust@1001 : Record 18;

                 TempSalesLine@1002 : TEMPORARY Record 37;

                 Reservation@1005 : Form 498;

                 PrepmtMgt@1004 : Codeunit 441;

    // Add the following line.

                 Item@1006 : Record 27;                  

    // End of the added line.

               BEGIN

                 TESTFIELD("Document Type","Document Type"::"Blanket Order");

                 Cust.GET("Sell-to Customer No.");

                 Cust.CheckBlockedCustOnDocs(Cust,"Document Type"::Order,TRUE,FALSE);

    ...

    Existing code 2

    ...

    SalesLine.SETRANGE("Blanket Order Line No.",BlanketOrderSalesLine."Line No.");

                     QuantityOnOrders := 0;

                     IF SalesLine.FINDSET THEN

                       REPEAT

                         IF SalesLine."Document Type" IN

                             [SalesLine."Document Type"::"Return Order",

                              SalesLine."Document Type"::"Credit Memo"]

                         THEN

    ...

    Replacement code 2

    ...

    SalesLine.SETRANGE("Blanket Order Line No.",BlanketOrderSalesLine."Line No.");

                     QuantityOnOrders := 0;

                     IF SalesLine.FINDSET THEN

                       REPEAT

    // Add the following lines.

                         IF Item.GET(SalesLine."No.") THEN                    

                           Item.TESTFIELD(Blocked,FALSE);

    // End of the added lines.                  

                         IF SalesLine."Document Type" IN

                             [SalesLine."Document Type"::"Return Order",

                              SalesLine."Document Type"::"Credit Memo"]

                         THEN

    ...

    Existing code 3

    ...

    TempSalesLine.DELETEALL;

                   REPEAT

                     SalesLine.SETCURRENTKEY("Document Type","Blanket Order No.","Blanket Order Line No.");

                     SalesLine.SETRANGE("Blanket Order No.",BlanketOrderSalesLine."Document No.");

                     SalesLine.SETRANGE("Blanket Order Line No.",BlanketOrderSalesLine."Line No.");

    // Delete the following lines.

                     SalesLine.SETFILTER(                      

                       "Document Type",'<>%1 & <>%2',SalesLine."Document Type"::Invoice,SalesLine."Document Type"::"Credit Memo");

    // End of the deleted lines.

                     QuantityOnOrders := 0;

                     IF SalesLine.FINDSET THEN

                       REPEAT

                         IF Item.GET(SalesLine."No.") THEN

                           Item.TESTFIELD(Blocked,FALSE);

  • Suggested answer
    TSAmulraj Profile Picture
    55 on at

    Hi,

    I'm using standard BC 15.4 US version.

    Version: US Business Central 15.4 (Platform 15.0.40939.41751 + Application 15.4.41023.41345)

    BC works fine for Blanket order also. Better try with include header boolean.

    Hope the source blanket order is released.

    Regards,

    Amulraj Sundaramoorthy

    Don't forget to help the community by verifying the answer

  • Suggested answer
    jerome77 Profile Picture
    on at

    Hi

    I can see this is second issue around blanket sales order posted here. I did the test as well, copying:

    -  a previous quote

    - a previous order

    Both works fine with online BC version 15.4

    Are you using standard BC? Is it online or onprem? Any extension used here?

  • Suggested answer
    TSAmulraj Profile Picture
    55 on at

    Hi Eelco,

    Kindly check whether the customer name, Location code is same for the both the document.

    In default BC, This functionality works fine.

    May i know the type of line type, item or G/L account?

    Regards,

    TSAmulraj.

    Don't forget to help the community by verifying the answer

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

Season of Giving Solutions is Here!

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,572

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 789 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 693 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans