Delete SalesHeader Order and Blanket Order

gorgavelgorgavel Member Posts: 15
edited 2013-04-16 in NAV Three Tier
I have to modify the test to delete SalesHeader and I cant find the C/L Code.
I have used debugger in codeunit 80 but suddenly the records are deleted and I cant find the code for deletion.
Where is the code?
Rgds
Göran

Comments

  • gorgavelgorgavel Member Posts: 15
    My special case is that there is one Blanket Order that I wont to keep when the last created sales order is invoiced.
  • IsitarIsitar Member Posts: 29
    Hi
        DocDim.RESET;
        DocDim.SETRANGE("Table ID",DATABASE::"Sales Header");
        DocDim.SETRANGE("Document Type","Document Type");
        DocDim.SETRANGE("Document No.","No.");
        DocDim.DELETEALL;
        DocDim.SETRANGE("Table ID",DATABASE::"Sales Line");
        DocDim.DELETEALL;
    
        ApprovalMgt.DeleteApprovalEntry(DATABASE::"Sales Header","Document Type","No.");
    
        IF HASLINKS THEN DELETELINKS;
        DELETE;  // <---------------------------------------------
        ReserveSalesLine.DeleteInvoiceSpecFromHeader(SalesHeader);
        IF SalesLine.FINDFIRST THEN REPEAT
          IF SalesLine.HASLINKS THEN
            SalesLine.DELETELINKS;
        UNTIL SalesLine.NEXT = 0;
        SalesLine.DELETEALL;
        DeleteItemChargeAssgnt;
        SalesCommentLine.SETRANGE("Document Type","Document Type");
        SalesCommentLine.SETRANGE("No.","No.");
        IF NOT SalesCommentLine.ISEMPTY THEN
          SalesCommentLine.DELETEALL;
        WhseRqst.SETCURRENTKEY("Source Type","Source Subtype","Source No.");
        WhseRqst.SETRANGE("Source Type",DATABASE::"Sales Line");
    

    Are you looking for this? in Codeunit 80
    Greetings from Switzerland
Sign In or Register to comment.