Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Corrective Sales Invoice

(0) ShareShare
ReportReport
Posted on by

Hi, any have idea how I can make a Corrective Sales Invoice, for example if I have  Credit Memo posted in the Sales Credit Memo Header but i for X reason I need Canceled and create a Sales Invoice but corrective, in NAV exist the CorrectPostedSalesInvoice.CreateCreditMemoCopyDocument Function, what I need modify for create the Corrective Sales Invoice or exist another method for make this?

Thanks for the help :D

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: Corrective Sales Invoice

    Thanks for answer, yeah that are the steps I need to do, but I make try that steps in automatic, whit only push a button, I am no sure is the correct form or if exist another but I use the next code (if is correct, maybe helpful to another person ):

    //first check if the credit memo are a prepayment credit memo 
    
    IF SalesCrMHeader."Prepayment Credit Memo" = FALSE THEN BEGIN
    
    // ask to the user if will like create a corrective Sales Inovice for the CrMemo
    IF CONFIRM(CorrectiveNC) THEN BEGIN
    
    //this function going into the codeunit 1303 
    
    CorrectPostedSalesInvoice.CreateSalesInvoiceCopyDocument(SalesCrMHeader,SalesHeader);
    SalesHeader.Correction:=TRUE;
    SalesHeader.MODIFY(TRUE);
    MESSAGE('Se ha creado una Factura Correctiva'+ ': ' + SalesHeader."No.");
    //post the corrective Sales Invoice
    CODEUNIT.RUN(CODEUNIT::"Sales-Post",SalesHeader);
    END ELSE BEGIN
    MESSAGE(CorrectiveNCsFE);
    END;
    //Nota de Credito Correctiva
    END ELSE BEGIN 
    MESSAGE(FacturaAnticipo);
    END;

    In the codeunit 1303 create the  next functions: 

    CreateSalesInvoiceCopyDocument(VAR SalesCrMemoHeader : Record "Sales Cr.Memo Header";VAR SalesHeader : Record "Sales Header")
    CreateCopyDocumentCredit(SalesCrMemoHeader,SalesHeader,SalesHeader."Document Type"::Invoice);
    CreateCopyDocumentCredit(VAR SalesCrMemoHeader : Record "Sales Cr.Memo Header";VAR SalesHeader : Record "Sales Header";DocumentType : Option)
    
    CLEAR(SalesHeader);
    SalesHeader."No." := '';
    SalesHeader."Document Type" := DocumentType;
    SalesHeader.INSERT(TRUE);
    
    CASE DocumentType OF
    SalesHeader."Document Type"::"Credit Memo":
    CopyDocMgt.SetPropertiesForCreditMemoCorrection;
    SalesHeader."Document Type"::Invoice:
    CopyDocMgt.SetPropertiesForInvoiceCorrection;
    ELSE
    ERROR(WrongDocumentTypeForCopyDocumentErr);
    END;
    
    //this function point to the codeunit 6620
    
    CopyDocMgt.CopySalesDocForCrMemoCancelling(SalesCrMemoHeader."No.",SalesHeader);


    in the codeunit 6620 create the function

    CopySalesDocForCrMemoCancelling(FromDocNo : Code[20];VAR ToSalesHeader : Record "Sales Header")
    CopySalesDoc(SalesDocType::"Posted Credit Memo",FromDocNo,ToSalesHeader);


    I hope this help to anyone

  • Suggested answer
    Alexander Ermakov Profile Picture
    28,094 on at
    RE: Corrective Sales Invoice

    If you have the following situation:

    - you have posted Sales Invoice; then, you realized it is not correct

    - after that you have posted Credit Memo; then, you realized your Credit Memo is also incorrect and you need to reverse it :-)

    - you should then post again a Sales Invoice, copying the data from you incorrect Credit Memo, and apply that to your Credit Memo

    - then, post a correct Credit Memo by copying from initial Sales Invoice, and apply that to initial Sales Invoice

    - finally, post a correct Sales Invoice

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics NAV (Archived)

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans