Sales Credit Memo

Hi, I want to post a sales cr. memo from my own codeunit

of filtered sales invoice from (Cust. Ledger ENtry) which is already posted,

sales posting is done by (Sales-Post) codeunit

now problem is this i am unable to sort out how to set filter the line from,

can any one tell about this structure, i am new on NAV

THANKS in advance

Hi Ahmad,

Have you checked procedure like creating Sales Credit Memo by using Copy Document Funcionality.

And also check effected ledgers using Navigate.

Yes use copy document functionality and sales post if u want to post credit memo’s…

also check if u have any credit memos created for ur posted invoice or not… for this create a new field source document no in the credit memo header for comparing…

if there is document already created don’t create it… otherwise create the credit memo and post them…

at the time of creation of credit memo you need to post the source document number your posted invoice number also in to the new credit memo header that way you record which invoice is processed…

Anil.

Thanks for reply, still some confusion regarding to data, from which table i have to copy the data for credit memo??

here is my senario, i want the invoice between given date, balance <> 0 and invoice must be opened,

now this data is present in (cut. ledger entry) table, and copy document functionality accepts

CopyDocMgt.CopySalesDoc(DocType,DocNo,SalesHeader)

DocType := “Credit Memo”

DocNo := ??

SalesHeader := ??

hope you get my question…

AHMED

Welcome to DUG!!!

Do you mean to say you want to pass bulk credit memo using batch run ???

There is one way is copy the document (Invoice) and post the credit memo which will reverse the Invoice and create another document called Credit Memo

Second way is using General Journal where in you can pass multiple credit memo by applying the invoices.

Check it out

Thanks for reply, still some confusion regarding to data, from which table i have to copy the data for credit memo??

here is my senario, i want the invoice between given date, balance <> 0 and invoice must be opened,

now this data is present in (cut. ledger entry) table, and copy document functionality accepts

CopyDocMgt.CopySalesDoc(DocType,DocNo,SalesHeader)

DocType := “Credit Memo”

DocNo := ??

SalesHeader := ??

hope you get my question…

AHMED

Hi,

Here is my answer

CopyDocMgt.CopySalesDoc(DocType,DocNo,SalesHeader)

DocType := “Posted sales invoice”

DocNo := CLE.“document NO.”

SalesHeader := teh credit memo header where u want to copy the document in to…the destination document header

hope you get my answer

This not that complex though… we better make it simple than discussing complex stuff that ones really understand [:D]

Anil.

I write this {

SalesSetup.GET;

CopyDocMgt.SetProperties(

IncludeHeader,RecalculateLines,FALSE,FALSE,FALSE,SalesSetup.“Exact Cost Reversing Mandatory”,FALSE);

CASE DocType OF

DocType::“Posted invoice”:;

END;

CopyDocMgt.CopySalesDoc(DocType,CustLedgerEntry.“Document No.”,SalesHeader);

}

This error displayed:

The Sales Header does not exist.

Identification fields and values:

Document Type=‘Quote’,No.="

Your code should be like this…

SalesSetup.GET;

CopyDocMgt.SetProperties(

IncludeHeader,RecalculateLines,FALSE,FALSE,FALSE,SalesSetup.“Exact Cost Reversing Mandatory”,FALSE);

clear(salesheader);

SalesHeader.init;

SalesHeader.“Document type” := SalesHeader.“document type”::“Credit memo”;

SalesHeader.insert(true);

CopyDocMgt.CopySalesDoc(DocType::“Posted invoice”,CustLedgerEntry.“Document No.”,SalesHeader);

if you are still facing issues… then learn technical CAL coding and work for yourself…because you need to apply your syntax related knowledger to the application requirement… i fi keep giving you all the code then it is better i work onbehalf of you…

again apologies if i am harsh… aim is to make you understand the application logic and be more innovative technical skills.

Anil.

Still Some changes but done finally, THANX to all