Open Form (39) within the Code

Dear All,

I have a small problem, I import an excel tabel in the General Journal tabel under a certain batch name, After that when I open the General Journal manually (After selecting the target batch name ) I can see all the importet lines.

Now the question is How can I open this Form directlly from my code. I tried the follwoing but its not working.

C/AL Globals:

Name Type SubType

FormGJ Form General Journal

Import Gen. Journal Line Rec Gen. Journal Line

“Import Gen. Journal Line”.SETRANGE(“Document Type”,“Import Gen. Journal Line”.“Document Type”::Payment);

FormGJ.SETTABLEVIEW(“Import Gen. Journal Line”);

FormGJ.RUN;

Is this right ? how what Iam doing wrong?

Thanks all

C/AL Globals:

Name Type SubType

FormGJ Form General Journal

Import Gen. Journal Line Rec Gen. Journal Line

and another question, where should I add this in my report? (Iam working with a report )

simple with FormGJ.RUN;

It want me to commit the code first. and the problem if I commit the code I will have only the last line from the excel tabel

The answer is :

Commit;

“Import Gen. Journal Line”.SETFILTER(“Journal Template Name”,’%1’,JournalTemplateName);

“Import Gen. Journal Line”.SETFILTER(“Import Gen. Journal Line”.“Journal Batch Name”,’%1’,JournalBatchName);

FormGJ.SETTABLEVIEW(“Import Gen. Journal Line”);

FormGJ.RUNMODAL;

---- > This solved the problem :slight_smile:

But still I donot want to use the Commit Function