
A stored procedure is a collection of predefined procedures stored in the SAP Business One database. SQLThis is a central technological component of the database architecture that executes system-relevant or business-specific logic.
SAP Business One differentiates between stored procedures according to the database in which they are stored. In the SBOCOMMON database, they support the administration of the system landscape. They manage metadata and system objects, for example by inserting (InsertClassDef) or deleting (DeleteClassDef) class definitions. There are also procedures for licence management and system maintenance, such as TmSp_CopyCompany or TmSp_GetUsers. In the company databases, on the other hand, stored procedures control the booking and business logic. These include routines such as TmSp_GetDocVatTotals or TmSp_ConvertGrpLine_OACT, directly involved in the processing of business transactions.
In particular, business experts use stored procedures to deeply customise the standard functionality of SAP Business One. The procedure SBO_SP_TransactionNotification is used to implement complex validations. When a user attempts to add a document, this procedure can be triggered and check user-defined business rules. If a rule is violated, it stops the add process; this makes it possible, for example, to check discounts at line level that are not covered by the standard authorisation procedure at header level. It also supports SBO_SP_PostTransactionNotice downstream activities after a transaction has been successfully posted to the database.
Execution and management:
Stored procedures are executed via SQL. The command object of the Data Interface Application Programming Interface (DI API) can call SQL stored procedures in the company database. In addition, users with „Full authorisation“ can use the Execute Commands window to execute stored procedures written as macros. Finally, stored procedures are also relevant for database maintenance, as they are used to update statistics (sp_updatestats), for example, and thus enable the database optimiser to execute SQL statements efficiently.
Delimitation and maintenance instructions:
Stored procedures are an integral part of the technical infrastructure of SAP Business One. Business users and Administrators must therefore neither rename nor remove the procedures provided by the system, as this may disrupt the proper functioning of the system and trigger error messages. While standard procedures cover system-side tasks and core logic, customised procedures such as SBO_SP_TransactionNotification and SBO_SP_PostTransactionNotice the business logic with customised rules and follow-up actions without changing the underlying system architecture.