I created a custom field named TransferCompany in the General Journal Line page. With this field, I am transferring a few lines from the current company to another company. All my lines are going through perfectly, but the only problem I am facing is sending the dimension data from the current company to another company. Is there any way to send the dimensions using ChangeCompany? If possible, I would appreciate any help. Thanks in advance for your advice!
Flowing few lines of General Journals lines from one company to another company
Hello Yong,
The Function DimensionManagment.GetDimensionID(TempDimensionsetEntry) is running on the current company and it is checking current company dimensionsetid on the IC Company and if it finds it is showing those dimensions, else if it did not find anything it is inserting my dimensions, other than that method can we use any other approaches for finding the dimension set id in the IC company.....
Flowing few lines of General Journals lines from one company to another company
Hello Yong,
Currently, my code does not generate any errors; however, its functionality involves selecting dimensions within the current company. It retrieves a dimension set ID and searches for this Dimension Set ID is in the IC company. If records associated with the dimension set ID are found, the corresponding dimension values it is taking in the IC company. Conversely, if no records are found, the code creates the dimensions selected in my current company to my IC Company, there are any alternative methods available for transferring dimensions beyond this approach.
Thanks Yong, Gdrenteria, Yun Zhu, Valentin for your advices...
Flowing few lines of General Journals lines from one company to another company
Hi All,
As Yong said, I am using a Temporary table to save the dimensions of my current company and after that i am trying to insert them in the new company but it is not working it is showing already existed dimensions in the new company, I am attaching my code for it if anything is wrong give me advices to correct, advance thanks for your replies...
NewDimensionSetID := 0;
TempDimensionSetEntry.DeleteAll();
DimensionSetEntry.Reset();
DimensionSetEntry.SetRange("Dimension Set ID", GenLine."Dimension Set ID");
TempDimensionSetEntry.ChangeCompany("IC Company Name");
if DimensionSetEntry.FindSet() then
repeat
TempDimensionSetEntry.Init();
TempDimensionSetEntry.Validate("Dimension Code", DimensionSetEntry."Dimension Code");
TempDimensionSetEntry.Validate("Dimension Value Code", DimensionSetEntry."Dimension Value Code");
TempDimensionSetEntry.Insert();
until DimensionSetEntry.Next() = 0;
NewDimensionsetEntry.Reset();
NewDimensionsetEntry.ChangeCompany("IC Company Name");
NewDimensionSetID := DimensionManagement.GetDimensionSetID(TempDimensionSetEntry);
NewDimensionsetEntry.SetRange("Dimension Set ID", NewDimensionSetID);
if not NewDimensionsetEntry.FindFirst() then begin
if TempDimensionSetEntry.FindSet() then
repeat
NewDimensionsetEntry.Init();
NewDimensionsetEntry.Validate("Dimension Set ID", NewDimensionSetID);
NewDimensionsetEntry.Validate("Dimension Code", TempDimensionSetEntry."Dimension Code");
NewDimensionsetEntry.Validate("Dimension Value Code", TempDimensionSetEntry."Dimension Value Code");
NewDimensionsetEntry.Insert();
until TempDimensionSetEntry.Next() = 0;
end;
if NewDimensionSetID <> 0 then
GenJnlLine.Validate("Dimension Set ID", NewDimensionSetID);
TempDimensionSetEntry.DeleteAll();
Flowing few lines of General Journals lines from one company to another company
Have you looked into using the intercompany module which does this out of the box? Is there a reason you're creating your own functionality when the system already does it out of the box?
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.