NEVER create new records into the leger entry tables!
You should always fill in a journal record and post it.
eg. for T81.
clear(rec81);
rec81.validate("Posting Date",Mydate);
rec81.validate("Document Type",rec81."Document Type"::"My documenttype");
rec81.validate("Document No.",MyDocumentNo);
rec81.validate("Account Type",rec81."Account Type"::"G/L Account");
rec81.validate("Account No.",MyAccountNo);
rec81.validate("Amount",MyAmount);
// DO NOT INSERT THIS RECORD IN THE TABLE!
CODEUNIT.RUN(CODEUNIT::"Gen. Jnl.-Post Line",rec81);
// Believe it or not but that's all.
In short : every entry table has it's journal table. You have to fill in a record in the journal table.
How to do that?
Fill the fields in with VALIDATE in the same order a user would fill in the fields in the form. You DO NOT need a template-batch-line no, so you can leave those fields blank.
Some examples:
for T17+T21+T25 and some others, fill in T81 and post with C12
for T32, fill in T83 and post with C22
for T32 (BOM-component), fill in T89 and post with C32
and so on...
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Comments
You should always fill in a journal record and post it.
eg. for T81.
clear(rec81);
rec81.validate("Posting Date",Mydate);
rec81.validate("Document Type",rec81."Document Type"::"My documenttype");
rec81.validate("Document No.",MyDocumentNo);
rec81.validate("Account Type",rec81."Account Type"::"G/L Account");
rec81.validate("Account No.",MyAccountNo);
rec81.validate("Amount",MyAmount);
// DO NOT INSERT THIS RECORD IN THE TABLE!
CODEUNIT.RUN(CODEUNIT::"Gen. Jnl.-Post Line",rec81);
// Believe it or not but that's all.
In short : every entry table has it's journal table. You have to fill in a record in the journal table.
How to do that?
Fill the fields in with VALIDATE in the same order a user would fill in the fields in the form. You DO NOT need a template-batch-line no, so you can leave those fields blank.
Some examples:
for T17+T21+T25 and some others, fill in T81 and post with C12
for T32, fill in T83 and post with C22
for T32 (BOM-component), fill in T89 and post with C32
and so on...
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!