The SY_Session object must be created for each instance of ProvideX that starts up. It will contain all the important methods and properties needed by most other applications and base classes. In most cases, a pointer to this object must be passed into any other object created in Sage ERP MAS 90 or 200.
Syntax
objhandle=new( SY_SESSION )
Inherits from
(none)
Parameters
Returns
objhandle
On success: Returns handle to the session object
On failure: Returns 0, object is not created
Example
! get session object
SysObj = new(SY_SESSION)
Notes
Version of Sage ERP MAS 90 or 200 being run.
Path to the current company code (see SetCompany method).
Path to the current user code (see SetUser method).
(Read only) Path to the SYSTEM data file directory.
(Read only) Path to the HOME directory.
(Read only) Path to the SOA program file directory.
(Read only) Root directory for Sage ERP MAS 90 system.
(Read only) UNC path to the Sage ERP MAS 90 system.
(Read only) Path to the HELP directory for online help.
(Read only) Directory to Sage ERP MAS 90 data dictionary.
(Read only) Path to the Payroll alternate directory.
(Read only) Root directory prefix name.
(Read only) Suffix for physical data files (for example, .SOA).
(Read only) Current company surrogate key.
(Read only) Current user's company code.
(Read only) Current company display name.
(Read only) List of all companies in the system.
(Read only) List of all company codes.
(Read only) List of all company paths.
(Read only) List of all company payroll paths.
(Read only) List of all company surrogate keys.
(Read only) Current user's surrogate key.
(Read only) Current user's three-character initials.
(Read only) Current user's logon name.
(Read only) List of all users on the system.
(Read only) List of all user codes.
(Read only) List of all customizer groups on system.
(Read only) List of all customizer group codes.
(Read only) Constant value used to validate instance of the session object.
(Read only) Current module name.
(Read only) Current module code.
(Read only) Current module level.
Current module release date.
(Read only) Is the current module 4.x?
(Read only) System date for applications.
(Read only) Program launched by session.
(Read only) Program name/description.
(Read only) Task number of program launched by session.
(Read only) Arguments passed into program being launched.
Launcher HWND pointer.
(Read only) Launcher object handle.
Set in the middle of an update.
(Read only) Session ID for worktable generation.
(Read only) Registered owner company.
(Read only) User running through Terminal Services.
(Read only) User's workstation name.
(Read only) Legacy TERM$ string.
(Read only) Current process's Process ID.
(Read only) Modules that have had date changed in this session.
(Read only) Modules that have had a registration checked.
(Read only) Legacy Y record from SY0CTL.
(Read only) Developer code if using a developer activation key.
(Read only) Counter indicating session identifier (for Master Console).
Escape trap property.
(Read only) Indicates that the session was started through the object (COM) interface.
(Read only) Name of last file opened.
(Read only) Configured as SQL system.
(Read only) Configured as CS system.
(Read only) UI object.
(Read only) [WDX] string set if running in CS environment (replaces %SYS_WDX$).
(Read only) Object pointer to the security object.
(Read only) Object pointer to the file I/O object.
(Read only) Object handle to WinAPI for handling Windows API calls (*obj/winapi.pvc).
(Read only) Boolean to identify when running from the Web Engine installation.
TRUE if the program being run is a character-based program (set by SYCOMP).
Note ◄ indicates that an argument is an "out" parameter. A value will be stored in the passed variable as part of the method.
Log on the User. If Security is enabled SetUser() Method should be run instead.
Syntax
Object'Logon()
Parameters
(none)
Returns
On success: Returns 1
On failure: Returns 0
Example
retVal=oSession'LogOn()
Notes
Sets User to the Default User
Start the UI.
Syntax
Object'InitiateUI(options)
Parameters
options
(optional) 1 = Used only when starting up a Legacy program. Sets up fragmented status line and other Legacy-only UI parameters.
Returns
On success: Returns the handle to the SY_UI Object
On failure: Returns 0
Example
RetVal = coSessionInitiateUI()
RetVal = coSessionInitiateUI(1)
Notes
Terminate the UI.
Syntax
Object'TerminateUI()
Parameters
(none)
Returns
On success: Returns 1
On failure: Returns 0
Example
RetVal = coSessionTerminateUI()
Notes
Drops the object handle for the UI Object.
Initiate WinAPI.
Syntax
Object'InitiateWinAPI()
Parameters
(none)
Returns
On success: Returns handle to WinAPI object
On failure: Returns 0
Example
RetVal = coSessionInitiateWinAPI()
Notes
Creates Object handle for WinAPI.pvc.
Check security and check for User and Company keys before launching program.
Syntax
Object'LaunchProgram(parameters)
Parameters
parameters$ (Optional)
Returns
Returns 1
Example
RetVal = coSessionLaunchProgram(parameters)
Notes
This logon routine is only used to log in as the administrator. Users who forget the administrator password can use the "09SAM" or "!MAS90" password to get to the override screen which they'll need to print out and send to CSS to get an override password.
Syntax
Object'LogonAdmin(password$)
Parameters
password$
(required) Administrator password
Returns
Returns 1
Example
RetVal = coSessionLogonAdmin(password$)
Notes
This method can be used to logon a user whose logon/code and password are stored in a file. The logic within each case of the switch will need to retrieve the values and then do a SetUser.
Syntax
Object'LogonFromFile(fileName$,key$)
Parameters
fileName$
(required) File where user logon information is stored
key$
(required) key to the file
Returns
On success: Returns 1
On failure: Returns 0
Example
tmpRetVal
=coSessionLogonFromFile(userfile,username)
Notes
Open session files.
Syntax
Object'OpenSessionFiles()
Parameters
(none)
Returns
Returns 1
Example
tmpRetVal = coSession'OpenSessionFiles()
Notes
In the case of installation, files won't be opened on the create of the session object, but will need to be opened up later once the files have been created.
Close session files.
Syntax
Object'CloseSessionFiles()
Parameters
(none)
Returns
Returns 0
Example
tmpRetVal = coSession'CloseSessionFiles()
Notes
Add ODBC entries to Registry. ODBC is configured as a User DSN (HKEY_CURRENT_USER).
Syntax
Object'WriteRegistryStartupEntries()
Parameters
(none)
Returns
Returns 1
Example
tmpRetVal = coSession'WriteRegistryStartupEntries()
Notes
Find and set the user information based on securityKey$.
Syntax
Object'SetUser(securityKey$)
Parameters
securityKey$
Returns
Returns 1
Example
tmpRetVal = coSession'SetUser(SecurityKey$)
Notes
Set user information by key.
Syntax
Object'SetUser(name,pswd$)
Parameters
name
Numeric value of Userkey$ from SY_user
pswd$
User Password
Returns
Returns 1
Example
tmpRetVal = coSession'SetUser(0000000001,pswd$)
Notes
Set user information by name.
Syntax
Object'SetUser(name$,pswd$)
Parameters
name$
Username$ from SY_user
pswd$
User Password
Returns
Returns 1
Example
tmpRetVal = coSession'SetUser(Steve,password$)
Notes
Returns SEP separated list of users and groups.
Syntax
Object'GetuserList(usrList$,grpList$)
Parameters
usrList$
(Required) Returned SEP separated list of users
grpList$
(Optional) Returned SEP separated list of groups
Returns
Returns 1
Example
coSession'GetUserList(usrList$,grpList$)
Notes
Logs off user.
Syntax
Object'LogoffUser()
Parameters
(none)
Returns
Returns 1
Example
coSession'LogoffUser()
Notes
Get the user key.
Syntax
Object'GetUserKey$(user$)
Parameters
user$
(Required) Either a UserCode or UserLogon. If a UserCode is passed in it must be prefaced with a &
Returns
UserKey for the user record
Example
coSession'GetUserKey$(“&USR”)
coSession'GetUserKey$(“SampleUser”)
Notes
Reads the company file and obtains company-specific settings. Parameters are assigned into local object variables and can be accessed through the GetParameter() method.
Syntax
Object'SetCompany(code$,noChange)
Parameters
code$
(Optional) Company Code
noChange
(Optional) Flag to indicate not to change the default company code set in the users object so the next program launched starts in the Launchers company
Returns
Returns 1
Example
tmp = %SYS_SS'SetCompany(COMP$,1)
Notes
If no company masterfile file exists then an error 12 is raised. If no record for the company exists in the masterfile then an error 11 is raised.
Sets PathCompany$ property.
Change company.
Syntax
Object'SetCompany(code,noChange)
Parameters
code
(Required) Company Code key
noChange
(Optional) Flag to indicate not to change the default company code set in the users object so the next program launched starts in the Launchers company
Returns
Returns 1
Example
retVal = coSession'SetCompany(NUM(newCompKey$),isTRUE)
Notes
Return success if we're already in the company we want to change to and return back success if no company code is passed in
Returns back a surrogate key for the company code specified (not necessarily the current company).
Syntax
Object'GetCompanyKey(compCode$)
Parameters
compCode$
(Required) Company Code
Returns
Returns CompanyKey$
Example
retVal = coSession'GetCompanyKey$(compCode$)
Notes
Get company list.
Syntax
Object'GetCompanyList(compList$)
Parameters
compList$
(Required) Company list
Returns
Returns SEP separated list of Company Codes and Company Names
Example
tmpRetVal = coSession'GetCompanyList(compList$)
Notes
Get company directories.
Syntax
Object'GetCompanyDirectories(company$,mainPath$,prPath$)
Parameters
company$
(Required) Company Code
mainPath$
(Required) Path to Company Data
prPath$
(Required) Path to Company Payroll Data
Returns
On success: Returns 1
On failure: Returns 0
Example
tmp = coSession'GetCompanyDirectories
(UCS(MID(newDir$,3,3)),newMain$,newPR$)
Notes
Set program.
Syntax
Object'SetProgram(taskID,program$)
Parameters
taskID
(Required) TaskID of the program to be run
program$
(Optional) Program to run
Returns
On success: Returns Security object handle
On failure: Returns 0
Example
%SYS_SS'SetProgram(%SYS_SS'LookupTask("GL_ACCOUNTGROUP_UI"))
Notes
Set module.
Syntax
Object'SetModule([module$])
Parameters
module$
(Required) Module Code
Returns
On success: Returns 1
On failure: Returns 0
Example
retVal = coSession'SetModule("G/L")
Notes
Set Module Code by Module Number.
Syntax
Object'SetModule([module|module$],modCode$)
Parameters
module
(Required) Module Code
modCode$
(Required) Module code
Returns
On success: Returns 1
On failure: Returns 0
Example
retVal = coSession'SetModule(02, ModCode$)
Notes
This method returns back the module number from the module code file. Typically, the calling routine will have received the module code already and just needs to look up the module number.
Syntax
Object'GetModuleNumber(module$)
Parameters
module$
Module Code
Returns
Module Number
Example
retVal = coSession'GetModuleNumber(A/R)
Notes
Copy module options to the SY0CTL file.
Syntax
Object'CopyParameters(module$)
Parameters
module$
Module Code
Returns
Returns 1
Example
retVal = coSession'CopyParameters(A/R)
Notes
Set module date.
Syntax
Object'SetDate(modCode$,date$)
Parameters
modCode$
(Required) Module Code
date$
(Required) Date in YYYYMMDD format
Returns
On success: Returns 1
On failure: Returns 0
Example
retVal=coSession'SetDate("G/L","20050125")
Notes
Get module date.
Syntax
Object'GetDate(modCode$,date$)
Parameters
modCode$
(Required) Module Code
date$
(Required) Date in YYYYMMDD format
Returns
On success: Returns 1
On failure: Returns 0
Example
tmp = coSession'GetDate("G/L",date$)
Notes
Sets Module Date from SY_ModuleDate file
Set launcher object handle.
Syntax
Object'SetLauncherObject(objHandle)
Parameters
objHandle
(Required) Object handle to SY_Launcher
Returns
On success: Returns 1
On failure: Returns 0
Example
tmp = coSession'SetLauncherObject(_OBJ)
Notes
Check for the required modules.
Syntax
Object'CheckForRequiredModules(module$)
Parameters
module$
(Required) Module Code
Returns
On success: Returns 1
On failure: Returns 0
Example
tmp = coSession'CheckForRequiredModules(module$)
Notes
Checks for modules that are required for this module
Opens a channel to a specified table and returns channel back to calling routine. The SY_File object must exist before this method will work (SY_File is instantiated on creation of SY_Session).
Syntax
object'OpenTable(fileName$,path$,[options, localFile])
Parameters
fileName$
(Required) Table/File Name (no extensions)
path$
(Required) The path determines where the file should be opened from. In place of the path, one of the following short cuts may be used:
COMPANY Path to company database
SYSTEM Path to MAS_SYSTEM directory
USER Path to users base directory
SOA Path to SOA directory
HOME Path to HOME directory
TEXTOUT Path to TEXTOUT directory
ROOT Path to root MAS90 directory
DICTIONARY Path to data dictionary directory
options
(Optional) Combine (add) the following binary values to open files with specific properties or to create a file if it does not exist.
1 Create file if does not exist
2 Lock file upon opening
4 Open file on global channel
localFile
(Optional)To open the file locally (MAS 200 only) on the workstation, pass in a 1 for this parameter. If the system is not running in MAS 200, the parameter will be ignored. For normal file access, this parameter is not required.
Returns
On success: Returns file channel
On failure: Returns 0 (error raised)
Example
fCh = oSSOpenTable(SY_ZipCode,SYSTEM)
Opens the SY_ZipCode file in the MAS_SYSTEM directory.
fCh = oSSOpenTable(GL_Accounts,COMPANY)
Opens the GL_Account file in the current company directory (i.e. MAS_ABC or its alternate data directory).
fCh = oSSOpenTable(REPORT.RPT,TEXTOUT,0,1)
Opens the REPORT.RPT file in the HOME\TEXTOUT directory on the local users workstation (for CS reports).
fCh = oSSOpenTable(SY_System,SYSTEM,5)
Creates (if it doesnt exist) and opens the SY_System data file in the MAS_SYSTEM directory on a global channel (1 create plus 4 global channel = 5)
Notes
The calling program is responsible for keeping track of the file channel that is returned. It will need to close the channel when it is finished with it. The Session object does not maintain a list of files that have been opened through it.
Same as first OpenTable except the channel specified in the ch variable is the channel the file is opened on..
Syntax
object'OpenTable(ch,fileName$,path$,[options, localFile])
Parameters
ch
(Required) Channel on which to open the Table/File Name
fileName$
(Required) Table/File Name (no extensions)
path$
(Required) The path determines where the file should be opened from. In place of the path, one of the following short cuts may be used:
COMPANY Path to company database
SYSTEM Path to MAS_SYSTEM directory
USER Path to users base directory
SOA Path to SOA directory
HOME Path to HOME directory
TEXTOUT Path to TEXTOUT directory
ROOT Path to root MAS90 directory
DICTIONARY Path to data dictionary directory
options
(Optional) Combine (add) the following binary values to open files with specific properties or to create a file if it does not exist.
1 Create file if does not exist
2 Lock file upon opening
4 Open file on global channel
localfile
(Optional) To open the file locally (Sage ERP MAS 200 only) on the workstation, pass in a 1 for this parameter. If the system is not running in Sage ERP MAS 200, the parameter will be ignored. For normal file access, this parameter is not required.
Returns
On success: Returns file channel
On failure: Returns 0 (error raised)
Example
fCh = oSSOpenTable(10,SY_ZipCode,SYSTEM)
Opens the SY_ZipCode file in the MAS_SYSTEM directory on channel 10.
fCh = oSSOpenTable(20,GL_Account,COMPANY)
Opens the GL_Account file in the current company directory (i.e. MAS_ABC or its alternate data directory) on channel 20.
fCh = oSSOpenTable(200,REPORT.RPT,TEXTOUT,0,1)
Opens the REPORT.RPT file in the HOME\TEXTOUT directory on the local users workstation (for CS reports) on channel 200.
fCh = oSSOpenTable(6,SY_System,SYSTEM,5)
Creates (if it doesnt exist) and opens the SY_System data file in the MAS_SYSTEM directory on a global channel (1 create plus 4 global channel = 5) on channel 6.
Notes
The calling program is responsible for keeping track of the file channel that is returned. It will need to close the channel when it is finished with it. The Session object does not maintain a list of files that have been opened through it.
Get the full path for the specified table.
Syntax
object'GetTable(fullPath$,filename$,path$,[options, localFile])
Parameters
fullPath$
(Required) Full path for the specified file which will be retrieved by the method
fileName$
(Required) File name for which the path will be found
path$
(Required) The path determines where the file should be found. In place of the path, one of the following short cuts may be used:
COMPANY Path to company database
SYSTEM Path to MAS_SYSTEM directory
USER Path to users base directory
SOA Path to SOA directory
HOME Path to HOME directory
TEXTOUT Path to TEXTOUT directory
ROOT Path to root MAS90 directory
DICTIONARY Path to data dictionary
options
(Optional) File options see SY_Constant for complete list of values
2 Lock file
localfile
(Optional) This parameter is currently not used.
Returns
Returns 1
Example
Tmp = coSession
GetTable(fullPath$,GL_Account,COMPANY)
Returns full path to the GL_Account table for the current company
Notes
Creates a new table based on the entries in the data dictionary. Note that a ProvideX table must be defined in the data dictionary before it can be built using this routine.
Syntax
object'CreateTable( fileName$, path$, [localFile], [dictionary$])
Parameters
fileName$
(Required) Table/File Name (no extensions)
path$
(Required) The path determines where the file should be opened from. In place of the path, one of the following short cuts may be used:
COMPANY Path to company database
SYSTEM Path to MAS_SYSTEM directory
USER Path to users base directory
SOA Path to SOA directory
HOME Path to HOME directory
TEXTOUT Path to TEXTOUT directory
ROOT Path to root MAS90 directory
DICTIONARY Path to data dictionary directory
localFile
(Optional) To open the file locally (MAS 200 only) on the workstation, pass in a 1 for this parameter. If the system is not running in MAS 200, the parameter will be ignored. For normal file access, this parameter is not required.
dictionary$
(Optional) ProvideX Data Dictionary file name to be created if different from fileName$ parameter.
Returns
On success: Returns 1
On failure: Returns 0 (error raised)
Example
fCh = oSSCreateTable(SY_ZipCode,SYSTEM)
Creates the SY_ZipCode file in the MAS_SYSTEM directory.
Notes
The CreateTable method does not automatically open the file that was created. This is usually because an application will branch to an error track if an OPEN fails because it does not exist, create the file, and then RETRY the OPEN statement. The same functionality can also be accomplished using the OpenTable method with an option of 1.
Creates a worktable using the unique session id created by the Session object. If the optional sysFlag parameter is set, the worktable is created in the MAS_SYSTEM directory instead of the company data directory.
Syntax
object'CreateWorkTable( fileName$[,sysFlag][,extension$])
Parameters
fileName$
(Required) Name of work table to create
sysFlag
(Optional) Set to 1 if the worktable should be created in the MAS_SYSTEM database otherwise the worktable will be created in the company database
extension$
(Optional) File extension to use on the worktable if different than .M4T
Returns
On success: Returns 1
On failure: Returns 0
Example
cJournalWrkFH = coSessionCreateWorkTable (AR_CashReceiptsJournalWrk)
Create worktable for Cash Receipts Journal printing.
Notes
Drops (removes) the specified table from the system.
Syntax
object'DropTable(filename$,path$)
Parameters
fileName$
(Required) File name to erase
path$
(Optional) The path determines where the file should be erasedfrom. In place of the path, one of the following short cuts may be used:
COMPANY Path to company database
SYSTEM Path to MAS_SYSTEM directory
USER Path to users base directory
SOA Path to SOA directory
HOME Path to HOME directory
TEXTOUT Path to TEXTOUT directory
ROOT Path to root MAS90 directory
DICTIONARY Path to data dictionary directory
Returns
On success: Returns 1
On failure: Returns 0
Example
coSession'DropTable("GL_DeleteAccountsWork", "COMPANY)
Erase the GL_DeleteAccountsWork table from the current company database
Notes
Encapsulates the DropTable and CreateTable methods into one routine to allow tables to be removed and recreated.
Syntax
object'InitTable(filename$,path$)
Parameters
fileName$
(Required) File name to initialize
path$
(Required) The path determines where the file resides. In place of the path, one of the following short cuts may be used:
COMPANY Path to company database
SYSTEM Path to MAS_SYSTEM directory
USER Path to users base directory
SOA Path to SOA directory
HOME Path to HOME directory
TEXTOUT Path to TEXTOUT directory
ROOT Path to root MAS90 directory
DICTIONARY Path to data dictionary directory
Returns
On success: Returns 1
On failure: Returns 0
Example
coSession'InitTable
("GL_AllocationSelectionCalc","COMPANY" )
clear calculations worktable
Notes
Set record default values.
Syntax
object'setDefaults(ch,record$)
Parameters
char
(Required) File Channel
record$
(Required) (Out) REC(IOL(ch)) populated with default values from the Data Dictionary
Returns
Returns 0
Example
%SYS_SSSetDefaults(userFH,record$)
Notes
Retrieves the next surrogate key for the file specified. All surrogate keys are ten digit numeric values that are zero-filled.
Syntax
object'GetNextSurrogate$(file$)
Parameters
file$
(Required) File name to retrieve next surrogate key for (no extensions or path)
Returns
On success:
Next surrogate key value (ten-character, zero-filled numeric string).
On failure:
NULL the table has not been inserted into the SY_Surrogates table and will need to be added first.
Example
x$ = oSSGetNextSurrogate$(SY_Users)
Notes
objectGetNextSurrogate$(file$)
Adds a new surrogate table into the surrogate key table (SY_Surrogates). The routine must pass in the surrogate key field name so that the SY_Surrogates table can be rebuilt if necessary.
Syntax
object'AddSurrogate$(file$,field$)
Parameters
file$
field$
Returns
On success: Returns first surrogate key (0000000001)
On failure: NULL
Example
x$ = oSSAddSurrogate$(SY_Users,UserID)
Notes
This method only works for system data files. Application data files that use other surrogate keys cannot call this routine (at this time). If the applications adopt using this type of surrogate key, the surrogate key file should be maintained for each company.
Retrieves a specified parameter for a given module and optional company code. Parameter is returned in the value or value$ parameter.
Syntax
object'GetParameter(module$,parameter$,value$ | value [,company$])
Parameters
module$
(Required) Module code for the parameter to be looked up. Use SYS for Library Master or system parameters
parameter$
(Required) Exact name of the parameter to be retrieved. Should be the same name as defined in the data dictionary
value | value$
Return value of parameter. Use string or numeric based on type of parameter retrieving
company$
(Optional) Pass in the three-character company code if the parameters being looked for are not in the current company
Returns
On success: Returns 1 (check value$/value variable)
On failure: Returns 0
Example
oSSGetParameter(SYS,LookupLimit,value$)
Notes
If the parameter specified is not in the list or the wrong type is specified, the function will return a failure (0). Make sure the parameters are spelled correctly and that the value$/value variable is the correct type.
Creates the TERM$ and %SYS_OPTIONS$ parameter records primarily for legacy applications.
Syntax
object'BuildTerm(term$,sysOptions$)
Parameters
term$◄
TERM$ variable recreated using 4.x data files
sysOptions$◄
%SYS_OPTIONS$ variable recreated using 4.x data files
Returns
On success: Returns 1
On failure: Returns 0
Example
oSSBuildTerm$(term$,%SYS_OPTIONS$)
Notes
This routine can also be used by 4.x applications if they require a TERM$ variable or a FID(0) value. FID values are assigned quazi-randomly eliminating the restriction of 300 or so defined FID values. Only one TERM$ can be built per instance of the Session object.
Drops the TERM$ variable from the session object properties and removes the reference lock on the SY_Terminals data table.
Syntax
object'DropTermRecord()
Parameters
(none)
Returns
On success: Returns 1
On failure: Returns 0
Example
oSSDropTermRecord()
Notes
This method may become a protected method of the object as most application programs should not need to call this routine. It will be automatically called upon the deletion of the Session object. However, since only one TERM$ can be created per Session object, there may be a case where a program will need to drop the existing TERM$ and create a new one.
Sets string parameter (Library Master parameters only; modules should use the business object).
Syntax
Object'SetParameter(module$,parameter$,value$)
Parameters
module$
(Required) Module code
parameter$
(Required) String parameter to set
value$
(Required) Parameter value
Returns
On success: Returns 1
On failure: Returns 0
Example
Tmp = coSession'SetParameter
("SYSTEM","DefaultCompanyKey$",tmpCompanyKey$)
Notes
Sets numeric parameter (Library Master parameters only; modules should use the business object).
Syntax
Object'SetParameter(module$,parameter$,value)
Parameters
module$
(Required) Module code
parameter$
(Required) Numeric parameter to set
value
(Required) Parameter value
Returns
On success: Returns 1
On failure: Returns 0
Example
tmp = _OBJ'SetParameter
("COMPANY","CompanyLevel",module.moduleLevel)
Notes
Returns back a true or false to the calling routine if the application specified is installed for the current company (or company specified on the input parameter).
Syntax
object'IsActivated(module$ [,company$])
Parameters
module$
(Required) module$
company$
(Optional) company$
Returns
On success: Returns 1 (module is activated for this company)
On failure: Returns 0 (module is not activated)
Example
result=oSSIsActivated(A/R)
Notes
Boolean indicating that the specified module is installed. Has nothing to do with company data files, only that the module was installed by the user and program files exist for this module.
Syntax
Object'IsInstalled(module$)
Parameters
module$
(Required) Module code
Returns
On success: Returns 1 (module is Installed)
On failure: Returns 0 (module is not Installed)
Example
IF coSession'IsInstalled("J/C") {
IF coSession'IsActivated("J/C") {
JC_Integrated = isTRUE
}
}
Checks if Job Cost is installed and if it is set the integration flag.
Notes
Boolean indicating that the specified module has been registered or is a registered module.
Syntax
Object'IsRegistered(module$)
Parameters
module$
(Required) Module code
Returns
On success: Returns 1 (module is registered)
On failure: Returns 0 (module is not registered)
Example
SO_IntegrateStarship = coSession'IsRegistered("S/T")
Checks if StarShip is registered and sets flag.
Notes
Check to see if an application is installed on a machine by looking for the class ID of the application. Calling programs must pass in the application they want to check for (i.e. EXCEL).
Syntax
Object'ApplicationInstalled(application$)
Parameters
application$
(Required) application to check
Returns
On success: Returns 1
On failure: Returns 0
Example
coSession'ApplicationInstalled("Excel")
Check if Excel is installed.
Notes
Launch program by task.
Syntax
Object'InvokeProgram(taskID,[param$])
Parameters
taskID
(Required) Task ID for the SY_Task file for the program to launch
param$
(Optional) parameter to pass in to force the program that is launched to pre-load a record.
Returns
Returns 1
Example
PRG_RESULT = %SYS_SS'InvokeProgram(PRG_TASKID)
Launch program based on TaskID
coSession'InvokeProgram
(coSession'LookupTask("IMWIAA"),"/"+ItemCode$)
Lookup task for Item Inquiry and launch task with a pre-loaded Inventory item.
Notes
This method can be used to invoke a new instance of a program. To use this method, the task ID of the program to be run needs to be passed in. To get this task ID from a program name, either look it up directly through the Tasksservice object or call the method LookupTask, which will return a task ID to the calling program.
Launch program by name.
Syntax
Object'InvokeProgram(progName$,[param$])
Parameters
progName$
(Required) program name to launch
param$
(Optional) parameter to pass in to force the program that is launched to pre-load a record.
Returns
Returns 1
Example
coSession'InvokeProgram
("GL_BudgetMaintenance_ui", tmpFFA$)
Launch G/L Account Maintenance with a pre-loaded account.
Notes
Launch program link.
Syntax
Object'InvokeLink(link$,handle%)
Parameters
link$
(Required) program name/link to launch
handle%
(Required) windows handle for the program process
Returns
On success: Returns 1
On failure: Returns 0
Example
TMP=%SYS_SS'InvokeLink("SWPVUR",%P_WHND)
Launch viewer
Notes
Lookup program task.
Syntax
Object'LookupTask(progname$,[parameter$])
Parameters
progName$
(Required) program name
parameter$
(Optional) parameter from the task file for the program being launched
Returns
On success: Returns 1
On failure: Returns 0
Example
optionsTaskID = coSession'LookupTask ("AR_OPTIONS_UI")
tmpTaskNo = %SYS_SS'LookupTask("CM_EDITOR.M4P")
Notes
Look up module code for a specific task.
Syntax
Object'LookupModule(taskID,modCode$)
Parameters
taskID
(Required) task ID
modCode$
(Required) variable which will return the Module Code
Returns
On success: Returns 1
On failure: Returns 0
Example
tmp = coSession'LookupModule(taskID,modCode$)
Notes
Look up program information for a specific task.
Syntax
Object'LookupProgram(taskID,modCode$,progName$[,args$],[taskName$])
Parameters
taskID
(Required) task ID
modCode$
(Required) variable which will return the Module Code
progName$
(Required) variable which will return the program name
args$
(Optional) variable which will return the arguments for the task
taskName$
(Optional) variable which will return the task name
Returns
On success: Returns 1
On failure: Returns 0
Example
tmp = _OBJ'LookupProgram (taskID,module$,progName$,param$)
Notes
Get developer code.
Syntax
Object'GetModuleInfo(modCode$,devCode$)
Parameters
modCode$
(Required) Module Code
devCode$
(Required) variable which will return the developer code
Returns
On success: Returns 1
On failure: Returns 0
Example
tmpRetVal = coSession'GetModuleInfo (ModuleCode$,devCode$)
Notes
Get module name and expiration date.
Syntax
Object'GetModuleInfo(modCode$,modName$,expDate$)
Parameters
modCode$
(Required) Module Code
modName$
(Required) Variable which will return the Module Name
expDate$
(Required) Variable which will return the Expiration Date
Returns
On success: Returns 1
On failure: Returns 0
Example
tmp2 = coSession'GetModuleInfo (modCode$,modName$,modExpDate$)
Notes
Get Everest flag and module level information.
Syntax
Object'GetModuleInfo(modCode$,everestFlg,modLevel,convLevel)
Parameters
modCode$
(Required) Module Code
everestFlg
(Required) variable which will return the Everest Flag (4.x Level)
modLevel
(Required) Variable which will return the Module Level
convLevel
(Required) Variable which will return the Conversion Level
Returns
On success: Returns 1
On failure: Returns 0
Example
tmpRetVal = coSession'GetModuleInfo (moduleCode$,cIsEverest,modLvl,convLvl)
Notes
Create a lock file.
Syntax
Object'CreateLock(lockfile$,[lockState],[lockSys])
Parameters
lockFile$
(Required) Lock File name to create
lockState
(Required) If this flag is set then the lockFile$ is created and locked otherwise the lockFile$ is just created
lockSys
(Required) If this flag is set then the lockFile$ is created in the LOCKSYS directory otherwise it is created in the LOCK directory
Returns
On success: Returns 1
On failure: Returns 0
Example
retVal = coSession'CreateLock ("SO_SalesOrderHeader",tmplock)
Notes
Get user, date, and time stamp information.
Syntax
Object'CreateLock(userStamp$,dateStamp$,timeStmp$)
Parameters
userStamp$
(Required) User Stamp
dateStamp$
(Required) Date Stamp
timeStamp$
(Required) Time Stamp
Returns
On success: Returns 1
On failure: Returns 0
Example
tmpRetVal = coSession'GetStampInfo
(cUserStamp$, cDateStamp$, cTimeStamp$)
Notes
Create console record.
Syntax
Object'CreateConsoleRec(taskKey)
Parameters
taskKey
(Required) Task Key for which to create the console record
Returns
Returns 0
Example
launcherTask = coSession'LookupTask ("SY_Launcher")
coSession'CreateConsoleRec(launcherTask)
Lookup Launcher Task and then create the console record for it.
Notes
Create workstation record.
Syntax
Object'CreateWorkstationRec()
Parameters
(none)
Returns
Returns 1
Example
retVal = _OBJ'CreateWorkstationRec()
Notes
Creates the workstation record if it does not exist and sets the global variable %SYS_UFID for legacy applications
Check for workstation task in SY_Console.M4T.
Syntax
Object'CheckForTask(taskKey)
Parameters
taskKey
(Required) Task Key for the console record
Returns
On success: Returns 1
On failure: Returns 0
Example
Notes
Check if the launcher exists.
Syntax
Object'CheckForLauncher()
Parameters
(none)
Returns
On success: Returns 1
On failure: Returns 0
Example
retVal = %SYS_ss'CheckForLauncher()
Notes
If a Launcher exists this method will fail and set an error message that the Launcher already exists.
Check for exit.
Syntax
Object'CheckForExit()
Parameters
(none)
Returns
On success: Returns 1
On failure: Returns 0
Example
IF coSession'CheckForExit() {
IF coSession'ShutdownAll() {
cShutdownFailed = isFALSE
shutdown = isTRUE
RETURN shutdown
}
}
If the launcher is exited, shut down the system
Notes
Shutdown all Launcher sessions.
Syntax
Object'ShutdownAll()
Parameters
(none)
Returns
On success: Returns 1
On failure: Returns 0
Example
IF coSession'ShutdownAll() {
cShutdownFailed = isFALSE
shutdown = isTRUE
RETURN shutdown
}
Notes
Report error to the error handler.
Syntax
object'WriteLog$(errorType$,errorText$ [,errorCode$,errorProgram$ ,errorLine$])
object'WriteLog(errorKey$,logFile$)
Parameters
errorType$
(Required) Error type:
A Activity
E Error
errorText$
(Required) Text to insert into error log. If NUL, the MSG of the error number will be used
errorCode$
(Optional) Error number encountered in the case of an E errorType
errorProgram$
(Optional) Program where the error was encountered in the case of an E errorType
errorLine$
(Optional) Line number where the error was encountered in the case of an E errorType
errorKey$
(Required) Key used to identify the error log entry which a logfile is to be appended to
logFile$
(Required) File pointer to a log file
Returns
WriteLog$ returns the errorKey$ that can be used to append a logfile if necessary.
Example
e$ = oSSWriteLog$(E,,12,GLWMAA,4505)
The first example creates the log entry and returns its own key.
x = oSSWriteLog(e$,errlog0721.err)
The next line writes the log file back to the activity log for future reference. Log files are created by the error handler and are not mandatory.
Notes
There are two WriteLog methods defined that are used specifically by the error handler exclusively. The new error handler has the ability to write a log file out for each error encountered with the various pieces of data a support analyst would require to debug an issue. To write the log file back to the original activity log record, use the second WriteLog method.
Validates that the file exists and is a ProvideX program.
Syntax
object'CheckForProgram(programName$, [programPath$])
Parameters
programName$
(Required) Program Name
Returns
On success: Returns 1
On failure: Returns 0
Example
result=oSessionObjCheckForProgram(programName$)
Notes
Validates that the file exists and is a ProvideX keyed file.
Syntax
object'CheckForFile(fileName$, path$)
Parameters
fileName$
(Required) File to validate
Returns
On success: Returns 1
On failure: Returns 0
Example
result=oSessionObj’CheckForFile(fileName$)
Notes
Get the current O/S version.
Syntax
object'GetVersion()
Parameters
(none)
Returns
On success: Returns O/S version
On failure: Returns 0
Example
version=oSessionObjGetVersion()
Notes
Uses the Kernel32 DLL GetVersion function
Copy, move, or delete files.
Syntax
object'ProcessFiles(command$)
Parameters
command$
(Required) Command string
Returns
On success: Returns 1
On failure: Returns 0
Example
Notes
Uses the MASEXT32 DLL ProcessFiles function
Get path to windows directory.
Syntax
object'GetWindowsDirectory(windowsDirectory$)
Parameters
windowsDirectory$◄
(Required) Variable to contain the windows directory path
Returns
On success: Returns 1
On failure: Returns 0, raises error
Example
! get windows directory
tmp=oSessionObjGetWindowsDirectory(WinDir$)
-> ? WinDir$
c:\winnt
Notes
Uses the Kernel32 DLL GetWindowsDirectoryA function
Format Date.
Syntax
Object'FormatDate(rawDate$[,formattedDate$,mask$])
Object'FormatDate$(rawdate$,[,mask$ | useDay])
Parameters
rawDate$
(Required) raw date
formattedDate$
(Optional)
formattedDate$ - formatted date
Mask$ - Date mask
useDay not used
mask$
(Optional) date mask
Returns
On success: Returns 1 or formatted date
On failure: Returns 0
Example
coSession'FormatDate(cPostingDate$, formattedDate$)
Format posting date comment field
coSession'FormatDate(NextPeriodEndingDate$,cNextPeriodEndDate$)
AgingDate = JUL( coSession'FormatDate$(cExpectedAsOf$,isTRUE ))
Notes
Get formatted date.
Syntax
Object'GetFormattedDate$(rawDate$[,order$])
Parameters
rawDate$
(Required) raw date
order$
(Optional) indicates which date format constant to use
0 = dateMONTHFIRST
1 = dateDAYFIRST
2 = dateYEARFIRST
Returns
On success: Returns formatted date
On failure: Returns nul
Example
wrk.DateEnd$ = coSession'GetFormattedDate$(dateEnd$,"2")
! "YYYY-MM-DD"
Notes
Get month end.
Syntax
Object'GetCalendarMonthEnd(rawDate$, monthEnd$)
Parameters
rawDate$
(Required) raw date
monthEnd$
(Required) variable that will return the last day of the month
Returns
On success: Returns 1
On failure: Returns 0
Example
coSession'GetCalendarMonthEnd(agingBucketDate$, tmpDate$)
retVal = coSession'GetCalendarMonthEnd (cPeriodStartingDate$,cMonthEnd$)
Notes
Validate that the password meets acceptable minimums per system configuration settings. Also check to see if password has expired (required to change after x days).
Syntax
Object'CheckValidPassword()
Parameters
(none)
Returns
On success: Returns 1
On failure: Returns 0
Example
tmp2 = coSession'CheckValidPassword()
Notes
Wait for PID.
Syntax
Object'WaitForPID(waitPID, timeout)
Parameters
waitPID
(Required) PID
timeout
(Optional) Timeout
Returns
On success: Returns 1
On failure: Returns 0
Example
tmp = coSession'WaitForPID(waitPID)
Notes
Cleanup.
Syntax
Object'Cleanup()
Parameters
(none)
Returns
Returns 0
Example
coSession'CleanUp()
Notes
Cleanup method must be run by the program that instantiates a session object. The session object cannot drop these objects in the ON_DELETE method because of references to the session object within each of these objects that are being dropped.
Object handle to the registration object.
Object handle to the MD registration object.
Object handle to the Local Information object.
IOList of system parameters.
Data for system parameters in IOL format.
IOList of user parameters.
Data for user parameters in IOL format.
IOList of company parameters.
Data for company parameters in IOL format.
IOList of workstation parameters.
Data for workstation parameters in IOL format.
Last GetParameters Module.
Last Getparameters Everest flag.
Last GetParameters IOList.
Last GetParameters Data.
Unified Logon flag set.
Require Passwords flag.
Startup INI file.
SY_Console file handle.
SY_Activation file handle.
List of companies accessed in Session.
Local TERM$ FID.
Terminal control channel.
SY0CTL channel.
List of Modules not to be activated.
Logon attempts this session.
Max number of logon attempts.
Change password in x days.
Legacy date format.
Channel for SY_Module table.
Channel for SY_Company table.
Channel for SY_Context table.
Channel for SY_Task table.
Channel for SY_User table.
Channel for SY_ModuleDate table.
Channel for SY_ActivityLog.
Channel for Sy_Workstation.
Value of the application server spawn property (Sage ERP MAS 200 only).
Module and Company Code used to check if SetModule already run.
List of Security objects created.
Handle to Security Object.
List of Modules that dont need to be registered.
List of Modules with no trial period.
Modules that dont require a company code.
Value to use to filter the Module record from SY_Task.
List of workstation parameters.
Default user.
Administrator.
Best Developer Code.
Payroll prefix.
List of registered modules.
Note ◄ indicates that an argument is an "out" parameter. A value will be stored in the passed variable as part of the method.
GetParameterLegacy(module$,parameter$,value$)
GetParameterLegacy(module$,parameter$,value$,company$)Retrieves module parameters for Legacy modules.
Syntax
_OBJ GetParameterLegacy(module$, parameter$, value$, company$)
Parameters
module$
Module for which the parameter lookup is being requested
parameter$
The name of the parameter for which the value is being requested
value$
Value of the requested parameter to be returned to the calling routine
company$
Optional, Company code for which the module parameter lookup should be performed. If omitted the current company will be used.
Returns
On success: Returns 1
On failure: Returns 0
Example
Notes
This method only works for legacy applications that do not use the embedded dictionary.
Get the security key that will be used to log on to the system when a new program is invoked.
Syntax
_OBJGetSecurityKey(code$)
Parameters
code$
Security key returned to the calling routine
Returns
On success: Returns 1
On failure: Returns 0
Example
Notes
This method will fail if there are no users and the user just added users to the system.
Clears the LastErrorMsg$ and LastErrorNum$ properties.
Syntax
_OBJResetErrorCodes()
Parameters
(none)
Returns
On success: Returns 1
On failure: Returns 0
Example
Notes
Handles special logon cases such as Web access and Business Insights.
Syntax
_OBJ ValidateExternalAccess(user$, password$)
Parameters
user$
User login name being validated
password$
Password being validated
Returns
On success: Returns 1
On failure: Returns 0
Example
Notes
This method will be used when the login name has a leading underscore.