Can anyone tell me how I can write to a table of another company within the same database using CHANGECOMPANY function? I enter code like below but the record is create in the SAME company instead of another company... ](*,)
>>>>>>>>>>>>
CHANGECOMPANY(fmrline1."Transfer to Company");
genline1.SETRANGE(genline1."Journal Batch Name",'ASSETS');
genline1.SETRANGE(genline1."Journal Batch Name",'FA');
IF genline1.FIND('+') THEN BEGIN
genline1."Journal Template Name":='ASSETS';
genline1."Journal Batch Name":='FA';
genline1."Line No.":=genline1."Line No."+10000;
genline1.INSERT;
genline1.VALIDATE(genline1."Account Type",genline1."Account Type"::"Fixed Asset");
genline1.VALIDATE(genline1."Account No.",fmrline1."No.");
genline1."Posting Date":=TODAY;
genline1."Document Date":=fmrline1."Document Date";
FA.GET(fmrline1."No.");
genline1."FA Posting Date":=TODAY;
genline1."Posting Group":=FA."FA Posting Group";
genline1."Document No.":=fmrline1."Document No.";
genline1."Source Code":='FAGLJNL';
genline1.VALIDATE(genline1."Source Type",genline1."Source Type"::"Fixed Asset");
genline1."Source No.":=fmrline1."No.";
FAPG.GET(FA."FA Posting Group");
genline1.VALIDATE(genline1."Bal. Account No.",FAPG."Acquisition Cost Account");
genline1.VALIDATE(genline1.Amount,fmrline.Amount);
genline1.MODIFY;
0
Comments
You need cal the CHANGECOMPANY for each record variable used.
e.g.
genline1.CHANGECOMPANY(fmrline1."Transfer to Company");
You also need to be careful of validates if they are looking at sub tables e.g. dimensions.
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Just look at the InterCompany functionality. That's why it's all processed using inbox/outbox journals .. en when logged in in the right company, you can process the inbox.. having the validation rules for that company.
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog