Sage 100 Business Object Interface Fundamentals

 
 
S
a
g
e
 
1
0
0
:
 
U
s
i
n
g
 
B
u
s
i
n
e
s
s
 
O
b
j
e
c
t
I
n
t
e
r
f
a
c
e
 
-
 
B
e
g
i
n
n
e
r
Part 1 of 2 – Course Number P-ERP22 and P-ERP22B
 
C
P
E
 
C
r
e
d
i
t
In order to receive CPE credit for this session, you must be
present for the entire session.
S
e
s
s
i
o
n
 
C
o
d
e
:
 
P
-
E
R
P
2
2
B
 
(
M
o
n
d
a
y
)
 
O
R
 
P
-
E
R
P
2
2
 
(
T
u
e
s
d
a
y
)
R
e
c
o
m
m
e
n
d
e
d
 
C
P
E
 
C
r
e
d
i
t
 
=
 
1
Delivery Method = Group Live
Field of Study = Specialized Knowledge and Applications
Visit the Sage SummitConnect kiosks to enter CPE credit
during the conference.
 
I
n
t
r
o
d
u
c
t
i
o
n
Steve Malmgren – Sr. Director of Development
Elliott Pritchard – Principal Software Architect
This presentation will be available online after the conference.
You will receive an email for the Summit session website
approximately 1-2 weeks after Summit. (Or sooner if you
brought your laptop or a jump drive)
Follow us on Twitter: @Sage_Summit, @swmalm
Use the official Summit hashtag: #SageSummit
 
M
u
l
t
i
p
a
r
t
 
S
e
s
s
i
o
n
s
This session is part of a focused, multipart session series.
Attendees that register for a multipart session series must
register for all parts in the series.
 
L
e
a
r
n
i
n
g
 
O
b
j
e
c
t
i
v
e
s
After participating in this session, you will be able to: 
Understand the different Object Types available for use in Sage 100
Distinguish between “using” objects and “changing the behavior” of
objects
Use the key methods and properties of each object type
 
K
e
y
 
C
o
n
c
e
p
t
s
 
a
n
d
 
T
e
r
m
s
UDS – User Defined Scripts.  Scripts that can be attached
to buttons, or database events.
UI – User Interface.  This refers to Sage 100 entry
screens
API – Application Programming Interface.
Business Object Interface – API to programmatically “use”
Sage 100 objects to read and write data, generate and
print reports, invoke register/update routines.
Business Rules – validations that are enforced to ensure
proper data is written to a table.
COM – Component Object Model – using properties and
methods of objects
 
S
a
g
e
 
1
0
0
 
O
b
j
e
c
t
 
T
y
p
e
s
 
A
p
p
r
o
a
c
h
Overview of object type and how they are used
Cover Key Methods and Properties of each object type
Examine code in example scripts
Run sample scripts with debug trace window visible
A lot to cover, all examples and presentation will be available to
review during conference and/or when you get back to your
office
 
N
a
m
i
n
g
 
C
o
n
v
e
n
t
i
o
n
s
Service and Business
Table name + _SVC or _BUS
e.g. AR_Customer_SVC; AP_Vendor_BUS
Exception - Line entry business objects (_BUS):
Table names follow convention of XX_XxxxxXxxxHeader and
XX_XxxxxXxxxDetail
Object name disregards Header and Detail naming is the object is
responsible for both tables
Name: SO_SalesOrder_BUS; AR_CashReceipts_BUS
Reports, Forms, Updates and UI, consult Object Reference (see
next slide) to be sure
 
 
 
S
e
r
v
i
c
e
 
O
b
j
e
c
t
s
 
(
_
S
V
C
)
 
-
 
S
u
m
m
a
r
y
Service Objects are Read Only access to tables in the system.
Primarily used by the Business Objects (_BUS) to validate
fields against other tables.
Sales Order validates the customer being added to the
SO_SalesOrderHeader table using the AR_Customer_SVC object
Supports flow of UDFs
Some Service Objects provide other services such as:
calculating an aging for a customer
calculating an invoice due date based on a terms code
SO Sales Order, SO Invoice and AR Invoice all use the
AR_TermsCode_SVC.CalcDates() method to calculate due date and
discount dates
View Public Methods in Object Reference for desired object and
inherited classes
 
S
e
r
v
i
c
e
 
O
b
j
e
c
t
s
 
(
_
S
V
C
)
 
-
 
S
u
m
m
a
r
y
T
I
P
 
 
W
h
e
n
 
o
b
t
a
i
n
i
n
g
 
a
n
 
o
b
j
e
c
t
 
h
a
n
d
l
e
 
t
o
 
a
 
S
e
r
v
i
c
e
 
O
b
j
e
c
t
,
u
s
e
 
o
B
u
s
O
b
j
.
G
e
t
C
h
i
l
d
H
a
n
d
l
e
(
<
d
a
t
a
S
o
u
r
c
e
>
 
A
s
 
S
t
r
i
n
g
)
 
r
a
t
h
e
r
t
h
a
n
 
o
S
e
s
s
i
o
n
.
G
e
t
O
b
j
e
c
t
(
<
s
e
r
v
i
c
e
O
b
j
e
c
t
 
A
s
 
S
t
r
i
n
g
)
 
t
o
m
i
n
i
m
i
z
e
 
m
e
m
o
r
y
 
u
s
a
g
e
.
First Option – service object is already in memory. May need to do
a oSvc.ReadAdditional(<dataSource As String) OR .Find() to
populate data
Second Option – creates a new copy of the object in memory
 
S
e
r
v
i
c
e
 
O
b
j
e
c
t
s
 
(
K
e
y
 
M
e
t
h
o
d
s
(
)
 
a
n
d
 
P
r
o
p
e
r
t
i
e
s
)
MoveFirst(); MoveNext(); MoveLast(); MovePrevious()
GetKeyColumns() As String – Helper Method
GetColumns() As String – Helper Method
SetKeyValue(<keyColumn As String>, <keyValue As String)
Find() - no arguments, must use SetKeyValue() for each key
column
Find(<keyValue as String>)  - only used on single column keys
 
S
e
r
v
i
c
e
 
O
b
j
e
c
t
s
 
(
K
e
y
 
M
e
t
h
o
d
s
(
)
 
a
n
d
 
P
r
o
p
e
r
t
i
e
s
)
GetValue(<column As String>, <val As String OR Numeric)
GetRecord(<rec As String>, <pvx IOL - not useful in scripting
instead use GetColumns()>)
SetBrowseFilter(<first n characters to filter As String>)
BOF; EOF – indicates whether or not the row pointer is at the
beginning or end of file respectively
L
a
s
t
E
r
r
o
r
N
u
m
,
 
L
a
s
t
E
r
r
o
r
M
s
g
 
A
s
 
S
t
r
i
n
g
 
 
c
o
n
t
a
i
n
s
 
e
r
r
o
r
 
c
o
d
e
a
n
d
 
m
e
s
s
a
g
e
 
o
f
 
l
a
s
t
 
e
r
r
o
r
 
t
h
a
t
 
o
c
c
u
r
r
e
d
.
 
 
T
I
P
 
-
 
M
a
y
 
n
o
t
 
b
e
b
a
s
e
d
 
o
n
 
t
h
e
 
l
a
s
t
 
o
p
e
r
a
t
i
o
n
 
i
f
 
s
u
c
c
e
s
s
f
u
l
.
 
 
(
N
O
T
E
:
 
T
h
e
s
e
p
r
o
p
e
r
t
i
e
s
 
a
r
e
 
i
n
 
A
L
L
 
o
b
j
e
c
t
 
t
y
p
e
s
 
a
n
d
 
s
h
o
u
l
d
 
b
e
 
c
h
e
c
k
e
d
 
o
n
f
a
i
l
e
d
 
m
e
t
h
o
d
 
c
a
l
l
s
)
 
L
e
t
s
 
T
a
k
e
 
a
 
L
o
o
k
 
 
S
e
r
v
i
c
e
 
O
b
j
e
c
t
 
(
A
R
_
C
u
s
t
o
m
e
r
_
s
v
c
)
Appendix
 – To have a look at some background info
Service_AR_Customer_svc.txt
 – Service Object Script
 
B
u
s
i
n
e
s
s
 
O
b
j
e
c
t
s
 
(
_
B
U
S
)
 
-
 
S
u
m
m
a
r
y
Business Objects enforce all of the business rules for adding
data into the system.
B
e
h
a
v
i
o
r
 
c
a
n
 
b
e
 
c
h
a
n
g
e
d
 
v
i
a
 
U
s
e
r
-
D
e
f
i
n
e
d
 
S
c
r
i
p
t
i
n
g
!
!
Always use Business Objects rather than writing directly to the
database to ensure the integrity of the system
VI uses the Business Objects to import data as does the User
Interface (UI) of Sage 100
Some history tables have business objects defined, 
BUT
 are
for migrating a customer from another system to Sage 100.
Best practice is to use data entry tables and process through
the updates (which can all be automated) to get data into
history tables.
 
B
u
s
i
n
e
s
s
 
O
b
j
e
c
t
s
 
-
 
K
e
y
 
M
e
t
h
o
d
s
(
)
 
a
n
d
 
P
r
o
p
e
r
t
i
e
s
Inherits all Service Object methods and properties
SetKey() - Same as Find (with or without arguments, but used
to place a row into an EditState for new rows)
SetValue(<column As String>, <val As String or Numeric>)
Write() - saves changes
Delete() - deletes current row
Clear() - takes row out of edit state and discards any changes
 
B
u
s
i
n
e
s
s
 
O
b
j
e
c
t
s
 
-
 
K
e
y
 
M
e
t
h
o
d
s
(
)
 
a
n
d
 
P
r
o
p
e
r
t
i
e
s
GetDataSources() As String - returns list of columns that
validate against a Service object
GetChildHandle(<data source As String>) As Object - returns
an Object handle to a Service Object
ReadAdditonal() - reads ALL child data sources for current row
ReadAdditional(<data source As String>) - read specified data
source
SetCopyKeyValue(<keyColumn As String>, <keyValue As
String>)
CopyFrom()
 
B
u
s
i
n
e
s
s
 
O
b
j
e
c
t
s
 
-
 
K
e
y
 
M
e
t
h
o
d
s
(
)
 
a
n
d
 
P
r
o
p
e
r
t
i
e
s
EditState – 0 if no record in memory; 1 if existing record; 2 if
new record
RecordChanged – 0 if no changes, 1 if record has changed
 
L
e
t
s
 
T
a
k
e
 
a
 
L
o
o
k
 
 
B
u
s
i
n
e
s
s
 
O
b
j
e
c
t
 
(
A
R
_
C
u
s
t
o
m
e
r
_
b
u
s
)
Business_AR_Customer_bus.txt
 – Business Object Script –
Existing Customer
NewRecord_AR_Customer_bus.txt
 – Business Object – Create
New Customer (GetNextCustomerNo(); CopyFrom())
 
S
u
m
m
a
r
y
 
-
 
S
e
r
v
i
c
e
 
a
n
d
 
B
u
s
i
n
e
s
s
 
O
b
j
e
c
t
s
Service Objects – Read Only
SetKeyValue()
Find()
GetValue()
Business Objects – Read/Write/Delete
SetKeyValue()
SetKey()
GetValue()
SetValue()
Write()
Delete()
 
S
u
m
m
a
r
y
 
-
 
S
e
r
v
i
c
e
 
a
n
d
 
B
u
s
i
n
e
s
s
 
O
b
j
e
c
t
s
Service Objects – What we’ve done
Browsed rows with and without a browse filter
Examined BOF and EOF
Found a specific row and retrieved a value
Used a While/Wend loop to calculate over 90 day balance for
division 01
Business Objects – What we’ve done
Edited an existing record; examined a failed SetValue() and
Delete() method call
Created a new customer; used GetNextCustomerNo; used
SetCopyKeyValue() and CopyFrom() methods
Saw how to use GetChildHandle() to get a service object handle
 
B
u
s
i
n
e
s
s
 
O
b
j
e
c
t
s
 
(
L
i
n
e
 
E
n
t
r
y
)
 
-
 
K
e
y
 
M
e
t
h
o
d
s
 
a
n
d
P
r
o
p
e
r
t
i
e
s
AddLine()  - creates a new, empty line with default values
Lines – object handle to the detail business object
Set oLines = oBusObj.AsObject(oBusObj.Lines)
Just like any other business object (GetValue(); SetValue();
Write(); Delete() )
GetEditKey(<lineKey As String>) – Used to get the edit key of a
line based on the 6 character LineKey column (will cover these
in Part 2)
EditLine(<editKey As String>)
DeleteLine(<editKey As String>)
 
L
e
t
s
 
T
a
k
e
 
a
 
L
o
o
k
 
 
B
u
s
i
n
e
s
s
 
O
b
j
e
c
t
 
(
S
O
_
S
a
l
e
s
O
r
d
e
r
_
b
u
s
)
Create_SO_SalesOrder_bus.txt
 – Business Object Script –
Create SalesOrder
 
S
u
m
m
a
r
y
 
 
L
i
n
e
 
E
n
t
r
y
 
B
u
s
i
n
e
s
s
 
O
b
j
e
c
t
s
What we’ve done
Used a SO object from the AR module – Set the Module and Date
to SO prior to “getting” the SO_SalesOrder_bus object
GetNextSalesOrderNo
SET oLines to the oSO.AsObject(oSO.Lines) property to access
the detail business object
Used the oScript.DebugPrint() to display any error messages
Used the oScript.SetStorageVar() to store off a Sales Order
number as well as detail line to be used in the edit line and delete
line scripts for Part 2.
 
R
e
p
o
r
t
 
O
b
j
e
c
t
s
 
(
_
R
P
T
)
 
-
 
S
u
m
m
a
r
y
Report Objects are used to print, preview, defer or deliver
(using paperless office) any Report or Form via the Business
Object Interface.
Forms need to be run once from the UI so that the customer
can choose which report template (Marbled, Plain Paper, etc.)
to use.
NOTE:  Audit Journals and Registers, as well as related recaps
and error logs are printed from within the Update (_UPD)
objects
 
R
e
p
o
r
t
 
O
b
j
e
c
t
s
 
-
 
K
e
y
 
M
e
t
h
o
d
s
(
)
 
a
n
d
 
P
r
o
p
e
r
t
i
e
s
SelectReportSetting(<savedReportSetting As String)
If no saved settings available can ALWAYS use “STANDARD”
which is factory defaults
Use SY_ReportSetting_svc to determine any saved settings
ProcessReport(<destination As String)
“PREVIEW”
“DEFERRED”
“PRINT” – based on default printer for report setting
“EXPORT”, “EXPORTDATA” (warning prompts user for type and
location)
 
F
O
R
M
 
O
b
j
e
c
t
s
 
-
 
K
e
y
 
M
e
t
h
o
d
s
(
)
 
a
n
d
 
P
r
o
p
e
r
t
i
e
s
QuickPrint As String
Not all forms support this – Check Object Reference (e.g.
AR_Statement_rpt does not, SO_SalesOrderPrinting_rpt does)
T
I
P
:
 
M
u
s
t
 
s
e
l
e
c
t
 
a
 
t
e
m
p
l
a
t
e
 
(
e
.
g
.
 
m
a
r
b
l
e
d
,
 
p
l
a
i
n
 
p
a
p
e
r
,
 
e
t
c
.
)
f
i
r
s
t
 
v
i
a
 
t
h
e
 
U
I
 
o
r
 
s
c
r
i
p
t
 
w
i
l
l
 
n
o
t
 
w
o
r
k
 
L
e
t
s
 
T
a
k
e
 
a
 
L
o
o
k
 
 
R
e
p
o
r
t
 
a
n
d
 
F
o
r
m
 
O
b
j
e
c
t
s
ReportSimple_AR_AgedInvoice_rpt.txt
 – Report Object Script
QuickPrint_SO_SalesOrderPrinting_rpt.txt
 – Forms Object
 
S
u
m
m
a
r
y
 
 
R
e
p
o
r
t
 
a
n
d
 
F
o
r
m
 
O
b
j
e
c
t
s
What we’ve done
Used SelectReportSetting() for both STANDARD and saved
setting (even had to set one up since it failed the first time)
Used ProcessReport() for all output types
Used oScript.GetStorageVar() to retrieve the sales order number
created and saved off in another script, to use to set the
QuickPrint property of a FORM object
 
U
p
d
a
t
e
 
O
b
j
e
c
t
s
 
(
_
U
P
D
)
 
-
 
S
u
m
m
a
r
y
Update Objects are used to post data entry transaction through
to the history tables and to post GL transaction associated with
those entries.
Encompasses both the Register (audit trail report) and the
update posting logic.
The Register must be “Printed” either to hard copy, paperless
office or deferred print in order for the transactions to be
updated.  (Previewed registers can only be updated with
appropriate security event rights)
If errors are detected during the register printing, the update
cannot continue and an error log can be printed
 
U
p
d
a
t
e
 
O
b
j
e
c
t
s
 
-
 
K
e
y
 
M
e
t
h
o
d
s
(
)
 
a
n
d
 
P
r
o
p
e
r
t
i
e
s
ProcessReport(<destination As String)
“PREVIEW” – cannot update unless Security Event rights
“DEFERRED”
“PRINT” – based on default printer for report setting
“EXPORT”, “EXPORTDATA” (warning prompts user for type and
location)
Update() – Executes the update process
 
L
e
t
s
 
T
a
k
e
 
a
 
L
o
o
k
 
 
U
p
d
a
t
e
 
O
b
j
e
c
t
s
InvoiceOrder_SO_Invoice_bus.txt
 – Invoice Order Script
(Bonus Coverage!!)
Update_SO_SalesJournal_upd.txt
 – Update Object
 
S
u
m
m
a
r
y
 
 
U
p
d
a
t
e
 
O
b
j
e
c
t
s
What we’ve done
Covered how to invoice a sales order and copy detail lines from
the sales order to the invoice (Bonus coverage)
Used the ProcessReport()  to print the main Audit Trail Register.
Same method as in the reports, so all output types are available
NOTE: PREVIEW will not allow update unless have proper security
event rights
ProcessReport() can fail if there is an error condition.
Used the Update() method to post the Invoices through to GL,
Open Invoice, History, etc.
 
U
s
e
r
 
I
n
t
e
r
f
a
c
e
 
O
b
j
e
c
t
s
 
(
_
U
I
)
 
-
 
S
u
m
m
a
r
y
User Interface objects are used to display the Sage 100 data
entry screens
The object class names are used to obtain security rights at a
task level.
As an alternative, can be launched in a separate process using
the oSession.InvokeTask() method
 
U
I
 
O
b
j
e
c
t
s
 
-
 
K
e
y
 
M
e
t
h
o
d
s
(
)
 
a
n
d
 
P
r
o
p
e
r
t
i
e
s
Process() – displays UI
Process(<recordToDisplay As String)
Will bring the record (e.g. oARCust.Process(“01ABF”) – will
display customer 01-ABF
 
L
e
t
s
 
T
a
k
e
 
a
 
L
o
o
k
 
 
U
I
 
O
b
j
e
c
t
s
UI_AR_Customer_ui.txt
 – AR_Customer_UI
 
 
Questions?
 
A
d
d
i
t
i
o
n
a
l
 
L
e
a
r
n
i
n
g
 
O
p
p
o
r
t
u
n
i
t
i
e
s
For information about additional learning opportunities visit
www.sageu.com 
(Sage University).
Training options include:
Anytime Learning—Recorded online training sessions.
Realtime Learning—Live, online learning.
Replay Learning—Recordings of live classes.
 
Y
o
u
r
 
F
e
e
d
b
a
c
k
 
i
s
 
I
m
p
o
r
t
a
n
t
 
t
o
 
U
s
!
Please visit a Sage SummitSurvey kiosks to complete the
evaluation form for this session.
Remember each completed survey form is another entry
for one of three iPad drawings.
Your feedback helps us improve future sessions and presentation
techniques.
Please include your session code on the evaluation form:
Monday (P-ERP22B)
Tuesday (P-ERP22)
 
C
o
n
t
a
c
t
 
U
s
Presenter Contact Information:
Steve Malmgren, Elliott Pritchard
Twitter @swmalm
Follow us on Twitter: @Sage_Summit,
Use the official Summit hashtag: #SageSummit
T
h
a
n
k
 
y
o
u
 
f
o
r
 
y
o
u
r
 
p
a
r
t
i
c
i
p
a
t
i
o
n
.
 
A
p
p
e
n
d
i
x
How to Enable oScript.DebugPrint()
Creating Objects
Scripting.doc
Script Events
Link to 4.40 Customizer Recorded Sessions
Link to 4.30 Customizer Recorded Sessions
Microsoft's On-line VBScript Reference
Back
 
H
o
w
 
t
o
 
E
n
a
b
l
e
 
o
S
c
r
i
p
t
.
D
e
b
u
g
P
r
i
n
t
(
)
 
R
i
g
h
t
-
C
l
i
c
k
 
o
n
 
t
i
t
l
e
 
b
a
r
 
 
S
e
l
e
c
t
 
D
e
b
u
g
g
i
n
g
E
n
v
i
r
o
n
m
e
n
t
.
.
P
r
o
g
r
a
m
 
T
r
a
c
e
 
w
i
n
d
o
w
 
D
i
s
p
l
a
y
s
 
t
h
i
s
 
w
i
n
d
o
w
 
 
S
e
l
e
c
t
 
S
u
p
p
r
e
s
s
 
P
r
o
g
r
a
m
 
T
r
a
c
e
a
n
d
 
o
p
t
i
o
n
a
l
 
A
u
t
o
-
S
t
a
r
t
 
d
u
r
i
n
g
 
s
c
r
i
p
t
 
d
e
b
u
g
g
i
n
g
 
C
r
e
a
t
i
n
g
 
O
b
j
e
c
t
s
User-Defined Scripting (4.40 and above)
oCustSvc = oSession.GetObject(“AR_Customer_svc”)
If oCustSvc <> 0 then
     
SET
 oCustSvc = oSession.AsObject(oCustSvc)
End If
Security of current session is used to establish authorization
COM (Providex.Script)
Set oSession = oPVXScript.NewObject(“SY_Session”)
… (establish user, password for login, set module and module
date; check security, etc.) …
Set oCustSvc = oPVXScript.NewObject(“AR_Customer_svc,
oSession)
 
R
e
f
e
r
e
n
c
i
n
g
 
E
x
i
s
t
i
n
g
 
O
b
j
e
c
t
s
User-Defined Scripting (4.40 and above)
SET 
oCustSvc =
oBusObj.AsObject(GetChildHandle(“CustomerNo”))
SET 
oLines = oBusObj.AsObject(oBusObj.Lines)
NOTE: User-Defined Scripting requires the
.AsObject() wrapper to indicate return type is
an object handle
COM (Providex.Script)
SET 
oCustSvc =
oBusObj.oGetChildHandle(“CustomerNo”)
SET 
oLines = oBusObj.oLines
NOTE: o prefix in oBusObj.oLines to indicate
variable return type is an object handle
 
S
c
r
i
p
t
 
E
v
e
n
t
s
Slide Note
Embed
Share

Begin your journey into Sage 100 with this course covering the Business Object Interface. Explore key methods, object types, and important terms like API and User Defined Scripts. Gain insights into creating, reading, and updating data efficiently. Prepare to utilize Sage 100's capabilities effectively with this beginner-focused course.

  • Sage 100
  • Business Object Interface
  • API
  • User Defined Scripts
  • Beginner

Uploaded on Feb 16, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Sage 100: Using Business Object Interface - Beginner Part 1 of 2 Course Number P-ERP22 and P-ERP22B

  2. CPE Credit In order to receive CPE credit for this session, you must be present for the entire session. Session Code: P-ERP22B (Monday) OR P-ERP22 (Tuesday) Recommended CPE Credit = 1 Delivery Method = Group Live Field of Study = Specialized Knowledge and Applications Visit the Sage SummitConnect kiosks to enter CPE credit during the conference.

  3. Introduction Steve Malmgren Sr. Director of Development Elliott Pritchard Principal Software Architect This presentation will be available online after the conference. You will receive an email for the Summit session website approximately 1-2 weeks after Summit. (Or sooner if you brought your laptop or a jump drive) Follow us on Twitter: @Sage_Summit, @swmalm Use the official Summit hashtag: #SageSummit

  4. Multipart Sessions This session is part of a focused, multipart session series. Attendees that register for a multipart session series must register for all parts in the series.

  5. Learning Objectives After participating in this session, you will be able to: Understand the different Object Types available for use in Sage 100 Distinguish between using objects and changing the behavior of objects Use the key methods and properties of each object type

  6. Key Concepts and Terms UDS User Defined Scripts. Scripts that can be attached to buttons, or database events. UI User Interface. This refers to Sage 100 entry screens API Application Programming Interface. Business Object Interface API to programmatically use Sage 100 objects to read and write data, generate and print reports, invoke register/update routines. Business Rules validations that are enforced to ensure proper data is written to a table. COM Component Object Model using properties and methods of objects

  7. Sage 100 Object Types Type Service Business Suffix _SVC _BUS Description Read only access to tables Read/Write/Delete enforces business rules when writing to tables Print reports and forms with no UI Audit trail and update processes Sage 100 screens Reports and Forms Update User Interface _RPT _UPD _UI

  8. Approach Overview of object type and how they are used Cover Key Methods and Properties of each object type Examine code in example scripts Run sample scripts with debug trace window visible A lot to cover, all examples and presentation will be available to review during conference and/or when you get back to your office

  9. Naming Conventions Service and Business Table name + _SVC or _BUS e.g. AR_Customer_SVC; AP_Vendor_BUS Exception - Line entry business objects (_BUS): Table names follow convention of XX_XxxxxXxxxHeader and XX_XxxxxXxxxDetail Object name disregards Header and Detail naming is the object is responsible for both tables Name: SO_SalesOrder_BUS; AR_CashReceipts_BUS Reports, Forms, Updates and UI, consult Object Reference (see next slide) to be sure

  10. Service Objects (_SVC) - Summary Service Objects are Read Only access to tables in the system. Primarily used by the Business Objects (_BUS) to validate fields against other tables. Sales Order validates the customer being added to the SO_SalesOrderHeader table using the AR_Customer_SVC object Supports flow of UDFs Some Service Objects provide other services such as: calculating an aging for a customer calculating an invoice due date based on a terms code SO Sales Order, SO Invoice and AR Invoice all use the AR_TermsCode_SVC.CalcDates() method to calculate due date and discount dates View Public Methods in Object Reference for desired object and inherited classes

  11. Service Objects (_SVC) - Summary TIP When obtaining an object handle to a Service Object, use oBusObj.GetChildHandle(<dataSource> As String) rather than oSession.GetObject(<serviceObject As String) to minimize memory usage. First Option service object is already in memory. May need to do a oSvc.ReadAdditional(<dataSource As String) OR .Find() to populate data Second Option creates a new copy of the object in memory

  12. Service Objects (Key Methods() and Properties) MoveFirst(); MoveNext(); MoveLast(); MovePrevious() GetKeyColumns() As String Helper Method GetColumns() As String Helper Method SetKeyValue(<keyColumn As String>, <keyValue As String) Find() - no arguments, must use SetKeyValue() for each key column Find(<keyValue as String>) - only used on single column keys

  13. Service Objects (Key Methods() and Properties) GetValue(<column As String>, <val As String OR Numeric) GetRecord(<rec As String>, <pvx IOL - not useful in scripting instead use GetColumns()>) SetBrowseFilter(<first n characters to filter As String>) BOF; EOF indicates whether or not the row pointer is at the beginning or end of file respectively LastErrorNum, LastErrorMsg As String contains error code and message of last error that occurred. TIP - May not be based on the last operation if successful. (NOTE: These properties are in ALL object types and should be checked on failed method calls)

  14. Lets Take a Look Service Object (AR_Customer_svc) Appendix To have a look at some background info Service_AR_Customer_svc.txt Service Object Script

  15. Business Objects (_BUS) - Summary Business Objects enforce all of the business rules for adding data into the system. Behavior can be changed via User-Defined Scripting!! Always use Business Objects rather than writing directly to the database to ensure the integrity of the system VI uses the Business Objects to import data as does the User Interface (UI) of Sage 100 Some history tables have business objects defined, BUT are for migrating a customer from another system to Sage 100. Best practice is to use data entry tables and process through the updates (which can all be automated) to get data into history tables.

  16. Business Objects - Key Methods() and Properties Inherits all Service Object methods and properties SetKey() - Same as Find (with or without arguments, but used to place a row into an EditState for new rows) SetValue(<column As String>, <val As String or Numeric>) Write() - saves changes Delete() - deletes current row Clear() - takes row out of edit state and discards any changes

  17. Business Objects - Key Methods() and Properties GetDataSources() As String - returns list of columns that validate against a Service object GetChildHandle(<data source As String>) As Object - returns an Object handle to a Service Object ReadAdditonal() - reads ALL child data sources for current row ReadAdditional(<data source As String>) - read specified data source SetCopyKeyValue(<keyColumn As String>, <keyValue As String>) CopyFrom()

  18. Business Objects - Key Methods() and Properties EditState 0 if no record in memory; 1 if existing record; 2 if new record RecordChanged 0 if no changes, 1 if record has changed

  19. Lets Take a Look Business Object (AR_Customer_bus) Business_AR_Customer_bus.txt Business Object Script Existing Customer NewRecord_AR_Customer_bus.txt Business Object Create New Customer (GetNextCustomerNo(); CopyFrom())

  20. Summary - Service and Business Objects Service Objects Read Only SetKeyValue() Find() GetValue() Business Objects Read/Write/Delete SetKeyValue() SetKey() GetValue() SetValue() Write() Delete()

  21. Summary - Service and Business Objects Service Objects What we ve done Browsed rows with and without a browse filter Examined BOF and EOF Found a specific row and retrieved a value Used a While/Wend loop to calculate over 90 day balance for division 01 Business Objects What we ve done Edited an existing record; examined a failed SetValue() and Delete() method call Created a new customer; used GetNextCustomerNo; used SetCopyKeyValue() and CopyFrom() methods Saw how to use GetChildHandle() to get a service object handle

  22. Business Objects (Line Entry) - Key Methods and Properties AddLine() - creates a new, empty line with default values Lines object handle to the detail business object Set oLines = oBusObj.AsObject(oBusObj.Lines) Just like any other business object (GetValue(); SetValue(); Write(); Delete() ) GetEditKey(<lineKey As String>) Used to get the edit key of a line based on the 6 character LineKey column (will cover these in Part 2) EditLine(<editKey As String>) DeleteLine(<editKey As String>)

  23. Lets Take a Look Business Object (SO_SalesOrder_bus) Create_SO_SalesOrder_bus.txt Business Object Script Create SalesOrder

  24. Summary Line Entry Business Objects What we ve done Used a SO object from the AR module Set the Module and Date to SO prior to getting the SO_SalesOrder_bus object GetNextSalesOrderNo SET oLines to the oSO.AsObject(oSO.Lines) property to access the detail business object Used the oScript.DebugPrint() to display any error messages Used the oScript.SetStorageVar() to store off a Sales Order number as well as detail line to be used in the edit line and delete line scripts for Part 2.

  25. Report Objects (_RPT) - Summary Report Objects are used to print, preview, defer or deliver (using paperless office) any Report or Form via the Business Object Interface. Forms need to be run once from the UI so that the customer can choose which report template (Marbled, Plain Paper, etc.) to use. NOTE: Audit Journals and Registers, as well as related recaps and error logs are printed from within the Update (_UPD) objects

  26. Report Objects - Key Methods() and Properties SelectReportSetting(<savedReportSetting As String) If no saved settings available can ALWAYS use STANDARD which is factory defaults Use SY_ReportSetting_svc to determine any saved settings ProcessReport(<destination As String) PREVIEW DEFERRED PRINT based on default printer for report setting EXPORT , EXPORTDATA (warning prompts user for type and location)

  27. FORM Objects - Key Methods() and Properties QuickPrint As String Not all forms support this Check Object Reference (e.g. AR_Statement_rpt does not, SO_SalesOrderPrinting_rpt does) TIP: Must select a template (e.g. marbled, plain paper, etc.) first via the UI or script will not work

  28. Lets Take a Look Report and Form Objects ReportSimple_AR_AgedInvoice_rpt.txt Report Object Script QuickPrint_SO_SalesOrderPrinting_rpt.txt Forms Object

  29. Summary Report and Form Objects What we ve done Used SelectReportSetting() for both STANDARD and saved setting (even had to set one up since it failed the first time) Used ProcessReport() for all output types Used oScript.GetStorageVar() to retrieve the sales order number created and saved off in another script, to use to set the QuickPrint property of a FORM object

  30. Update Objects (_UPD) - Summary Update Objects are used to post data entry transaction through to the history tables and to post GL transaction associated with those entries. Encompasses both the Register (audit trail report) and the update posting logic. The Register must be Printed either to hard copy, paperless office or deferred print in order for the transactions to be updated. (Previewed registers can only be updated with appropriate security event rights) If errors are detected during the register printing, the update cannot continue and an error log can be printed

  31. Update Objects - Key Methods() and Properties ProcessReport(<destination As String) PREVIEW cannot update unless Security Event rights DEFERRED PRINT based on default printer for report setting EXPORT , EXPORTDATA (warning prompts user for type and location) Update() Executes the update process

  32. Lets Take a Look Update Objects InvoiceOrder_SO_Invoice_bus.txt Invoice Order Script (Bonus Coverage!!) Update_SO_SalesJournal_upd.txt Update Object

  33. Summary Update Objects What we ve done Covered how to invoice a sales order and copy detail lines from the sales order to the invoice (Bonus coverage) Used the ProcessReport() to print the main Audit Trail Register. Same method as in the reports, so all output types are available NOTE: PREVIEW will not allow update unless have proper security event rights ProcessReport() can fail if there is an error condition. Used the Update() method to post the Invoices through to GL, Open Invoice, History, etc.

  34. User Interface Objects (_UI) - Summary User Interface objects are used to display the Sage 100 data entry screens The object class names are used to obtain security rights at a task level. As an alternative, can be launched in a separate process using the oSession.InvokeTask() method

  35. UI Objects - Key Methods() and Properties Process() displays UI Process(<recordToDisplay As String) Will bring the record (e.g. oARCust.Process( 01ABF ) will display customer 01-ABF

  36. Lets Take a Look UI Objects UI_AR_Customer_ui.txt AR_Customer_UI

  37. Questions?

  38. Additional Learning Opportunities For information about additional learning opportunities visit www.sageu.com (Sage University). Training options include: Anytime Learning Recorded online training sessions. Realtime Learning Live, online learning. Replay Learning Recordings of live classes.

  39. Your Feedback is Important to Us! Please visit a Sage SummitSurvey kiosks to complete the evaluation form for this session. Remember each completed survey form is another entry for one of three iPad drawings. Your feedback helps us improve future sessions and presentation techniques. Please include your session code on the evaluation form: Monday (P-ERP22B) Tuesday (P-ERP22)

  40. Contact Us Presenter Contact Information: Steve Malmgren, Elliott Pritchard Twitter @swmalm Follow us on Twitter: @Sage_Summit, Use the official Summit hashtag: #SageSummit Thank you for your participation.

  41. Appendix How to Enable oScript.DebugPrint() Creating Objects Scripting.doc Script Events Link to 4.40 Customizer Recorded Sessions Link to 4.30 Customizer Recorded Sessions Microsoft's On-line VBScript Reference Back

  42. How to Enable oScript.DebugPrint()

  43. Right-Click on title bar Select Debugging Environment..Program Trace window

  44. Displays this window Select Suppress Program Trace and optional Auto-Start during script debugging

  45. Creating Objects User-Defined Scripting (4.40 and above) oCustSvc = oSession.GetObject( AR_Customer_svc ) If oCustSvc <> 0 then SET oCustSvc = oSession.AsObject(oCustSvc) End If Security of current session is used to establish authorization COM (Providex.Script) Set oSession = oPVXScript.NewObject( SY_Session ) (establish user, password for login, set module and module date; check security, etc.) Set oCustSvc = oPVXScript.NewObject( AR_Customer_svc, oSession)

  46. Referencing Existing Objects User-Defined Scripting (4.40 and above) SET oCustSvc = oBusObj.AsObject(GetChildHandle( CustomerNo )) SET oLines = oBusObj.AsObject(oBusObj.Lines) NOTE: User-Defined Scripting requires the .AsObject() wrapper to indicate return type is an object handle COM (Providex.Script) SET oCustSvc = oBusObj.oGetChildHandle( CustomerNo ) SET oLines = oBusObj.oLines NOTE: o prefix in oBusObj.oLines to indicate variable return type is an object handle

  47. Script Events Event Pre-Validate Type Column Script Executes After dictionary validation, prior to Sage/Master Developer Post-Validate After the column value has been validated Column Script-Initialization Runs once per business object on first script run Table Set-Default-Values When a new record is established in the business object Table Pre-Write Before a record is written Table Post-Write After a record is written Table Pre-Delete Before a record is deleted Table Post-Delete After a record is deleted Table Post-Read After a record is read Table Pre-Totals Line Entry only, before totals are calculated Table

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#