Using The SBO - SP - TransactionNotification Stored Procedure
Using The SBO - SP - TransactionNotification Stored Procedure
SBO_SP_TransactionNotification
Stored Procedure
Applies to:
SAP Business One, SDK, SBO_SP_TransactionNotification stored procedure
Summary
This article explains how to use the SBO_SP_TransactionNotification stored procedure to receive notification
of a data-driven event in SAP® Business One. You can also download the code samples.
Table of Contents
Motivation............................................................................................................................................................3
The SBO_SP_TransactionNotification in detail ..................................................................................................3
Important Note for 2007 version .....................................................................................................................5
Adding Code to the Stored Procedure................................................................................................................5
Related Contents ................................................................................................................................................6
Copyright.............................................................................................................................................................7
Motivation
Partners frequently ask me whether there is a way to receive notification of a data-driven event in SAP
Business One. In other words, developers need a way to trigger events in their application based on
something that happens in SAP Business One. For events that occur within the SAP Business One client
application, it is as simple as using the User Interface API (UI-API) to trap events and respond to them.
However, for events where the client application is not involved, for example when someone inserts a
document through the Data Interface API (DI-API), another mechanism is required.
The mechanism for receiving notification of data-driven events is then to locate some code inside the existing
B1 stored procedure called SBO_SP_TransactionNotification.
Please note that adding SQL triggers or Stored Procedures at the database level is not permitted (cf. SAP
Business One Add-On Solution Certification document) – in addition triggers will be automatically removed
during the SAP Business One upgrade process when the corresponding table is modified.
AS
begin
-- Return values
declare @error int -- Result (0 for no error)
declare @error_message nvarchar (200) -- Error string to be displayed
select @error = 0
select @error_message = N'Ok'
------------------------------------------------------------
-- ADD YOUR CODE HERE
-------------------------------------------------------------
end
GO
Parameter Example
IF @hresult <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object
RETURN
END
This creates an instance of DisplaySBOInfo.Class1 and calls the DisplaySBOInfo method, passing
parameters to it that will be written to the text log.
After you have added your code to the stored procedure, open up SAP Business One and make a few
changes. For example, add a Business Partner, edit a Quotation, and then delete the Business Partner.
When you're done, open Log.txt and take a look at the data. In a real-life scenario, you would use the
information provided by SBO_SP_TransactionNotification with the DI-API to retrieve more information
about the record that was inserted, deleted, or changed.
When you are done with this sample exercise, go back to the stored procedure and delete or comment out
the code that was added. This will insure that the sample does not continue to run.
If you would like, you can download the sample code that was described in this article.
You can also download SAP Business One DI Event Service sample implementing a DI Event Service that
runs on top of the existing SAP Business One SDK interfaces. This service provides notifications on events
related to SAP Business One DI API objects through a listener-based interface.
Related Contents
For more information, visit the Business One homepage.
Copyright
© Copyright 2009 SAP AG. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG.
The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9,
iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server,
PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes,
BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX,
Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems
Incorporated in the United States and/or other countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of
Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts
Institute of Technology.
Java is a registered trademark of Sun Microsystems, Inc.
JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by
Netscape.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned
herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and
other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered
trademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company.
All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document
serves informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP
Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or
omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the
express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an
additional warranty.