Open another company from C/AL code

victorM
Member Posts: 24
Dear All,
Hi, I have a problem now, does anyone know, how to open company from c/al code? I have 32 company in my office in one database, I need to run dataport in each company automatically one by one to import data from the outside, I don't want to use CHANGECOMPANY, because VALIDATE function just working in current company.
If anyone have some idea, share it to me please.. Thanks for help
Hi, I have a problem now, does anyone know, how to open company from c/al code? I have 32 company in my office in one database, I need to run dataport in each company automatically one by one to import data from the outside, I don't want to use CHANGECOMPANY, because VALIDATE function just working in current company.
If anyone have some idea, share it to me please.. Thanks for help
0
Answers
-
You can do it only in few ways:
1) Send the keystrokes through SendKeys (Something like "Ctrl+O""Home""Down""Down""Enter") but still you need to solve how to keep your code running even when you are changing company (it will not allow you to run the code when you are changing company, the transaction must end before you change it). And after the change you need to run the object somehow.
2) You can start new client within your code with the correct parameters, but you need to solve how to run the dataport when you open the company...
3) Create webservice for each company (how depends on version you are using) and call the function for each one...
4) Use NAS for each company and run the import from there...0 -
Wow that's amazing kine, thanks a lot, maybe I'll choose option 1 or 40
-
kine wrote:You can do it only in few ways:
1) Send the keystrokes through SendKeys (Something like "Ctrl+O""Home""Down""Down""Enter") but still you need to solve how to keep your code running even when you are changing company (it will not allow you to run the code when you are changing company, the transaction must end before you change it). And after the change you need to run the object somehow.
2) You can start new client within your code with the correct parameters, but you need to solve how to run the dataport when you open the company...
3) Create webservice for each company (how depends on version you are using) and call the function for each one...
4) Use NAS for each company and run the import from there...
I think 3 and 4 are the real options.
Send keys does not belong in an ERP environment.David Singleton0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions