spartacus
12th January 2006, 13:11
We habe a starnge behavior with "switch.to.company()".
The strange thing is: if we switch in program-script to another company erverything went fine, if wo try the same switch from the report-script, of the same session, we get an error "-2" (no permission). This problem doesn't occur, if the user is a superuser.
SanttuP
13th January 2006, 20:49
Why would you switch company in a report script? I do not know exactly what you are after but I would assume that in report you would achieve the same result by quering company specific table by adding tablename._compnr = xxx to your where clause.
Rita Kotecha
1st February 2006, 13:33
Hi
Please read the help, it may help you
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.
mr_suleyman
1st February 2006, 14:50
Control Maintain by Company Authorizations by USER (ttaad2121m000) .
Good Luck !