sap-transaction-notifications
SAP Transaction Notifications
SAP Business One calls SBO_SP_TransactionNotification on every committed transaction. You edit the body; SAP defines only the signature.
Quick Start
Add a guard inside the BEGIN … END block. Always use ALTER PROCEDURE (never CREATE) — the procedure already exists in the company database:
IF :object_type = '4' AND (:transaction_type = 'A' OR :transaction_type = 'U') THEN
CALL "MYAPP_TN_OBJ004_OITM" (:list_of_cols_val_tab_del, :transaction_type, :error, :error_message);
END IF;
Procedure Signature
ALTER PROCEDURE SBO_SP_TransactionNotification
(
IN object_type nvarchar(30),
IN transaction_type nchar(1),
IN num_of_cols_in_key int,
IN list_of_key_cols_tab_del nvarchar(255),
IN list_of_cols_val_tab_del nvarchar(255)
)
LANGUAGE SQLSCRIPT
AS
error int;
error_message nvarchar(200);
BEGIN
error := 0;
error_message := N'Ok';
-- routing guards go here
SELECT :error, :error_message FROM dummy; -- mandatory return
END;
Always initialise error := 0 / error_message := N'Ok' as the first two statements.
Always end with SELECT :error, :error_message FROM dummy; — SAP reads return values through this SELECT. Omitting it silently swallows all errors.
Transaction Types
| Code | Meaning |
|---|---|
A |
Add — new record committed |
U |
Update — record updated |
D |
Delete — record deleted |
C |
Cancel — document cancelled |
L |
Close — document closed |
Sub-procedure Naming
Pattern: [PROJECT]_TN_OBJ[nnn]_[TABLE] — prefix with a project token to avoid collisions.
| Segment | Meaning | Example |
|---|---|---|
nnn |
zero-padded object type code | 004, 017 |
TABLE |
SAP table name | OITM, ORDR |
Examples: MYAPP_TN_OBJ004_OITM, MYAPP_TN_OBJ017_ORDR
Object type codes: see references/stored-procedure.md.
Error Contract
Return error = 0 for success (SAP commits). Return error ≠ 0 to block the transaction — SAP rolls back and shows error_message to the user. Only block for truly fatal errors.
See Also
- Full annotated skeleton, routing patterns, primary key parsing → references/stored-procedure.md
More from kehwar/skills
to-prd
Turn the current conversation context into a PRD and publish it to Beads Issue Tracker. Use when user wants to create a PRD from the current context.
11setup-workflow-skills
Sets up an `## Agent orientation` block in AGENTS.md/CLAUDE.md so the engineering skills know this repo uses Beads for issue tracking. Run before first use of `to-tasks`, `to-prd`, `tdd`, `improve-codebase-architecture`, or `zoom-out`.
11tdd
Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development. Tracks progress in Beads Issue Tracker.
10write-a-skill
Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, or build a new skill.
9to-tasks
Break a plan, spec, or PRD into independently-grabbable tasks/issues on Beads Issue Tracker using tracer-bullet vertical slices. Use when user wants to convert a plan into tasks, create implementation tickets, or break down work into tasks.
9grill-me
Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".
8