sramage
3rd February 2010, 16:55
Hi all !

I just discover AFS + COM Automation and it's really amazing what we can do, it makes Baan my new friend.
But I have a question :
Is there any way to change the company number ?
I know there is a function : switch.to.company but where is that function ?

seb

bdittmar
3rd February 2010, 17:02
Hi all !

I just discover AFS + COM Automation and it's really amazing what we can do, it makes Baan my new friend.
But I have a question :
Is there any way to change the company number ?
I know there is a function : switch.to.company but where is that function ?

seb

Hello,

BaanERP Programmers Guide


switch.to.company()

--------------------------------------------------------------------------------

Syntax
long switch.to.company( long new_compnr )
Description
This switches to another company and sets the read-only variable COMPNR to the specified company number. It performs several checks before switching company and switches company only if the checks are successful. For example, it checks if the user is authorized to change to the new company, it checks if the package combination corresponds with the new company number, and it checks if the old and new companies have the same first day of the week.

Notes
compnr.check() and switch.to.company() perform similar functions, but switch.to.company() performs additional checks. So switch.to.company() makes heavier demands on system resources.

Be aware that when there is a switch to another company, the user's first day of the week does not change, even if the new company has a different first day of the week. switch.to.company() returns an error value if the old and new companies have different first days of the week. compnr.check() does not.

Super users are authorized for all company numbers. They always have authority to switch to a different company number. In addition, super users can also use the data dictionary to authorize other users for particular company numbers.

Return values
1 Success.

-1 Company not available.

-2 No permission to change to this company.

-3 Package combination does not correspond with new company number.

-4 First day of the week does not correspond to first day of the week of original company.

Regards

sramage
3rd February 2010, 17:12
Thank you

Finally I found it the funtion is in ottstp_stddll

BaanObj.ParseExecFunction("ottstp_stddll","switch.to.company(400)")

mark_h
3rd February 2010, 19:48
Hi all !

I just discover AFS + COM Automation and it's really amazing what we can do, it makes Baan my new friend.
But I have a question :
Is there any way to change the company number ?
I know there is a function : switch.to.company but where is that function ?

seb

Becareful of your new best friend. Baan support is not always the best in this area. Plus I have had tools updates and portingset updates actually break things. It is cool, but just keep these things in mind. :)