We have Table 2000000006 - Company
This table contains the names of all the companies that have been created in the current database.
And also we have CHANGECOMPANY Function
Redirects references to table data from one company to another.
This table contains the names of all the companies that have been created in the current database.
And also we have CHANGECOMPANY Function
Redirects references to table data from one company to another.
[Ok :=] Record.CHANGECOMPANY([CompanyName])
We can create a ProcessingOnly report to update the data in all companies using above table and function.
Ex: If I have to Update "Allow Posting From" and "Allow Posting To" field of General Ledger Setup table in all companies then:
1. Create a Processing Only report with Company as dataitem
2. write below code in Company - OnAfterGetRecord() trigger
GLSetup.CHANGECOMPANY(Name); GLSetup.MODIFYALL("Allow Posting From",010213D); GLSetup.MODIFYALL("Allow Posting To",280213D);
//You can use variables in Request Form for From Date and To Date
Where GLSetup is global variable of record type variable with General Ledger Setup table.
Thanks for sharing this with us! Some really amazing features.
ReplyDeletecompanies
Hey very nice blog!
ReplyDeleteTake a look at my site authentification curriculum vitae
In OnAfterGetRecord trigger, can we write to the database. It is giving error.'Tansaction must be started before making changes to the database'
ReplyDeleteThanks share this helpful post.
ReplyDeleteBut I have one problem with this issue. I want to update data of "Currency Exchange Rate" table from a basic company into other companies. But it cant modify because of primary key (starting date, currency code). How should I solve it? How modify data of primary key?
Thanks for the blog post. Beware that if Change Log is active this won't track correctly record changes as per CHANGECOMPANY design. In this case, it should be more advisable the usage of STARTSESSION to perform changes by a background session in the correct company context.
ReplyDelete