Mas90 Boi v20
Mas90 Boi v20
Object Interface
Contents
Welcome and Introduction..................................................... 1
Prerequisites, Available Resources, and Lab Exercises ........ 2
Support for the Object Interface ............................................ 3
Example Programs................................................................. 4
The ProvideX OLE Server ..................................................... 5
ProvideX OLE Server Methods and Properties..................... 6
ProvideX OLE Server Requirements .................................. 12
Lab - Exercise 1................................................................... 13
The Session Object ................................................................ 14
LastErrorNum and LastErrorMsg Properties ...................... 15
General Properties for Session Information ........................ 16
Path Properties..................................................................... 18
Session Properties for Business Objects.............................. 20
Properties for Instantiated Objects ...................................... 22
Instantiating and Dropping a Session Object ...................... 23
Setting the User ................................................................... 25
Setting the Company ........................................................... 27
Setting the Date ................................................................... 28
Setting the Module .............................................................. 29
Lab - Exercise 2................................................................... 32
Security Overview ................................................................. 34
Instantiating a Security Object ............................................ 35
Properties of the SY_Security Object.................................. 36
Methods of the SY_Security Object.................................... 37
Lab - Exercise 3................................................................... 39
Foundation Class Overview ................................................. 41
User Interface Class Level (UI)........................................... 42
Service Class Level (SVC).................................................. 43
Business Class Level (BUS)................................................ 44
Report Classes (RPT) .......................................................... 45
Lesson 1
Welcome and Introduction
0
1
Welcome to the Object Interface training class. This class is designed to introduce
programmers to the ProvideX OLE server (ProvideX COM) and Sage MAS 90
and 200 Object Interface. This is accomplished by using examples created in both
VBScript and VB.NET, where we show you how to use the Object Interface to
interact with the Sage MAS 90 and 200 database.
This class is intended to meet the following objectives:
• Provide an understanding of the ProvideX OLE server
• Learn about the methods and properties of the Session object
• Learn about the Sage MAS 90 and 200 Security object
• Learn about the properties and methods of the Sage MAS 90 Base Classes
• Provide an overview of the Sage MAS 90 and 200 standards where they apply to
the Object Interface
• Provide example programs
Note: Information in this curriculum pertains to Sage MAS 90 and 200. Although
these programs have a common architecture, some of the features vary depending on
the product implemented. This training curriculum focuses on the features available
in Sage MAS 90.
Prerequisites
An understanding of the following is required in working with the curriculum:
• Sage MAS 90 Data File Structure
• Sage MAS 90 Core Modules
• Object Orientated Programming
• Automation (Interfacing with Applications through COM)
Available Resources
0
Lab Exercises
The lab exercises in this curriculum are presented in VBScript. You can use any text
editor and Internet Explorer version 5 or higher to complete these exercises. This
makes the exercises independent of any one development environment. If you are
using your own development tool and programming language to work through the
exercises, the logic is the same but you must make any necessary syntax changes for
your development environment.
The solutions to the lab exercises are also provided with the course materials in
VisualBasic.net.
Sage Software supports the Sage MAS 90 Foundation Classes, the Sage MAS 90
Business Objects, and the Sage MAS 90 Object Interface.
• ProvideX programming support is available through Sage Software for Master
Developers who are creating modifications to Sage MAS 90 programs only.
• Sage Software cannot support, troubleshoot, debug code, or assist with the design
of programs written in any other programming language.
• The examples provided or demonstrated in this class are provided as is and
without support or warranty.
Example Programs
0
The example programs are created using VBScript and Visual Basic.
• Visual Studio 2003 or higher is required to open the Visual Basic example project
in Visual Studio.
• .Net Framework version 1.1 or higher is required to run the Visual Basic
examples.
The Visual Basic project used with this class is made up of several small programs,
each of which has a specific function.
• For example, one of the programs only initializes the Sage MAS 90 Session,
while another just logs into Sage MAS 90, and still another program sets the Sage
MAS 90 module date.
• This was done to make it easier to focus on key concepts as they are covered in
this class.
• This is not necessarily the design approach used in the real world.
• An application like the examples provided are typically coded in a single
program.
• We cannot suggest how you should design your programs because we are not
familiar with each set of unique business requirements.
Lesson 2
The ProvideX OLE Server
0
2
The ProvideX.Script OLE server allows external applications to directly invoke and
interact with ProvideX and ProvideX objects. You can use the ProvideX.Script OLE
server with virtually any COM compliant application or programming language such
as VB, Delphi, VBScript, and VBA.
The topics in this lesson include:
• ProvideX OLE Server Methods and Properties
• ProvideX OLE Server Requirements
Late Binding
The methods and properties of the MAS 90 objects are accessed with COM using
pure IDispatch interfaces that require the use of late binding.
• VB Script always uses late binding to interface with COM objects.
• Visual Basic can use late binding by insuring that Option Strict Off is set and the
CreateObject function is used.
• C# developers can take advantage of functionality build into the .NET Framework
that enables .NET programmers to perform late binding. A C# example is
included with the example programs to illustrate this.
Data Types
It is important you understand that COM is generally data-type insensitive. You can
access a numeric value as either a string or a number. This causes a problem when
dealing with the ProvideX OLE server because in ProvideX, you can have Cust_no$
and Cust_no as two unique data variables.
• To avoid this problem, the OLE server mandates all property references indicate
the data type in the first character of the property name. This means:
- All references to string properties must have an 's' followed by the property
name
- All numeric properties must have an 'n' followed by the property name
- All integer properties must have an 'i' followed by the property name
- If a property is an object identifier, the property name must have an 'o' prefix
Certified Student Course Curriculum - Version 2.0 Page 7
Copyright © 2008 Sage Software, Inc. All rights reserved.
Sage MAS 90 and 200 Object Interface
When referencing the methods of ProvideX programs, the first character of the
method name must match the data type returned. For example:
returnValue = object.sReturnsStringValue()
returnValue = object.nReturnsNumericValue()
• These data type prefixes are only for use by programs using the OLE server; not
by the ProvideX application itself. This means the property Cust_no$ in ProvideX
is sCust_no when referenced by the OLE server and the property Cust_no in
ProvideX is nCust_no from the OLE server.
• The type prefix is not required for variables passed to and from ProvideX methods
as parameters; however, variables must have their data type implicitly set before
passing them on the parameter list of a ProvideX method. Using Visual Basic for
this example where the ProvideX method accepts one parameter and returns a
string value in that parameter:
Dim myParam As String'Type not known to ProvideX OLE Server
retVal = object.nMethod(myParam)'This will cause an Error 548
Figure 1
• An error similar to one of the above examples occurs because even though
myParam is declared as type String, the ProvideX OLE server is not aware of its
type. This is corrected by making sure the variable is first assigned a String value
before passing as a parameter as follows:
Dim myParam As String = ""
retVal = object.nMethod(myParam)
- Do not use the prefix type in the parameter list of a method call.
- Use of the 'o' prefix allows the specification of properties and/or methods
within ProvideX objects to declare themselves as objects.
PvxScript = CreateObject("ProvideX.Script")
PvxScript.Init(MAS90HomePath)
myPVXObject = PvxScript.NewObject("MyClass")
End Sub
End Class
Figure 2
Lab - Exercise 1
0
The purpose of this lab is to review the information learned in the previous topics and
to provide experience creating and initializing a ProvideX COM object. Complete all
steps in this exercise and accept all defaults unless otherwise instructed.
In this exercise, enter the following VBScript to a .VBS file to create a ProvideX
Script object, initialize the object with a known MAS90\Home directory, and invoke
the NewObject method to create a new Sage MAS 90 Session object. After the Sage
MAS 90 Session object is created, a message box displays the value of one of the
Session object’s properties.
1. Create the ProvideX COM object.
Set oScript = CreateObject("ProvideX.Script")
2. Call the Init method. This requires the path to the MAS90 home directory.
oScript.Init("C:\Program Files\Sage Software\
MAS 90\Version4\MAS90\Home")
3. Create a new Sage MAS 90 Session object using the NewObject method and
return the objects handle in oSS.
Set oSS = oScript.NewObject("SY_Session")
4. Display the value of one of the Sage MAS 90 Session object's properties.
MsgBox(oSS.sPathSystem)
5. Call the CleanUp and DropObject methods to destroy the Session object and
release any ProvideX resources.
oSS.nCleanUp()
oSS.DropObject()
Set oSS = Nothing
Set oScript = Nothing
Lesson 3
The Session Object
0
3
The SY_Session object is the core of the Sage MAS 90 system. It provides methods
and properties all other Sage MAS 90 objects can use. You must create a Session
object before any other Sage MAS 90 Business object is created; a handle to the
Session object is a required parameter when creating any other object. The Session
object also provides access to the Sage MAS 90 Security object, which is also
required before accessing the Sage MAS 90 Business objects.
The topics in this lesson include:
• LastErrorNum and LastErrorMsg Properties
• General Properties for Session Information
• Path Properties
• Session Properties for Business Objects
• Properties for Instantiated Objects
• Instantiating and Dropping a Session Object
• Setting the User
• Setting the Company
• Setting the Module
• Setting the Date
Note: Refer to the Object Reference for the Session object documentation.
Although errors may occur, the user does not get notified of the error directly by the
Sage MAS 90 Session object. Instead, the methods used return a non-zero value
(retSUCCESS) or a zero (retFAILURE). In the event of a retFAILURE, the
LastErrorNum and LastErrorMsg properties of the Session object are set and the user
interface level can use it to display an appropriate error message. Some common error
messages are listed in Appendix C.
Note: All Sage MAS 90 Objects have their own LastErrorNum and LastErrorMsg
properties defined.
..
At the core of the SY_Session object, there are key properties the object maintains.
Most of these properties store information specific about the session started,
including whether the session is running in the Sage MAS 200 environment or from a
Terminal server.
The table below lists the key properties:
Path Properties
0
There are properties used to determine path and file names. When the company or
user logon states are changed, the path properties of the SY_Session object are
automatically updated.
The table below lists the path properties:
There are properties used by the Business objects to communicate company, user, and
module information between the Desktop and the Business object. Many of these
properties were previously a part of SY0CTL.SOA as the TERM$ record.
The table below lists the properties for the Business object:
In addition to the properties from the previous topic listing data-related items, a
number of additional properties are defined to maintain objects the SY_Session object
instantiates. Although the SY_Session object may instantiate many other objects,
only the objects listed below are accessible from outside the SY_Session object.
These objects are specifically exposed because they provide additional functionality
to both the SY_Session object and to other application objects that create a
SY_Session object.
The table below lists the properties for instantiated objects:
There are several ways to establish the user logon in the SY_Session object
depending on the circumstances in which the object is started. How the user is
accessing the system determines which method is used to set the user.
The Logon method is used to set the user. This method is always called when the
Desktop is starting up and handles default situations such as no security being
configured or using the Windows logon.
• The Logon method first checks the UseWindowsLogon and RequirePasswords
flags.
- If the UseWindowsLogon and RequirePasswords flag sare set, the Logon
method fails as the user is required to enter a password before logging on. If
the RequirePasswords flag is not set, the user’s ID is obtained from the
operating system and the Logon method calls the SetUser method and returns
success.
- If the UseWindowsLogon flag is not set and security is not enabled, the Logon
method calls SetUser to log on as the DefaultUser and returns success.
• In the event the Logon method fails, the originating program needs to obtain a
user logon and password from the user and pass them to the SetUser method
before proceeding.
- Because UI is not handled within the SY_Session object, only a retSUCCESS
or a retFAILURE is passed back from this method. You can use the
LastErrorNum and LastErrorMsg properties to get the reason for the failure.
Note: Developers writing external applications integrating to Sage MAS 90 or Sage
MAS 200 without the Desktop must provide their own mechanism to obtain a user
logon and password.
Third-Party Method
Third-party applications logging on to Sage MAS 90 or Sage MAS 200 should make
the following method calls in order to log on:
retVAL = oSS.nLogon()
While retVAL = 0
'
' Logic to get username and password goes here
'
retVAL = oSS.nSetUser(username, password)
Wend
This method ensures the DefaultUser logon (or Windows logon) is used for logon
purposes if no security is configured, (or if Use Windows Logon is specified in
System Configuration).
• If the DefaultUser or Administrator user logons are not used, the SetUser method
then decrypts the password passed into it and compares it with what is stored in
the SY_User.M4T table.
- If the password is invalid, the method returns a retFAILURE and sets the
property LastErrorNum$ to SY_InvalidPassword. The calling program can
display the message that an invalid password was used or return the user back
to the logon prompt.
• Logon attempts are logged and if the password fails, a wait of approximately 3
seconds occurs preventing brute force logon attempts.
• If the logon is successful, the various user variables including paths, user logon,
and user code are set as properties in the SY_Session object. The Library Master
date is set to the system date automatically.
- If the user previously logged on to the system, the last company they accessed
is set using the SetCompany method. Finally, the SessionID$ variable is
defined. This is a somewhat unique variable used for defining temporary and
Crystal Reports work tables.
To access a company using the Business Object Interface, you must configured the
company to allow external access. You can find this setting in Company Maintenance
on the Preferences tab. The default for this setting is turned off.
Setting the company code is relatively straight-forward and is primarily designed to
set company-specific public and private properties of the SY_Session object. After
the company code is read in, the CompanyCode, CompanyKey, and CompanyName
properties are set and the two data paths, PathCompany and PathPayroll, are defined
based on the directory information stored in the company record.
• The SetCompany method takes a required three-character company code and an
optional noChange argument. See examples below.
• The SetCompany method will fail if the company is not configured to allow
external access.
Example 1
In this example, the SetCompany method is called to set the company to the ABC
company and sets the last company field for the user as ABC. If the method fails, it
returns 0 (zero) and the message box displays the Session object’s LastErrorMsg
property for the reason it failed.
retVAL = oSS.nSetCompany("ABC")
If retVAL = 0 Then
MsgBox("Unable to set company ABC" & oSS.sLastErrorMsg)
End If
Example 2
This example sets the noChange parameter which instructs the method not to change
the last company field for the user and also displays the LastErrorMsg on failure.
retVAL = oSS.nSetCompany("ABC", 1)
If retVAL = 0 Then
MsgBox("Unable to set company ABC" & oSS.sLastErrorMsg)
End If
If a date does not exist for the user key, company key, and module code, the
SetModule and SetProgram methods will fail and an error SY_NoDate is returned.
The calling program must set the date for the user, company, and module with the
SetDate method before calling the SetModule method.
• Before calling the SetDate method, you must set up the user and company.
• The SetDate method accepts two arguments, module code and date.
- You can have the module code in the format of XX, X/X, or XXX for three-
character module codes.
- You must have the date in the format of YYYYMMDD and passed as a string.
- The SetDate method name is prefixed with an n because this method returns
an integer value, 1 on success, 0 on failure:
retVAL = oSS.nSetDate("G/L","20050331")
The last method to call before the SY_Session object is fully functional is the
SetModule method. Usually, this method is called as part of the SetProgram method
or within the SY_Launcher/SY_UI objects, so it is not always explicitly called. This
method is probably one of the most complicated as it does a number of checks to
ensure the module accessed is configured properly and returns a number of error
statuses that need checking and handling appropriately.
• The first check performed makes sure the User and Company properties are set in
the SY_Session object. If these properties are not set, the method returns a
SY_NoUserSet or SY_NoCompanySet error, respectively.
• Check registration by creating a SY_Registration object, if it does not already
exist for this session. Registration information is passed into this object for
validation even though the actual data is stored in the SY_System.M4T and
SY_Module.M4T tables. Users can access unregistered modules for 45 days from
the first time they are accessed. There are three possible outcomes to the
registration check.
- Success - The module is registered and all checks come back clean.
- Trial Mode - The module is not registered and is in trial mode. This returns
back a SY_NoRegistration error condition. In this case, the calling program
should display the Trial Mode dialog indicating the module is not registered
and will expire on a given date. To successfully set the module after such a
message, recall the SetModule method with an exclamation point after the
three character module code (for example: A/P!).
- Failure - The module trial period is expired or the record is tampered with. In
this case, the SY_RegExpired error message is returned to the calling
program.
• If the calling program is attempting to change into the same module, return back a
retSUCCESS but set the error number to SY_CurrentModule. The calling
program may want to display a message, but typically, it just ignores this.
• Check activation to ensure the module is activated for the company the user is
currently logged on to. If the module is not activated (data files are created for it),
return a SY_NotActivated error message.
• Get the module date for the module switched to from the SY_ModuleDate.M4T
table. If a date does not exist for this user key, company key, and module code, set
it to today’s date if the AutoSetDate flag is set or return an error SY_NoDate. The
calling program must set the date for the user, company, and module before
proceeding (use the SetDate method for this).
• Check for General Ledger. If General Ledger is not configured, return an error
code SY_NoGeneralLedger.
• Check for a new system or conversion by opening the _Options or 0 table of the
module being accessed. If this is a new system (either the New System flag is not
set or set to Y), set the error code to SY_NewSystem. Because the options record
is opened at this time, also check to see if module conversion is required (v record
in old 0 table). If a conversion is required, set the error code to
SY_NeedToConvert.
• Set the module-specific properties in the SY_Session object.
VBScript Example
The SetModule method accepts a three-character module code as its only argument
(“X/X” for two character module codes, or “XXX” for three character module codes).
In this VBScript example, if the SetModule method fails the Session object’s
LastErrorMsg property displays as the reason for the failure.
retVAL = oSS.nSetModule("G/L")
If retVAL = 0 Then
MsgBox("Unable to set module G/L" & oSS.sLastErrorMsg)
End If
For easy reference, the following table lists all the error codes returned from the
SetModule method.
SY_NoDate A date record does not exist for this module, company,
and user.
SY_NoGeneralLedger The General Ledger module is not activated or
configured for this company.
Lab - Exercise 2
0
The purpose of this lab is to review the information learned in the previous topics and
to provide experience creating and initializing a Sage MAS 90 Session object.
Complete all steps in this exercise and accept all defaults unless otherwise instructed.
In Exercise 1, your VBScript created and initialized a ProvideX Script object, then
invoked the NewObject method to create a new Sage MAS 90 Session object. In this
exercise, add the necessary method calls to initialize the Session object and put it in a
fully functional state, (SetCompany, SetDate, and SetModule). Enter and save the
following VBScript to a .VBS file.
1. Working with the VBScript you created to complete the previous exercise, delete
the following code from steps 4 and 5 of the previous exercise.
MsgBox (oss.sPathSystem)
oSS.nCleanUp()
oSS.DropObject()
Set oSS = Nothing
Set oScript = Nothing
2. Continue by entering the following code at the end of the script. The Logon
method returns 1 if Sage MAS 90 Security is not enabled or if Sage MAS 90 is
configured to use Windows security.
retVAL = oss.nlogon()
3. If the Logon method fails, obtain a user name and password then use the SetUser
method to allow access. In this step, the user is allowed only one attempt to supply
a valid user name and password.
If retVAL = 0 Then
User = Trim(InputBox("Enter User Name"))
Password = Trim(InputBox("Enter Password"))
retVAL = oSS.nSetUser(User,Password)
End If
4. If SetUser fails, display LastErrorMsg for the reason and quit.
If retVAL = 0 Then
MsgBox(oSS.sLastErrorMsg)
oSS.DropObject()
Set oSS = Nothing
WScript.Quit
End If
5. Set the company using the SetCompany() method. This will fail if the company is
not configured to allow external access.
Company = Trim(InputBox("Enter CompanyCode",,_
oSS.sCompany Code))
retVAL = oSS.nSetCompany(Company)
Lesson 4
Security Overview
0
4
All Business objects must have a Security object attached to the Session object or an
error 200 occurs when creating the Business object. When a program is run from Sage
MAS 90, it automatically has this Security object created; however, developers
writing their own interface to Sage MAS 90 Business objects must create a Security
object before instantiating the Business object itself.
The topics in this lesson include:
• Instantiating a Security Object
• Properties of the SY_Security Object
• Methods of the SY_Security Object
The Security object is created by the Session object using the SetProgram method.
SetProgram accepts one numeric argument, a task ID (required), and a second string
argument (optional) in which the name of the program referenced by the task ID is
returned. The task ID is always for the User Interface (UI) object corresponding to the
Business object to run. For example, if your program uses the General Ledger
Account business object (GL_Account_bus), then you must first call the SetProgram
method with the task ID of the General Ledger Account UI object (GL_Account_ui)
before creating a GL_Account_bus object. Note the handle to the Session object must
pass as the second argument to the NewObject method when creating a new Sage
MAS 90 Business object.
retVAL = oSS.nSetProgram(20000001)
BusObj = oScript.NewObject("GL_Account_bus", oSS)
• Sage MAS 90 program and class names all follow this same schema. For
example: GL_Budget_bus and GL_Budget_ui are the General Ledger Budget
Business and User Interface objects.
Note: This is covered later in the Sage MAS 90 Program Naming Standards topic.
You can obtain the task ID for a program using a Session method called LookupTask.
The LookupTask method takes a program name argument and returns the task ID of
that program.
TaskID = oSS.nLookupTask("GL_Account_ui")
You can then pass the returned value of the LookupTask method to SetProgram:
retVAL = oSS.nSetProgram(TaskID)
You can also do this in one step as follows:
retVAL = oSS.nSetProgram(oSS.nLookupTask("GL_Account_ui"))
• If the SetProgram method was successful, it returns a handle to the Security
object, if not it returns 0 (zero). You can access the Security object by using the
Security property of the Session object as displayed in the example below. Note
the Security property is prefixed with a lower case o because it is a property of a
ProvideX class and its data type is Object.
retVAL = oSS.nSetProgram(oSS.nLookupTask("GL_Account_ui"))
If oSS.oSecurity.nCreateAccess = 1 Then ...
• The CreateAccess property returns 1 (one) if the user has create access in the
General Ledger Account Maintenance program and 0 (zero) if the user does not.
The Security object's properties and methods are listed in the following topics.
Note: Refer to the Standard and Utilities Online Reference for the Security object
documentation.
Syntax obj.nCheckSecurityEvent(event)
obj.nCheckSecurityEvent(event, user)
Notes A return value of 1 indicates the user (either the current user or
the specified override user) has the right to perform the specified
security event or module option.
CheckOverrideOptPassword(user$, password$)
Validate the override password/user combination entered into the Allow Future
Postings override dialog. If a valid user/password was entered, then see if the user has
the rights to perform this security event.
Notes A return value of 1 indicates this is a valid user and this user has
rights to perform this security event.
A return value of 0 indicates either the user is invalid, or the user
lacks the right to this security event. In this event,
coSession'LastErrorNum$ and coSession'LastErrorMsg$ is set
for display by the calling program.
This function will be expanded in a future release.
SetToReadOnly( )
Overrides the permissions for the current task to 0 (zero) or Read-Only. This method
is commonly used in inquiry programs to force the maintenance task into a read-only
task. Note this method is irreversable - the task cannot revert back to the original
security setting.
Syntax obj.nSetToReadOnly()
Parameters (none)
Returns Numeric (no value)
Example oSS.oSecurity.nSetToReadOnly()
Notes Sets the rights for the current task to Read-Only. This sets the
following public properties to 0:
CreateAccess, ModifyAccess, DeleteAccess, and UpdateAccess.
The ReadAccess property is set to 1.
Lab - Exercise 3
0
The purpose of this lab is to review the information learned in the previous topics and
to provide experience using the Security object’s methods and properties. Complete
all steps in this exercise and accept all defaults unless otherwise instructed.
In this exercise, create a new Security object to check a security event for the user.
Use the SetProgram method to get a Security object for the GL_Account_ui program
so you can access a GL_Account_bus Business object. The users SecurityAccess
properties are then displayed in a message box. Some of the detail from the previous
examples is omitted only so the new functionality is emphasized. Enter and save the
following VBScript to a VBS file.
1. Working with the VBScript you created to complete the previous exercise, delete
the following code from steps 10 and 11 of the previous exercise.
MsgBox("Current Company: " & oSS.sCompanyName & vbCRLF &
"Company Data Path: " & oSS.sPathCompany & vbCRLF &
"Current Module: " & oSS.sModuleName & vbCRLF & "Module
Date: " & oSS.sModuleDate)
End If
End If
oSS.nCleanUp()
oSS.DropObject()
Set oSS = Nothing
Set oScript = Nothing
2. Continue by entering the code below at the end of the script. Create a new
Security object and use the CheckSecurityEvent method to check if the user has
rights to access private batches.
Set mySecur = oScript.NewObject("SY_Security", oSS, 0)
PrivateBatches = _
mySecur.nCheckSecurityEvent("SE_GLPRIVATEBATCHES")
If PrivateBatches = 1 Then
MsgBox ("Allow this user access to private batches")
End If
3. Use the SetProgram method to create the Security object for the Business object
to run. The LookupTask method returns the TaskID of the program
GL_Account_ui.
retVAL = oSS.nSetProgram(oSS.nLookupTask("GL_Account_ui"))
4. If SetProgram did not fail (the user has access to the Program), create a new
Business object; otherwise, display the LastErrorMsg. The Session object handle
is required when creating a new Business object.
If retVAL = 0 Then
Set oGLAccount = oScript.NewObject("GL_Account_bus", oSS)
Else
MsgBox(oSS.sLastErrorMsg)
End If
5. Display the user’s security access to the Business object.
MsgBox("Read Access:"& CStr(oSS.oSecurity.nReadAccess)& vbCRLF &_
"Create Access:" & CStr(oSS.oSecurity.nCreateAccess)& vbCRLF & _
"Modify Access:" & CStr(oSS.oSecurity.nModifyAccess)& vbCRLF & _
"Delete Access:" & CStr(oSS.oSecurity.nDeleteAccess))
6. Set the user’s security access to Read Only using the SetToReadOnly method.
Display the change in the Security Access properties.
oSS.oSecurity.nSetToReadOnly()
MsgBox("Read Access:"& CStr(oSS.oSecurity.nReadAccess)& vbCRLF &_
"Create Access:" & CStr(oSS.oSecurity.nCreateAccess)& vbCRLF & _
"Modify Access:" & CStr(oSS.oSecurity.nModifyAccess)& vbCRLF & _
"Delete Access:" & CStr(oSS.oSecurity.nDeleteAccess))
End If
End If
mySecur.DropObject()-
oGLAccount.DropObject()-
oSS.DropObject()------
Lesson 5
Foundation Class Overview
0
5
The foundation classes are the building blocks for all the objects in Sage MAS 90 and
200 Version 4.x. These are often referred to as base classes. Most object-based
applications have a foundation class library so common functionality and user
interface standards are adhered to throughout the product. The Sage MAS 90
foundation library consists of classes of these types: Business objects, Service
objects, Report objects, Update objects, and User Interface objects. In this lesson, we
look at the properties and methods of these base classes which are inherited by the
Sage MAS 90 objects accessed through the COM interface.
The topics in this lesson include:
• User Interface Class Level (UI)
• Service Class Level (SVC)
• Business Class Level (BUS)
• Report Classes (RPT)
• Update Classes (UPD)
Note: Refer to the Object Reference for the Foundation Class documentation.
You can access the Sage MAS 90 UI objects through the COM interface using the
Process method. UI objects are instantiated in the same way as a Business object, then
the Process method is invoked which runs the program just as it would run from
within Sage MAS 90. The Process method does not return until the program is closed.
Below is an example of invoking a UI object through COM:
securityOBJ = oSS.nSetProgram(oSS.nLookupTask("GL_Account_ui"))
Set oUIOBJ = oScript.NewObject("GL_Account_ui", oSS)
retVAL = oUIOBJ.nProcess()
The Report object is created by either a module-specific report object (for example,
GL_Report) or the report object itself (for example, SY_RoleReport_rpt) to launch a
Crystal report from a report setting. This object contains methods and properties
needed to launch a Crystal report from a report setting.
Syntax objectHandle.nSetPostingDate(postingDate)
SetPrintComment(value$)
Sets the local cPrintFullComment variable for use during the populate register work
table routine.
Syntax objectHandle.nSetPrintComment(checkBoxValue)
Update( )
Starts the update process. Calls a common program to create future fiscal years and
update beginning balances as necessary. Calls update routines in the register and
update business object: UpdateInit, UpdateMain, and UpdateCleanup.
Syntax objectHandle.nUpdate()
Parameters (none)
Returns On success: retSUCCESS (1)
On failure: retFAILURE (0)
Example retVAL = oPostObject.nUpdate()
ProcessReport(destination$)
Calls the CheckForRestart() method in the register and updates the Business object.
Calls the ProcessReport() method in SY_ReportCommon. Calls the
SetPostingDate(postingDate$) method if necessary.
Syntax objectHandle.nProcessReport(destination)
PrintErrorLog( )
Instantiates error log UI object. Processes print dialogue. Called from SY_UpdateUI
if errors exist.
Syntax objectHandle.nPrintErrorLog()
Parameters (none)
Returns On success: retSUCCESS (1)
On failure: retFAILURE (0)
Example retVAL = oUpdateObj.nPrintErrorLog()
Notes
Lab - Exercise 4
0
The purpose of this lab is to review the information learned in the previous topics and
to provide experience creating a new general ledger account with a subaccount.
Complete all steps in this exercise and accept all defaults unless otherwise instructed.
In this exercise, create a new general ledger account and subaccount using the
GL_SubAccount_bus and GL_Account_bus objects. Enter and save the following
VBScript to a VBS file.
1. Working with the VBScript you created to complete the previous exercise, delete
the following code from steps 5 and 6 of the previous exercise.
MsgBox("Read Access:"& CStr(oSS.oSecurity.nReadAccess) & vbCRLF &
"Create Access:" & CStr(oSS.oSecurity.nCreateAccess) & vbCRLF &
"Modify Access:" & CStr(oSS.oSecurity.nModifyAccess) & vbCRLF &
"Delete Access:" & CStr(oSS.oSecurity.nDeleteAccess))
oSS.oSecurity.nSetToReadOnly()
MsgBox("Read Access:"& CStr(oSS.oSecurity.nReadAccess) & vbCRLF &
"Create Access:" & CStr(oSS.oSecurity.nCreateAccess) & vbCRLF &
"Modify Access:" & CStr(oSS.oSecurity.nModifyAccess) & vbCRLF &
"Delete Access:" & CStr(oSS.oSecurity.nDeleteAccess))
End If
End If
mySecur.DropObject()-
oBUSOBJ.DropObject()-
oSS.DropObject()------
5. Use the SetValue method from the SubAccount Business object to set the values
for the remaining columns SubAccountDesc$, SubAccountShortDesc$, and
Status$.
retVAL = oGLSubAccount.nSetValue("SubAccountDesc$",_
"West Warehouse")
retVAL = oGLSubAccount.nSetValue("SubAccountShortDesc$",_
"WST WRHSE")
retVAL = oGLSubAccount.nSetValue("Status$","A")
6. Use the Write method to write the record to disk.
retVAL = oGLSubAccount.nWrite()
7. If the Write method failed, display the last error message from the GL
SubAccount Business object and quit.
If retVAL = 0 Then
MsgBox (oGLSubAccount.sLastErrorMsg)
oGLSubAccount.DropObject()
oSS.DropObject()
Set oGLSubAccount = Nothing
Set oSS = Nothing
Set oScript = Nothing
WScript.Quit
Else
MsgBox ("Sub Account Write complete ")
End If
8. Use the SetKey method from the GL Account Business object to set the key for
the new general ledger account created.
retVAL = oGLAccount.nSetKey("100-60-05")
9. Use the SetValue method from the GL Account Business object to set the values
for the remaining general ledger account columns.
retVAL = oGLAccount.nSetValue("Account$","100-60-05")
retVAL = oGLAccount.nSetValue("AccountDesc$",_
"Cash - West Warehouse")
retVAL = oGLAccount.nSetValue("RawAccount$","1006005")
retVAL = oGLAccount.nSetValue("MainAccountCode$","100")
retVAL = oGLAccount.nSetValue("Status$","A")
retVAL = oGLAccount.nSetValue("ClearBalance$","N")
retVAL = oGLAccount.nSetValue("AccountType$","01")
retVAL = oGLAccount.nSetValue("CashFlowsType$","C")
retVAL = oGLAccount.nSetValue("AccountGroup$","000")
retVAL = oGLAccount.nSetValue("AccountCategory$","A")
10. Use the Write method to write the record to disk.
retVAL = oGLAccount.nWrite()
Certified Student Course Curriculum - Version 2.0 Page 51
Copyright © 2008 Sage Software, Inc. All rights reserved.
Sage MAS 90 and 200 Object Interface
11. If the GL Account Write failed, display the last error message from the GL
Account Business object.
If retVAL = 0 Then
MsgBox (oGlAccount.sLastErrorMsg)
Else
MsgBox ("Gl Account Write complete - Script Complete")
End If
12. Destroy the Sage MAS 90 Objects using the DropObject method from
ProvideX.Script.
End If
End If
oGLSubAccount.DropObject()
oGlAccount.DropObject()
oSS.nCleanUp()
oSS.DropObject()
13. Clear the object handles.
Set oGLSubAccount = Nothing
Set oGlAccount = Nothing
Set oss = Nothing
Set oScript = Nothing
Lesson 6
Standards Overview
The directory structure, naming standards, and program and file naming standards are
6
covered in detail in the Data File Structures course; however, for reference, a brief
overview is included in this lesson.
The topics in this lesson include:
• Program Naming Standards
• Table Naming Standards
In general, the program names match the primary data file name whenever possible.
The structure of a program name is as follows:
• Module Identifier - The two-character module identifier is used to prefix all
application programs and objects. Programs and objects are placed in their
respective two-character module identifier directory.
• Master Developer Identifier - If the program is maintained by a Master
Developer, following the two-character module identifier, the developer should
insert their three-character Master Developer identifier following the module
identifier. An underscore does not need to preface the Master Developer
identifier.
• Underscore - The underscore follows the module identifier or the Master
Developer identifier, if it exists, but not both.
• Descriptive Name - The descriptive part of the program name is generally the
name of the primary data table.
• Program Type - Objects have a type code indicating what type of object is
created. The following type names are used by Sage MAS 90 objects. Some
objects may combine one or more of these suffixes.
- _bus - Indicates the object is a primary maintenance (business) object
- _svc - Indicates the object is a service object
- _val - Indicates the object is a validation object
- _ui - Indicates the object is a UI object
- _upd - Indicates the object is an updating object
- _rpt - Indicates the object is a reporting object
Sage MAS 90 tables for 4.x programs follow a similar naming standard as used by
Sage MAS 90 programs. The file names consist of the two-character module
identifier, the Master Developer identifier if any, and a descriptive name. The only
distinction between the program name and data file name is the file extension. Sage
MAS 90 data files have an extension of .M4T, while Sage MAS 90 legacy data files
have an extension of .SOA. Data files are stored in a central location (under the
MAS_xxx directory where xxx is the company code).
Lesson 7
Example Programs
0
7
In this lesson, review the example programs provided with this curriculum and point
out some things which might require special consideration when developing your
applications.
The topics in this lesson include:
• Transaction Entry
• General Journal Entry
• General Ledger Budget from Excel
• Sales Order Entry
• Visual Basic .NET Example Programs
The Visual Basic examples include the following, which are launched from a
common window displayed after the Sage MAS 90 Session object is fully initiated:
• Sales Order Entry
• Add General Ledger Accounts with UDFs
• General Journal Entry and posting with UDFs
• Printing the General Journal using the RPT object
• Update the General Journal using the UPD object
• Invoking a Sage MAS 90 UI Object (Source Journal Maintenance)
Note: For documentation purposes, the code examples have numbered lines
referencing the text description of the code. These line numbers are not needed and
are not used in live programs.
Transaction Entry
0
Transaction entry programs having a header and a line/detail panel such as General
Journal Entry or Sales Order Entry, utilize two Business objects. A header Business
object which maintains the header table and a detail Business object which maintains
the detail table.
• The Header object is instantiated and used much the same way as other Business
objects with a couple of key differences.
- When the Header object is instantiated, it instantiates its corresponding detail
object. So it is not necessary to implicitly instantiate the detail object.
- The Header object has a property named Lines which is an object handle to its
Detail object and is used to access the methods and properties of the Detail
object.
Assume both the ProvideX.Script and Sage MAS 90 Session objects are instantiated
and initialized as oScript and oSS respectively, and the user, company and module are
all set. Then we instantiate a General Ledger General Journal Entry Header Business
object (header) and access the General Journal Detail Business object using the
Header object's Lines property.
1. retVAL = oSS.nSetProgram(oSS.nLookupTask("GL_GeneralJournal_ui"))
2. Set oGLJournalEntry = oScript.NewObject("GL_GeneralJournal
_bus",oSS)
3. retVAL = oGLJournalEntry.MoveFirst()
4. retVAL = oGLJournalEntry.oLines.MoveFirst()
5. Set oJrnlLines = oGLJournalEntry.oLines
6. retVAL = oJrnlLines.MoveLast()
1 You must obtain a Security object by calling the SetProgram method with
the Task ID of the UI object before accessing the Business object.
2 The header Business object is instantiated in the same way as other Business
objects, using the NewObject method, passing in the class name of the
Header object, and a reference to the Session object.
3 The Header object's MoveFirst() method is invoked first to set the Header
Key.
4 Invoke the Detail object's MoveFirst() method which sets the pointer to the
first key of the records in the detail table and match the Header Key and
reads the record.
5 Assign the Detail object handle to a variable of type Object.
6 Access the Detail object with that variable. On this line, the Detail object's
MoveLast() method sets the pointer in the detail table to the last key of the
records matching the Header Key.
After SetKey is performed, the HeaderKy$ property of the Detail object is set and any
matching detail records are loaded into a memory file. You can then change, delete, or
create the detail records in the memory file using the detail Business object. The
Detail object only maintains this memory file, any changes are not written to disk
until the Write() method of the Header object is invoked.
The detail records are accessed just like the records of any Business object. You can
browse records using MoveFirst() and MoveNext(). You can also access individual
detail records using the Find() method as follows:
retVAL = oJrnlLines.nMoveNext()
retVAL = oJrnlLines.nFind(keyValue)
Below are the method calls to the General Journal Detail Business object to create a
new detail record for the Header Key set on the previous page and write it to the
Detail Object's memory file.
1. retVAL = oJrnlLines.nAddLine()
2. retVAL = oJrnlLines.nSetValue("AccountKey$","100-00-00",
"kACCOUNT")
3. retVAL = oJrnlLines.nSetValue("PostingComment$","Debit Amount")
4. retVAL = oJrnlLines.nSetValue("DebitAmount", 200)
5. retVAL = oJrnlLines.nWrite()
Similar logic is repeated for each of the new detail lines to create. To write the header
and any new or changed detail records to disk, the Write() method of the Header
object is invoked as follows:
retVAL = oGLJournalEntry.nWrite()
Note: Refer to Appendix A for a complete documented listing of the General Journal
Entry example.
The GL Period Budget Detail Business object is used in this example to retrieve
original and revised budget data from an Excel spreadsheet using the Excel COM
object. The account number and fiscal year information for the budget data is also
retrieved from Excel. This information is used by the GL Period Budget Detail
Business object to enter the period budget debit and credit amounts into the
GL_PeriodBudgetDetail.M4T table.
Note: Refer to Appendix A for a complete documented listing of this example.
Listed below are unique key points to using the Sage MAS 90 Business objects in this
example. The requirements are:
• The ABC company demo data which has original budget data for the fiscal year
2010.
• The GLbudgetreport.xls Excel spread sheet is available with the class downloads.
• The GLbudgetreport.xls file must be in this location on the workstation running
the example: C:\Temp\GLbudgetreport.xls.
The first issue encountered was the required Business object does not have a like-
named corresponding UI object to reference in the SetProgram() call. In these cases,
SetProgram needs to reference another or similar UI object from the same module for
which security is set appropriately to enable the Business object to perform the
required tasks. In this program and as shown below, we passed the task ID for
GL_BudgetMaintenance_ui then instantiated the GL_PeriodBudgetDetail_bus
Business object.
retVAL = oSS.nSetProgram(oSS.nLookupTask("GL_BudgetMaintenance
_ui"))
Set oGLBudget = oScript.NewObject("GL_PeriodBudgetDetail_bus",
oSS)
The next consideration was the general ledger account numbers supplied by the
source data are fully formatted account numbers. This is an issue because the
AccountKey$ column in the budget detail records requires the nonformatted account
number.
To solve this, we used the GL_Account service object to access the GL_Account
record by the supplied formatted account number (Account$ column), then we can
retrieve the nonformatted account number (AccountKey$ column) to use with the
budget SetKeyValue() method.
1. Set oGLService = oScript.NewObject("GL_Account_svc", oSS)
2. retVAL = oGLService.nSetIndex("kACCOUNT")
3. retVAL = oGlService.nFind(fmtAccount)
4. Dim Record As String = ""
5. Dim IOList As String = ""
6. retVAL = oGLService.nGetRecord(Record,IOList)
7. Dim Columns() As String
8. Columns = Split(Record,Chr(138))
9. AccountKey = Columns(0)
1 Instantiate a GL_Account Service object and set the object handle in the
variable oGLService.
2 Set the current index of the service object to kACCOUNT. By default the
index is kPRIMARY, which is not the formatted account number.
3 Find the GL_Account using the formatted account key from the source
data.
4 Declare variable as string and assign its value so it passes as a parameter.
5 Same as line 4.
6 The GetRecord() method returns the data of the current record set on line 3.
The data is returned in the first parameter and the columns are separated by
Chr(138), which is the default ProvideX field separator. The record's IO
List is returned in the second parameter.
7 Declare a String array to contain the current record's columns.
8 Use the VB Split function to store the individual column values into
elements of an array. Specify Chr(138) as the delimiter.
9 The nonformatted AccountKey$ is the first column accessed from the first
element of the array.
10 The key value can now be set for the AccountKey$ with the value of the
first column returned by the GetRecord() method.
The following is an example of the same basic logic used to create a new sales order
using the Sales Order Business object:
1. oSS.nSetProgram(oSS.nLookupTask("SO_SalesOrder_ui"))
2. oSOOrder = oScript.NewObject("SO_SalesOrder_bus", oSS)
3. oSOOrder.nGetNextSalesOrderNo(NextOrderNo)
4. oSOOrder.nSetKeyValue("SalesOrderNo$", NextOrderNo)
5. oSOOrder.nSetKey()
6. oSOOrder.nSetValue("ARDivisionNo$", "02")
7. oSOOrder.nSetValue("CustomerNo$", "ORANGE")
8. oSOOrder.oLines.nAddLine()
9. oSOOrder.oLines.nSetValue("ItemCode$", "D2000")
10. oSOOrder.oLines.nSetValue("QuantityOrdered", 2)
11. oSOOrder.oLines.nWrite()
12. oSOOrder.nWrite()
1 SetProgram with the Task ID of the UI object before accessing the Business
object.
2 Create a new SO_SalesOrder_bus object oSOOrder as the object handle.
3 GetNextSalesOrderNo() returns the next automatic sales order number.
4 The header key is set to the number returned by GetNextSalesOrderNo().
5 Set the file pointer of the Header table. The key does not exist so a new
record is created.
6 Set the value of ARDivisionNo$ to 02.
7 Set the value of CustomerNo$ to ORANGE.
8 Create a new detail line for this header.
9 Set the value of the detail line ItemCode field to D2000.
10 Set the value of the detail line QuantityOrdered field to 2.
11 The Detail Object's Write() method writes the new detail record to the
memory file.
12 The Header Object's Write() method writes the header and any new or
changed detail records to disk.
The Visual Basic example programs were developed in Visual Studio .Net, using
Visual Basic 2003. Version 1.1 of the .Net Framework is required to run the example.
The following is an example of the required code in VB needed to instantiate a
Sage MAS 90 Session object:
Public Class Form1
Inherits System.Windows.Forms.Form
3. oScript = CreateObject("ProvideX.Script")
4. oScript.Init("C:\Program Files\Sage\MAS90\HOME")
5. oSS = oScript.NewObject("SY_Session")
End Sub
End Class
The following is a listing of the StartUpModule.vb program with the key statements
numbered. The numbered statements are documented in the table after the listing.
Imports System.Text
Module StartUpModule
1. Public oScript
2. Public oSS
3. Public CompanyDLG As New MAS90_Company()
4. Public LogonDLG As New MAS90_Logon()
5. Public DateDLG As New MAS90_Date()
6. Public retVAL As Integer
Sub Main()
Do
11. LogonDLG.ShowDialog()
12. If LogonDLG.DialogResult=DialogResult.Cancel Then GoTo CLEANUP
13. Loop Until CBool(oSS.nSetUser(LogonDLG.UserName.Text,
LogonDLG.Password.Text))
End If
CLEANUP:
18. oSS.nCleanUp()
19. oSS.DropObject()
oSS = Nothing
oScript = Nothing
End Sub
End Module
Figure 3
• The function of this program is to launch the various VB example programs when
the user clicks the buttons. When one of the buttons is clicked, the SetSession()
function is called to set up the Session to run the example program.
• The Session is set up by making calls to the SetModule(), SetModuleDate, and
SetProgram methods to set these Session properties to an appropriate value.
- If SetSession() is successful, the example program is launched and because
the session is already set up for the program being launched, all this program
has to do is create the Business object and start using it.
- The Session properties displayed on this window (path, company, and user)
are also kept current by the MAS90_Examples.vb program.
• When MAS90_Examples.vb is closed, the StartUpModule.vb program resumes to
destroy the Session object and clean up.
MAS90_Examples.vb Listing
The following Form_Load logic just displays the Session properties initially set in the
StartUpModule.vb program. (Path, Company, User, Module, and Date).
Public Class MAS90_Examples
Inherits System.Windows.Forms.Form
1 Display the caption, company, and date properties in the Title Bar.
2 Display path to Sage MAS 90.
3 Display the name of the current company.
4 Display the user name.
5 Display the name of the current module.
6 Display the module date.
This is the SetSession() logic which sets up the session for each of the example
programs launched from the buttons on the MAS90_Examples.vb window. It requires
the use of the module code and the UI program name of the Business object in the
example to be passed as parameters.
• If this function succeeds, then the module and date displayed on the window are
updated and the example program is launched.
• If this function fails, then the LastErrorMsg property displays, the module is set
back to Library Master, and the program does not launch.
Private Function SetSession(ByVal Module, ByVal ProgramName)
1. If (CBool(oSS.nGetModuleInfo(Module, tmpModuleName,
ExpirationDate))) Then
2. TaskID = oSS.nLookupTask(ProgramName)
3. If TaskID <> 0 Then
4. If Not (CBool(oSS.nGetDate(ModuleCode, MASDate))) Then
5. DateDLG.Label1.Text = "Select date for " &
tmpModuleName
6. DateDLG.ModuleDate.Text = oSS.sFormatDate
((oSS.sModuleDate))
7. DateDLG.ShowDialog()
8. If Not (DateDLG.DialogResult=DialogResult.Cancel) Then
9. MASDate = DateDLG.ModuleDate.Text
End If
End If
10. If MASDate = "" Then Return False
End If
End If
End If
End If
End If
17. MessageBox.Show(oSS.sLastErrorMsg)
18. oSS.nSetModule("SYS")
19. Return False
End Function
End If
End Sub
AddAccount.vb
The BT_AddAccount_Click() method launches the AddAccount.vb program.
AddAccount.vb uses the G/L Account Business object to maintain account records
and it uses a Report object to run the General Ledger Chart of Accounts report. This
example also demonstrates how to work with user-defined fields (UDFs) and tables
(UDTs) defined in the Sage MAS 90 Customizer module. The information needed, if
you want to set up the UDFs and UDTs so this part of the example works, is included
later in this curriculum.
Public Class AddAccount
Inherits System.Windows.Forms.Form
Try
4. oBusObjB = oScript.NewObject("GL_Account_bus", oSS)
Catch
5. MessageBox.Show(oSS.sLastErrorMsg)
Exit Sub
End Try
Try
' Get an object handle for the Project UDF child object
6. oProjSvc = oBusObjB.oGetChildHandle("UDF_PROJECTCODE")
Catch ex As Exception
' If this fails the Project UDF/UDT setup is not present
lblProjDesc.Text = "Project UDF/UDT setup is not present"
7. UDFSetup = False
End Try
End Sub
8. oBusObjB.nMoveFirst()
9. Call SetFields()
End Sub
8. oBusObjB.nMovePrevious()
9. Call SetFields()
End Sub
8. oBusObjB.nMoveNext()
9. Call SetFields()
End Sub
8. oBusObjB.nMoveLast()
9. Call SetFields()
End Sub
End Sub
15. oBusObjB.nClear()
9. Call SetFields()
12. lblNewRecord.Text = ""
12. txtDescription.Enabled = False
12. txtProject.Enabled = False
12. txtMainAccount.Enabled = True
End Sub
End Sub
If retVAL = 0 Then
17. MessageBox.Show(oBusObjB.sLastErrorMsg)
End If
18. btnClear.PerformClick()
End Sub
If retVAL = 0 Then
17. MessageBox.Show(oBusObjB.sLastErrorMsg)
lblProjDesc.Text = ""
End If
End Sub
20. retVAL=oBusObjB.nSetValue("UDF_ProjectCode$",txtProject.Text)
If retVAL = 0 Then
17. MessageBox.Show(oBusObjB.sLastErrorMsg)
lblProjDesc.Text = ""
Else
End Sub
End Sub
27.oBusObjB.DropObject()
28.If UDFSetup Then oProjSvc.DropObject()
oBusObjB = Nothing
oProjSvc = Nothing
End Sub
End Class
1
Appendix
The following topics are included in this Appendix:
• Appendix A - Example Program Listings and Documentation
• Appendix B - UDF / UDT Setup for Example Programs
• Appendix C - Message Library Reference
• Appendix D - Sage MAS 90 Security Events and Module Options
15 Set the Sage MAS 90 company using the method from the Session object
16 Set the module date using the method from the Session object
17 Set the Sage MAS 90 module using the method from the Session object
18 Set the Sage MAS 90 program by Task ID using the method from the
Session object. This method also creates a Security object for the program
to run. If no Security object is created, the program cannot run
19 Set the Object handle to the General Journal Business object
20 Set the Object handle to the General Journal Detail Business object for
handling the line entry for the transaction
21 Set the Object handle to the Source Journal Service object
22 Use the SetKeyValue Method in the General Journal Business object to set
the Key Column value for the Source Journal to Accounts Payable used in
this transaction
23 Assign a string value to the variable used to accept an entry number from
the GetNextJournalNo ( ) method
24 Use the GetNextJournalNo method in the Source Journal Service object to
assign the next available General Journal Entry number
25 Use the SetKeyValue method in the General Journal Business object to set
the Key Column value for the Entry Number used in this transaction
26 Use the SetKey method in the General Journal Business object to set the
key based on the values assigned by the SetKeyValue method calls
27 Use the SetValue method in the General Journal Business object to set the
value for the PostingDate column
28 Use the SetValue method in the General Journal Business object to set the
value for the JournalComment column
29 Use the AddLine method in the General Journal Detail Business object to
create a new line
30 Use the SetValue method in the General Journal Detail Business object to
set the value for the AccountKey column
31 Use the SetValue method in the General Journal Detail Business object to
set the value for the PostingComment column
32 Use the SetValue method in the General Journal Detail Business object to
set the value for the Debit Amount column
33 Use the Write method in the General Journal Detail Business object to
write the line to the memory file
34 Use the Add method in the General Journal Detail Business object to create
a new line
35 Use the SetValue method in the General Journal Detail Business object to
set the value for the AccountKey column
36 Use the SetValue method in the General Journal Detail Business object to
set the value for the Posting Comment column
37 Use the SetValue method in the General Journal Detail Business object to
set the value for the Credit Amount column
38 Use the Write method in the General Journal Detail Business object to write
the line to the memory file
'Write Header
39. retVAL = oGLJournalEntry.nWrite()
39 Use the Write method in the General Journal Business object to write the
header record and the detail records to disk
40 Test the return value of the Write method to take appropriate action
41 If the Write method failed, display the LastErrorMsg property of the
Business object
42 Display a message box that the write was successful
43. oGLJournalLines.DropObject()
44. oGLJournalEntry.DropObject()
45. oGLSJObject.DropObject()
46. oSS.nCleanUp()
47. oSS.DropObject()
15 Set the Sage MAS 90 company using the method from the Session object
16 Set the Sage MAS 90 module date using the method from the Session
object
17 Set the Sage MAS 90 module using the method from the Session object
18 Set the Sage MAS 90 program by Task ID using the method from the
Session object. This method also creates a Security object for the program
to run. If no Security object is created, the program cannot run
19 Test the return value of SetProgram( ) to take appropriate action
20 If SetProgram( ) fails, display the Session object’s last error
21 Quit
22 Create a new General Journal Period Budget Detail Business object
23 Create a new General Journal Service object
24 Use the SetIndex method from the General Journal Service object to set the
index for the table, default index is always kPRIMARY
39 Find the surrogate key in the Sage MAS 90 GL_Account table for the
formatted general ledger account from the spreadsheet
40 Assign a string value to the variable to set its data type before using it to
receive a string value from the GetRecord( ) method
41 Assign a string value to the variable to set its data type before using it to
receive a string value from the GetRecord( ) method
42 Use the GetRecord method from the General Journal Service object to
retrieve the record for the account
43 Clear the temporary Account Key variable
44 Assign the surrogate key from the record retrieved by GetRecord to the
temporary Account Key variable
45 Assign the temporary Account Key to the Account Key variable
46 Use the SetKeyValue method in the General Journal Period Budget Detail
Business object to set the Key Column value for the surrogate Account Key
47 Use the SetKeyValue method in the General Journal Period Budget Detail
Business object to set the Key Column value for the budget code
48 Use the SetKeyValue method in the General Journal Period Budget Detail
Business object to set the Key Column value for the fiscal year
49 Use the SetKeyValue method in the General Journal Period Budget Detail
Business object to set the Key Column value for the fiscal period
50 Use the SetKey method in the General Journal Period Budget Detail
Business object to set the Key for the Budget record for this account
51 Test the value of the amount assigned from the Excel spreadsheet and take
appropriate action. If the amount in tmpAmount is greater than zero, the
amount is a debit. If the amount is less than zero, the amount is a credit
52 Use the SetValue method from the General Journal Period Budget Detail
Business object to assign the debit amount
53 Use the SetValue method from the General Journal Period Budget Detail
Business object to assign the credit amount
54. retVAL=oGLBudget.nWrite()
55.-If TmpFiscalPeriod ="12" Then oGLBudget.nSetKeyValue_
("AccountKey$", "")
----End If
54 Use the Write method from the General Journal Period Budget Detail
Business object to write the Budget record for this period
55 If the fiscal period is period 12, clear the Account Key value to release the
lock and update the Fiscal Period one values
62 Find the surrogate key in the Sage MAS 90 GL_Account table for the
formatted general ledger account from the spreadsheet
63 Assign a string value to the variable to set its data type before using it to
receive a string value from the GetRecord( ) method
64 Assign a string value to the variable to set its data type before using it to
receive a string value from the GetRecord( ) method
68 Use the GetRecord method from the General Journal Service object to
retrieve the record for the account
66 Clear the temporary Account Key 2 variable
67 Assign the surrogate key from the record retrieved by GetRecord to the
temporary Account Key 2 variable
68 Assign the temporary Account Key to the Account Key 2 variable
69 Use the SetKeyValue method in the General Journal Period Budget Detail
Business object to set the Key Column value for the surrogate Account Key
70 Use the SetKeyValue method in the General Journal Period Budget Detail
Business object to set the Key Column value for the budget code
71 Use the SetKeyValue method in the General Journal Period Budget Detail
Business object to set the Key Column value for the fiscal year
72 Use the SetKeyValue method in the General Journal Period Budget Detail
Business object to set the Key Column value for the fiscal period
73 Use the SetKey method in the General Journal Period Budget Detail
Business object to set the Key for the Budget record for this account
74 Test the value of the amount assigned from the Excel spreadsheet and take
appropriate action. If the amount in tmpAmount is greater than zero, the
amount is a debit. If it is less than zero, the amount is a credit.
75 Use the SetValue method from the General Journal Period Budget Detail
Business object to assign the debit amount
76 Use the SetValue method from the General Journal Period Budget Detail
Business object to assign the credit amount
77 Use the Write method from the General Journal Period Budget Detail
Business object to write the Budget record for this period
78 If the fiscal period is period 12, clear the Account Key value to release the
lock and update the Fiscal Period one values
90. oGLBudget.DropObject()
91. oGLService.DropObject()
92. oSS.nCleanup()
93. oSS.DropObject()
28. oSS.DropObject()
29. oSS = Nothing
30. oScript = Nothing
31. End Sub
32. End Module
MAS90_Examples.vb source
1.Public Class MAS90_Examples
2.Inherits System.Windows.Forms.Form
1 MAS90_Examples - MAS90_Examples.vb
2 Inherits Windows.Forms class
3 Begin Form_Load sub, logic executed before the form displays
4 Sets the Title Bar text to the value of the Session properties
5 Sets the Company text box to the value of the CompanyName property
6 Sets the UserName text box to the value of the UserName property
7 Sets the ModuleName text box the value of the ModuleName property
8 Sets the ModuleDate text box to the value of the ModuleDate property
9 End of Form_Load sub
1. If (CBool(oSS.nGetModuleInfo(Module, tmpModuleName,
ExpirationDate))) Then
2. TaskID = oSS.nLookupTask(ProgramName)
3. If TaskID <> 0 Then
4. If Not (CBool(oSS.nGetDate(ModuleCode, MASDate))) Then
5. DateDLG.Label1.Text = "Select date for " &
tmpModuleName
6. DateDLG.ModuleDate.Text = oSS.sFormatDate(
(oSS.sModuleDate))
7. DateDLG.ShowDialog()
8. If Not (DateDLG.DialogResult=DialogResult.Cancel) Then
9. MASDate = DateDLG.ModuleDate.Text
End If
End If
10. If MASDate = "" Then Return False
11. If (CBool(oSS.nSetDate(ModuleCode, MASDate))) Then
12. If (CBool(oSS.nSetModule(ModuleCode))) Then
13. If (CBool(oSS.nSetProgram(TaskID))) Then
14. ModuleName.Text = oSS.sModuleName
15. ModuleDate.Text = oSS.sFormatDate(_
(oSS.sModuleDate))
16. Return True
End If
End If
End If
End If
End If
17. MessageBox.Show(oSS.sLastErrorMsg)
18. oSS.nSetModule("SYS")
19. Return False
End Function
Else
End If
End Sub
End If
End If
End Sub
Else
7. oSS.sLastErrorMsg = ""
Do
8. LogonDLG.ShowDialog()
9. If LogonDLG.DialogResult = DialogResult.Cancel Then Exit Do
10. ret = oSS.nSetUser(LogonDLG.UserName.Text, LogonDLG
.Password.Text))
11. Loop Until ret = 1
12. UserName.Text = oSS.sUserName
End If
End Sub
End If
End Sub
End If
End Sub
End If
End Sub
End If
End Sub
End If
End Sub
MAS90_Company.vb source
1. Public Class MAS90_Company
2. Inherits System.Windows.Forms.Form
(Windows Form Designer generated code)
3. Private Sub Form_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
4. CompanyDLG.Text = oSS.sCaption & " Select Company"
5. CompanyDLG.Company.Items.Clear()
6. CompanyDLG.Company.Text = oSS.sCompanyCode & " (" &
oSS.sCompanyName & ")"
7. CompanyDLG.Company.Items.AddRange(Split(oSS.sCompanyList,
Chr(138)))
8. End Sub
MAS90_Date.vb source
1. Public Class MAS90_Date
2. Inherits System.Windows.Forms.Form
(Windows Form Designer generated code)
3. Private Sub Ok_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Ok.Click
4. Dim AccDate As Date
5. Try
6. AccDate = CType(ModuleDate.Text, Date)
7. Catch
8. ModuleDate.Text = ""
9. Exit Sub
10. End Try
11. ModuleDate.Text = AccDate.Year & _
AccDate.Month.ToString.PadLeft(2, "0") & _
AccDate.Day.ToString.PadLeft(2, "0")
12. End Sub
13. Private Sub Cancel_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Cancel.Click
14. ModuleDate.Text = ""
15. End Sub
16. End Class
MAS90_Logon.vb source
1. Public Class MAS90_Logon
2. Inherits System.Windows.Forms.Form
(Windows Form Designer generated code)
3. Private Sub Form_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
4. AddHandler UserName.Enter, New System.EventHandler_
(AddressOf UserName_Enter)
5. AddHandler Password.Enter, New System.EventHandler_
(AddressOf Password_Enter)
6. Me.Text = oSS.sCaption & " Logon"
7. Me.UserName.Text = ""
8. Me.Password.Text = ""
9. Me.LastErrorMsg.Text = oSS.sLastErrorMsg
10. End Sub
11. Private Sub UserName_Enter(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles UserName.TextChanged
12. LastErrorMsg.Text = ""
13. End Sub
14. Private Sub Password_Enter(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Password.TextChanged
15. LastErrorMsg.Text = ""
16. End Sub
17. End Class
SalesOrderEntry.vb source
1. Public Class SalesOrderEntry
Inherits System.Windows.Forms.Form
Private MyDataTable As DataTable
2. Dim oSOOrder As Object
'Initialize Order Form and load Division and Item combo boxes
6. FormatDataGrid()
7. GetDivisionList()
8. GetCIItems()
9. ResetOrderForm()
End Sub
End Sub
End Sub
End If
End Sub
cboShipTo.Items.Clear()
'Skip this if multiple ship to codes do not exist for this customer
If CBool(Len(ShipToCodes)) Then
For i = 0 To ShipToCount
37. ..cboShipTo.Items.Add(ShipToCodeArray(i) &"-"&
ShipToNameArray(i))
Next
cboShipTo.Enabled = True
End IF
End Sub
End If
End If
49. MessageBox.Show(oSOOrder.sLastErrorMsg)
End Sub
Else
54. MessageBox.Show(oSOOrder.sLastErrorMsg)
End If
End Sub
Else
63. MessageBox.Show(oSOOrder.sLastErrorMsg)
End If
End Sub
End Sub
End Sub
Try
Catch ex As Exception
End Sub
'set the value for the ItemCode field of the new line record
84. If CBool(oSOOrder.oLines.nSetValue("ItemCode$",cboItems.Text))
Then
'set the value for the QuantityOrdered field of the new line
record
85. If CBool(oSOOrder.oLines.nSetValue("QuantityOrdered", _
QuantityOrdered)) Then
'get desc, price, and extended amt for display in the grid
Dim ItemCodeDesc As String = ""
86. ...oSOOrder.oLines.nGetValue("ItemCodeDesc$", ItemCodeDesc)
Dim UnitPrice As Decimal = 0
87. ...oSOOrder.oLines.nGetValue("UnitPrice", UnitPrice)
Dim ExtensionAmt As Decimal = 0
End If
End If
End If
End If
93. MessageBox.Show(oSOOrder.oLines.sLastErrorMsg)
End If
End Sub
'delete the line by the key stored in the current row of the grid
95. Dim LineKey As String = Trim(dgOrderDetail.Item(dgOrderDetail.
CurrentRowIndex, 5))
96. If CBool(oSOOrder.nDeleteLine(LineKey)) Then
Else
100. MessageBox.Show(oSOOrder.sLastErrorMsg)
End If
End Sub
End Sub
End Sub
Else
115. MessageBox.Show(oSOOrder.sLastErrorMsg)
End If
End Sub
109 Recalculate sales tax for the current items entered into the sales order. This
method is only called to update the totals displayed on the window
110 Get the value of the TaxableAmt field, display it on the window, and add it
to the OrderTotal variable
111 Get the value of the NonTaxableAmt field, display it on the window, and
add it to the OrderTotal variable
112 Get the value of the SalesTaxAmt field, display it on the window, and add it
to the OrderTotal variable
113 Get the value of the FreightAmt field, display it on the window, and add it
to the OrderTotal variable
114 Display the OrderTotal on the window
115 If SalesTaxReCalculation failed, display LastErrorMsg for reason
116 Get the value of BillTo/ShipTo Name from the current Sales Order header
record
117 Get the value of BillTo/ShipTo Address line 1 from the current Sales Order
header record
118 Get the value of BillTo/ShipTo Address line 2 from the current Sales Order
header record
119 Get the value of BillTo/ShipTo Address line 3 from the current Sales Order
header record
120 Get the value of BillTo/ShipTo City from the current Sales Order header
record
121 Get the value of BillTo/ShipTo State from the current Sales Order header
record
122 Get the value of BillTo/ShipTo Zip Code from the current Sales Order
header record
End Sub
End Function
123 Function accepts the numeric return value of a Sage MAS 90 method and
the handle of the Sage MAS 90 object
124 If the method returns zero, the LastErrorMsg of the object displays
125 The function returns the return value of the method
127. oSOOrder.DropObject()
128. oSOOrder = Nothing
---End Sub
AddAccount.vb source
1. Public Class AddAccount
.......Inherits System.Windows.Forms.Form
(Windows Form Designer generated code)
.......'
2. Dim oBusObjB As Object
3. Dim oProjSvc As Object
........End Sub
29. oBusObjB.nReadAdditional("UDF_ProjectCode")
30. oProjSvc.nGetValue("UDF_ProjectDesc$", lblProjDesc.Text)
....End Sub
21 Begin SetFields sub, to get and display the values of the current row's
columns
22 Declare AccountCode as String assign it a value (null) so it is typed
23 Declare AccountDesc as String assign it a value (null) so it is typed
24 Call the Business object's GetValue method, return value of the
AccountDesc column
25 Call the Business object's GetValue method, return value of the Account
column
26 Call Business object's GetValue method, return value of the
UDF_ProjectCode column
27 Assign the value of AccountCode to the txtMainAccount text box
28 Assign the value of AccountDesc to the txtDescription text box
29 Do additional reads with the UDF_ProjectCode Child Collection
30 The Child object's GetValue method returns value of UDF_ProjectDesc and
assigns it to the llbProjDesc text label
........End Sub
35 Begin TestNew sub, checks if the current record is new and changes the
form to match
36 The SetKey method returns 1 if the key was found and 2 if it is a new key
37 If SetKey returns zero if it fails validation ...
38 Display LastErrorMsg for reason of failure
39 Select Case of the SetKey return value
40 Case 1 – (EditState = edtExists)
41 Blank out the New Record text label on the form
42 Call SetFields to get and display record
43 Case 2 – (EditState = edtNew)
44 Set the New Record text label on the form to "New Record" to indicate
new record
45 Call SetFields to set any default values and display them on the form
....End Sub
....End Sub
....End Sub
55 Begin txtProject_Leave sub; when the txtProject Text Box looses focus
56 Set the UDF_ProjectCode column value to the value of the txtProject Text
box
57 If the SetValue method fails, it returns 0 (zero)
58 Display the LastErrorMsg property for reason of failure
59 Blank the text displayed in the txtProjectDesc Text Label
60 Set the txtProjectDesc Text Label with the value of the UDF_ProjectDesc
column
70. oRpt.DropObject()
............oRpt = Nothing
....End Sub
JournalEntry.vb source
1. Public Class JournalEntry
.......Inherits System.Windows.Forms.Form
(Windows Form Designer generated code)
'string to contain batch number for processing
2. Private strBatchNo As String = ""
'data table bound to data grid for lines
3. Private MyDataTable As DataTable
4. Private colAccount As New DataGridTextBoxColumn()
5. Private WithEvents cboAccount As New ComboBox()
'init controls
11. txtBalance.Text = "0"
12. txtCredit.Text = "0"
........13. txtDebit.Text = "0"
...End Sub
# Private Sub SetcboAccount() ... You can view the SetcboAccount routine
from the JournalEntry.vb source file; it is not documented here because it
does not contain any code specific to the ProvideX OLE Server or Sage
MAS 90
........End Sub
........End Function
35. retVAL =
oSS.nSetProgram(oSS.nLookupTask("GL_GeneralJournal_ui"))
36. If retVAL = 0 Then
37. MessageBox.Show(oSS.sLastErrorMsg)
............... End If
................Try
38. oGLJrnl = oScript.NewObject("GL_GeneralJournal_bus",
oSS)
................Catch
39. MessageBox.Show(oSS.sLastErrorMsg)
................End Try
40. oGLJrnlLines = oGLJrnl.oLines
................Try
41. oSJObj = oScript.NewObject("gl_SourceJournal_svc",
oSS)
................Catch
42. MessageBox.Show(oSS.sLastErrorMsg)
................End Try
70. oGLJrnl.nAddLine()
88. oSJObj.DropObject()
89. oGLJrnlLines.DropObject()
90. oGLJrnl.DropObject()
....oSJObj = Nothing
....oGLJrnlLines = Nothing
....oGLJrnl = Nothing
......End If
...End Sub
If retVAL = 0 Then
94. MessageBox.Show(oSS.sLastErrorMsg)
Exit Sub
End If
.....Try
95. oGLPost = oScript.NewObject("GL_GeneralJournal_upd", oSS)
.....Catch
96. MessageBox.Show(oSS.sLastErrorMsg)
.....End Try
109. oGLPost.DropObject()
.....oGLPost = Nothing
.....End Sub
115. cboJournal.Items.Clear()
116. retVAL =
oSS.nSetProgram(oSS.nLookupTask("GL_SourceJournal_ui"))
117. If retVAL = 0 Then
118. MessageBox.Show(oSS.sLastErrorMsg)
............Exit Sub
..............End If
..............Try
119. oGLSrcJrnlSrvcObj = oScript.NewObject("gl_SourceJournal_svc",
oSS)
..............Catch
120. MessageBox.Show(oSS.sLastErrorMsg)
..............End Try
121. oGLSrcJrnlSrvcObj.nGetResultSets("SourceJournal$",_
"SourceJournal$", strResults, strJunk, "", "", "")
122. MyArray = Split(strResults, Chr(138))
123. cboJournal.Items.AddRange(MyArray)
124. oGLSrcJrnlSrvcObj.DropObject()
.............oGLSrcJrnlSrvcObj = Nothing
........End Sub
110 Begin the LoadSrcJrnlLB subroutine which loads the Source Journal
Combobox control
111 Declare strResults as String assign it a value (null) so it is "typed"
112 Declare strJunk as String assign it a value (null) so it is "typed"
113 Define an Object handle for the SourceJournal Service object
114 Declare MyArray as String Array
115 Clear any items currently in the Source Journal Combobox
116 Get Security object for GL Source Journal
117 If SetProgram fails, it returns zero
118 Display LastErrorMsg for reason of failure
119 Create new GL_SourceJournal_svc Service object, object handle –
oGLSrcJrnlSrvcObj
120 Display LastErrorMsg for reason of failure
121 GetResultSets is an inherited method which returns a separated (Chr(138))
list
122 Split the separated list into MyArray elements specify Chr(138) as
delimiter
123 Add MyArray elements to the Source Journal Combobox
124 Drop Object oGLSrcJrnlSrvcObj
125 Set oGLSrcJrnlSrvcObj object handle to nothing
131. retVAL =
oSS.nSetProgram(oSS.nLookupTask("GL_Account_ui"))
............Try
134. oGLAcctSrvcObj = oScript.NewObject("gl_Account_svc",
oSS)
..............Catch
135. MsgBox("NewObject(GL_Account_svc) " & oSS.sLastError
Msg)
..............End Try
136. oGLAcctSrvcObj.nGetResultSets("Account$", _
"AccountKey$", strResults, strJunk, "", "", "",
"kAccount")
137. strAccountArray = Split(strResults, Chr(138))
138. cboAccount.Items.Clear()
139. cboAccount.Items.AddRange(strAccountArray)
140. oGLAcctSrvcObj.DropObject()
141. oGLAcctSrvcObj = Nothing
.......
........End Sub
126 Begin sub GetAccountList which loads the cboAccount control with
Account #'s
127 Declare strResults as String assign it a value (null) so it is "typed"
128 Declare strJunk as String assign it a value (null) so it is "typed"
129 Define an Object handle for the SourceJournal Service object
130 Declare MyArray as String Array
131 Get Security object for GL Source Journal
132 If SetProgram fails it returns zero
133 Display LastErrorMsg for reason of failure
134 Create new GL_Account_svc Service object, object handle –
oGLAcctSrvcObj
135 Display LastErrorMsg for reason of failure
136 GetResultSets is an inherited method which returns a separated (Chr(138))
list
137 Split the separated list into MyArray elements specify Chr(138) as
delimiter
138 Clear any existing items in the Account Number Combobox
139 Add MyArray elements to the Account Number Combobox
140 Drop Object oGLAcctSrvcObj
141 Set oGLAcctSrvcObj object handle to nothing
BudgetFromExcel.vb source
1. Public Class BudgetFromExcel
Inherits System.Windows.Forms.Form
.......................Try
18. oGLBudget = oScript.NewObject("GL_PeriodBudgetDetail_bus",
oSS)
19. oGLService = oScript.NewObject("GL_Account_svc", oSS)
........................Catch
20. MessageBox.Show(oSS.sLastErrorMsg)
........................End Try
................End Sub
50 objWkSheet.Cells(FiscalPeriod, 1) = sFiscalPeriod
51. objWkSheet.Cells(FiscalPeriod, 2) = DebitAmount
52. objWkSheet.Cells(FiscalPeriod, 3) = CreditAmount
53. rDebitAmount = objWkSheet.Cells(FiscalPeriod, 4).Value
54. rCreditAmount = objWkSheet.Cells(FiscalPeriod, 5).Value
...... Next
......End Sub
.....................Next
..............End Sub
......................Try
74. retVAL = Len(objWkSheet.Name())
......................Catch
75. objWkSheet = objExcel.Workbooks.Add(1).Worksheets.Item(1)
76. excelExists = True
......................End Try
...............End Sub
.................End Sub
...........
'Get the Sage MAS 90 path from the SOTAMAS90 registry entry
Set oReg = GetObject("winmgmts:\\.\root\default:StdRegProv")
oReg.GetExpandedStringValue &H80000001,
"Software\ODBC\ODBC.INI\SOTAMAS90", "Directory",PathRoot
PathHome = PathRoot & "\Home"
Set oReg = Nothing
Figure 1
5. Accept the defaults for the remaining fields and click OK.
Figure 2
7. At the Field Name field, enter PROJECTDESC. The field name is prefixed with
UDF_.
8. At the Maximum Length field, enter 30.
Figure 3
Figure 4
Figure 5
Figure 6
12. Enter a few records in the User-Defined Table Maintenance program and click
Accept to save when finished.
Figure 7
Certified Student Course Curriculum - Version 2.0 Page 179
Copyright © 2008 Sage Software, Inc. All rights reserved.
Sage MAS 90 and 200 Object Interface
Figure 8
Figure 9
Figure 10
Figure 11
9. Accept the defaults for the remaining fields and click OK.
10. Click OK to finish defining fields for the GL Account Master table.
Figure 12
Figure 13
Figure 14
Figure 15
8. Click OK.
9. The Object Type and Attributes are set from the selected data source.
Figure 16
10. Click the Validation tab and select User-Defined Table as the validation method.
11. Select GL_UDT_PROJECTS as the user-defined table.
Figure 17
12. Accept the defaults for the remaining fields and click OK.
13. Click OK to finish defining fields for the GL Account Master table.
Figure 18
Figure 19
To run PVXCOM on a remote machine such as the MAS 200 Server or other server
do the following:
1. On the server, setup the DCOM Configuration for the ProvideX OLE Server.
• Run Microsoft Component Services - dcomcnfg.exe.
• Select Component Services/Computers/My Computer/DCOM Config.
• Right-click the ProvideX OLE Server object and select properties.
• Setup the properties according to your implementation. This will vary with
different security configurations, etc.
2. On the client, specify the server name in the command when creating the
ProvideX.Script objects. The syntax for this depends on the language you are
programming in.
3. The Init() method will use the path to ..\mas90\home from the DCOM server's
perspective.