ChangeCompany

Hi Folks.

Can I create a Sales Order from info based in another Company…

the transaction table in company A… BUT then Create the Sales Order within Company B?

Regards

P…

Hi Paddy,

The short answer is yes, but it’s not that easy.

You need to use ChangeCompany for all tables and if you run the OnValidate code of the table, then this will still be in the other company. So you’ll need to duplicate a lot of functionality.

Personally I wouldn’t use ChangeCompany for something as complex as this. Instead I would use a NAS and import/export the new order.

Yes change the company by using command… recordvariable.changecompany(company name)

for example:

salesHeader.CHANGECOMPANY(your desired company name);

salesheader.no :=’’;

assignment statements etc

salesheader.insert

this way you need to do for sales lines as well.

Hope this helps to resolve your issue.

Anil.

You need to be careful when using ChangeCompany to write to the database. It only affects the company for the table that you call the tablevar.changecompany with. Any references (think triggers) to other tables are execute in the current company.

I guess Erik said about the same thing.

Best way use Import/Export of data for new sales order and let the other things take care by system itself.

Well scheduling job through NAS would be a good option… perhaps if your transcation source table is common for all companies… then you can make the datapercompany property of the table to NO… this way the data could be accessed in all companies of the database…

so the logic merely depends on your requirement and your current transaction conditions…!

Anil.

Hi peeps…

Thank you all for the advice.

I’m going to go down the export/import route…

Regards

Paddy