Hi there,
I'm trying to post in code, a line with VAT. I'm doing this peace of code:
GenJnlLine.INIT;
GenJnlLine.VALIDATE("Posting Date",010313D);
GenJnlLine.VALIDATE("Account Type",GenJnlLine."Account Type"::"G/L Account");
GenJnlLine.VALIDATE("Account No.",'44090XXXXX');
GenJnlLine.VALIDATE("Document Type",GenJnlLine."Document Type"::Invoice);
GenJnlLine.VALIDATE("Document No.",'My No.');
GenJnlLine.VALIDATE(Amount,100);
GenJnlLine.VALIDATE("Gen. Posting Type",GenJnlLine."Gen. Posting Type"::Sale);
GenJnlLine.VALIDATE("Gen. Bus. Posting Group",'');
GenJnlLine.VALIDATE("Gen. Prod. Posting Group",'');
GenJnlLine.VALIDATE("VAT Bus. Posting Group",'INT');
GenJnlLine.VALIDATE("VAT Prod. Posting Group",'VAT20');
FillTempJnlLineDim;
GenJnlPostLine.RunWithCheck(GenJnlLine,TempJnlLineDim);
GenJnlLine.INIT;
GenJnlLine.VALIDATE("Posting Date",010313D);
GenJnlLine.VALIDATE("Account Type",GenJnlLine."Account Type"::Customer);
GenJnlLine.VALIDATE("Account No.",'099');
GenJnlLine.VALIDATE("Document Type",GenJnlLine."Document Type"::"Invoice");
GenJnlLine.VALIDATE("Document No.",'My No.');
GenJnlLine.VALIDATE(Amount,-100);
GenJnlLine.VALIDATE("Gen. Posting Type",GenJnlLine."Gen. Posting Type"::" ");
GenJnlLine.VALIDATE("Gen. Bus. Posting Group",'');
GenJnlLine.VALIDATE("Gen. Prod. Posting Group",'');
GenJnlLine.VALIDATE("VAT Bus. Posting Group",'');
GenJnlLine.VALIDATE("VAT Prod. Posting Group",'');
FillTempJnlLineDim;
GenJnlPostLine.RunWithCheck(GenJnlLine,TempJnlLineDim);
When I execute my codeunit, this error apears: "Check that the all the entries with the same Document no. and a VAT Bus. Posting Group and VAT Prod. Posting Group associated have a Customer/Vendor associated, check that all the lines with the same Document No. have not more than one Customer/Vendor associated, check that all the lines withe same Documet no. have in the field the same value: Invoice, Credit memo or ..."
But, if in both records I add a Journal Template name='MyTemplate', Journal Batch Name="MYBatch" and Line No.="10000,20000" and then I called GenJnlBatch.RUN at the end of my code, instead of GenJnlPostLine.RunWithCheck, it runs perfectly!!!!
Is not allowed to post VAT Entries in code, calling to the codeunit GenJnlPostLine (cd12)?????
Do you know what I'm doing wrong???
0