BTE (Business Transaction Event) is an enhancement technique in SAP used to insert custom logic into standard SAP processes without modifying SAP’s standard code.
- Similar to User-Exits or BAdIs, but more specific to Financial Accounting (FI), Accounts Receivable (AR), Accounts Payable (AP), and related modules.
- It allows us to enhance SAP standard functionality during business transactions like posting documents, clearing open items, etc.
- Controlled by event numbers, which SAP triggers at predefined points in the standard process.
Where is BTE Used?
- In FI (e.g., validations, substitutions in postings).
- In SD and MM indirectly via FI postings.
- Examples:
- Triggering custom checks before posting an invoice.
- Sending data to a 3rd-party system after payment posting.
- Adding customer-specific logic during clearing.
Steps to Implement a BTE
1. Find the Relevant Event
- Use Transaction FIBF → Environment → Info System → Business Transaction Events
- Search by process (e.g., FI posting).
- Example event: 00001030 – “Sample process for document posting”.
2. Create a Product
- Go to FIBF → Environment → Products → Of a customer
- Create a new product (
ZBTE_001
) - Mark it as “Active”.
3. Assign the Event to Your Product
- FIBF → Environment → Process Modules → Of a customer
- Enter the event (e.g., 00001030)
- Assign your product.
- Specify the function module that will run.
4. Create a Function Module
- Copy a sample function module delivered by SAP (they start with
SAMPLE_PROCESS_...
). - Create your own in customer namespace (
Z_...
). - Add your logic.
FUNCTION Z_BTE_DOC_POST.
*”———————————————————————-
*”*”Interface:
*” IMPORTING
*” VALUE(I_BKPF) TYPE BKPF ” Document Header
*” VALUE(I_BSEG) TYPE BSEG ” Document Line
*” EXPORTING
*” VALUE(E_SUBRC) TYPE SY-SUBRC
*”———————————————————————-
DATA: lv_msg TYPE string.
” Example: Block posting if document type is SA and amount > 10,000
IF I_BKPF-BLART = ‘SA’ AND I_BSEG-DMBTR > 10000.
MESSAGE ‘Manual journal entry > 10000 not allowed’ TYPE ‘E’.
E_SUBRC = 1. ” Error
ELSE.
E_SUBRC = 0. ” Success
ENDIF.
ENDFUNCTION.
5. Test Your BTE
- Run the transaction (e.g., FB01 or F-02 for posting).
- Your custom logic should trigger.
Example Use Case
Business Requirement:
Block manual journal entries (Document Type SA
) above 10,000
unless entered by a specific user.
Implementation:
-
BTE Event: 00001030 (FI Document Posting)
-
Function Module:
Z_BTE_DOC_POST
(as shown above). -
Logic checks the
Document Type
,Amount
, andUser
.