Modifying business logic
When you use Microsoft Dynamics GP Utilities to create a company, the creation process places all the eConnect stored procedures for that company's database on your Microsoft Dynamics GP SQL server. These stored procedures contain eConnect's business logic. You cannot modify any of the eConnect core stored procedures.
When eConnect processes an XML document, it executes a SQL stored procedure for each XML node in that document. When the stored procedure executes, it also executes the pre and post stored procedures for that businss object. The following example describes the sequence of actions initiated by a call to the taSopHdrIvcInsert stored procedure..
- The pre stored procedure runs prior to the core stored procedure. In this example, the taSopHdrIvcInsertPre executes. After the pre stored procedure completes, the business object checks for errors. If it detects an error, the stored procedure stops, initiates a rollback, and returns an error message to the caller. If no error is detected, the stored procedure continues.
- The taSopHdrIvcInsert stored procedure runs. When the stored procedure completes, it checks for errors. If it detects an error, the stored procedure stops, initiates a rollback, and returns an error message to the caller. If no error is detected, the stored procedure continues with a call to the post stored procedure.
- The post stored procedure runs immediately after the core stored procedure. In this example, the taSopHdrIvcInsertPost stored procedure executes. After the post stored procedure completes, the business object checks for errors. If it detects an error, the stored procedure stops, initiates a rollback, and returns an error message to the caller. If no error is detected, the stored procedure ends and returns to the caller.
For additional information about the sequence of events in an eConnect stored procedure, refer to the Business objects.
To alert the eConnect business object of an error in your pre or post stored procedure, use the output parameters for that stored procedure. To report the status of your pre or post procedure, use the output parameters as follows:
- If the pre or post stored procedure completes successfully, set the value of the ErrorState output parameter to zero.
- If the pre or post stored procedures encounter an error, set the ErrorState parameter of the stored procedure to a non-zero value. If the eConnect business object finds a non-zero value in the ErrorState parameter, the stored procedure halts and initiates a rollback of the transaction.
- When an error occurs in the pre or post stored procedures, set a value in the ErrString output parameter that describes the error.