Hi,
I have to write a codeunit to create journal entries basing on input from a csv file. As part of the csv data I’m getting the account name and not the account no.
If I have the account number I’m able to create entries in journal voucher.
Can someone let me know how to retrieve account number for a given account name.
Have another question… Is there any way to autogenerate the document numbers
Thanks in advance.
Regards,
Sudhakar
For retrieving account no. you can use code like this, which requires having the exact account name in the csv file:
GLAccount.RESET;
GLAccount.SETRANGE(Name,CsvAccountName);
IF GLAccount.FINDFIRST THEN
…
ELSE
ERROR('Account ’ + CsvAccountName + ’ not found);
For automatic numbers you need to fill, on the corresponding Gen. Journal Batch record, the fields “Posting No. Series” (for posted document no.) and/or “No. Series” (for document no. evaluated in journal lines).
Hi,
Have assigned a No.Series…
If I add the journal line from UI I’m able to get the next number from the Series. And not when the journal line is added from Codeunit.
Could you let me know how to get the next number in the series when the journal line is getting added from code unit.
-Sudhakar
Hi, after inserting the record in journal table you need to call SetUpNewLine function in order to automatically retrieve Document No.