how can i create aline in general journal for each customer with his outstanding balance

Hi everyone,

I have created one dataitem customer i want to insert balance in General form based on each customer…i have written this code…it was not effecting can any one please suggest me where i done mistake in that

Customer.CALCFIELDS(Customer.“Balance (LCY)”);
IF Customer.“Balance (LCY)”<>0 THEN

MESSAGE(’%1’,Customer.“Balance (LCY)”);

Gen.RESET;
Gen.SETRANGE(Gen.“Journal Template Name”,‘Assets’);
Gen.SETRANGE(Gen.“Journal Batch Name”,‘Default’);

Gen.VALIDATE(Gen.“Journal Template Name”,‘Assets’);
Gen.VALIDATE(Gen.“Journal Batch Name”,‘Default’);
Gen.INIT;
Line:=0;
IF Gen.FINDLAST THEN
Gen.“Line No.”:=Line+ 10000
ELSE
Line:=Gen.“Line No.”+1000;
Gen.“Balance (LCY)”:=Customer.“Balance (LCY)”;
// Line:= Line+1;
Gen.INIT;

Why not use dataport ???

My requirement is to create with a report only?

Change this

Customer.CALCFIELDS(Customer.“Balance (LCY)”);
IF Customer.“Balance (LCY)”<>0 THEN

MESSAGE(’%1’,Customer.“Balance (LCY)”);

Gen.RESET;
Gen.SETRANGE(Gen.“Journal Template Name”,‘Assets’);
Gen.SETRANGE(Gen.“Journal Batch Name”,‘Default’);

Gen.VALIDATE(Gen.“Journal Template Name”,‘Assets’);
Gen.VALIDATE(Gen.“Journal Batch Name”,‘Default’);
Gen.INIT;
Line:=0;
IF Gen.FINDLAST THEN
Gen.“Line No.”:=Line+ 10000
ELSE
Line:=Gen.“Line No.”+1000;
Gen.“Balance (LCY)”:=Customer.“Balance (LCY)”;
Line:= Line+10000;
Gen.INSERT;

what i have change in that…In customer balances was coming but it was not inserting into the general form…Suggest me

Use GEN. Insert at the end.

I have inserted in the above code

HI Amol,

I changed that code but it was not getting

You need to assign Account Type and Account No. also