White paper On Business Transaction Events (BTE) created by Rithin Shah on Nov 27, 2013 6:34 AM, last modified by Rithin Shah on Nov 27, 2013 6:54 AM Version 1 inShare1 Overview Concept of Enhancement Enhancement means "Adding new functionality to the standard SAP according to the requirement". Underlying concept behind enhancements in SAP is very simple. In a nutshell, “SAP delivers a standard version of software comprised of several repository objects. SAP anticipates that this standard version of its software may not be fit for use right away. So, it has made a provision in its repository objects for customers to plug-in their developed repository objects. The provisions made by SAP keep looking for the repository objects plugged-in by customers. With these plugged-in objects, the enhanced version of SAP software becomes fit for customer’s business process”. Enhancement Techniques Depending on the type of repository objects which need to be enhanced and also the influences of the technological advancements, there are various techniques using which enhancement provisions are made in SAP software. Since, SAP ensures downward compatibility during software upgrades, SAP has to keep supporting the enhancement provisions made in past using deprecated enhancement techniques. As a technical consultant, we should be aware of all enhancement techniques. The major enhancement techniques used in various SAP applications are listed below: Enhancing Tables/Structures using Append Structure & Customizing Includes Enhancing Data Elements using Transaction CMOD Customer Exits – Function Module Exits, Menu Exits and Screen Exits Business Transaction Events Business Add-Ins (BAdI) Enhancement Framework R/3 provides three "customization spots" that allow you to enhance FI/CO features without modifying the standard code. Although often collectively referred to as "user exits," two of the three have different names. SAP Enhancements are used to expand the standard functionality within SAP. Enhancements use function modules and are called from the standard SAP code. Each module in the system has a set of delivered enhancements that help companies expand the standard functionality where they need it. The Open FI Interfaces or Business Transaction Events are also used to expand the standard functionality within SAP. These events are defined in the IMG. Business Transaction Events were new in release 4.0. They are not available for all modules and are not called on all integrated transactions into FI as of release 4.5B. This will change with each release and should be retested. Benefits Standard SAP functionality can be enhanced without modification to the standard code. - Upgrades do not erase the functionality and it does not have to be re-transported or re-entered into the system. The enhancements should be thoroughly tested Let us go in detail and try to understand what is BTE, under what circumstance it can be executed and the solution which is implemented in current business scenario. What are Business Transaction Events? - Business Transaction Events (BTE) allows you to attach additional components, in the form of a function module, for example, to the R/3 system. BTE are comparable to the old enhancements and are used mostly within FI BTEs can be used both by SAP, third party vendors and customers. Each uses their own function modules where the logic is placed, so they don't interfere with each other. Process BTE is a function module (Implemented by the customer) that has a standard interface defined by SAP. The BTE is called by the SAP standard program by a call to function OPEN_FI_PERFORM_<BTE-number> or OUTBOUND_CALL_<BTEnumber>. This function checks if there are any active BTEs according to customizing. Structure SAP provides sample function modules (called SAMPLES) for each event, which describes the interface and can be used as a template for modules to be developed. To use a SAMPLE, copy it into your namespace and finish programming it. Modules Functional modules determine active applications or implementations for various enhancements and place these enhancements in an internal table. The internal table defines the sequence to process the implementation of function modules. The system considers the conditions that cause the function module to process customer attributes, such as applications, locations and products, and displays these conditions as filter values. A. a) b) Finding Business Transaction Events SAP Reference IMG àFinancial Accounting à Financial Accounting Global Settings à Business Transaction Events For Publish and Subscribe Interfaces, Environment àInfo system (P/S) For Process Interfaces, Environment àInfo system (Processes) Find for Character String “OPEN_FI_PERFORM” in source code from SE37 Types of Interfaces: There are 2 types of interface available in the General Ledger Accounting (FI-GL), Accounts Receivable and Accounts Payable (FI-AR/FI-AP) and Sales and Distribution (SD) components. Publish and Subscribe Interfaces Process Interfaces Publish & Subscribe interfaces: These interfaces inform external software that certain events have taken place in an SAP standard application and provide them with the data produced. The external software returns no data to the SAP Standard System. Means the Event FM only provides the Document number or anything that is coming in the FM Import interface in order to trigger some other external process. You have no control on changing SAP code from this FM. You can just use that info and do additional tasks outside of that SAP process Process interfaces : These interfaces are used to control a business process differently than the way in which it is handled in the standard R/3 System. They intervene in the standard process, and return data to the SAP application. Means that Event FM provides both Import and changing parameters which allows you to take control of the process and influence what the changing parameters values are going to be used once the control returns back from this FM back to its caller. Basic Steps in Configuring Business Transaction Events Make sure the application is active for Business Transaction Events. Identify the BTE Copy the sample interface function module into a "Z” or “Y” function module. Write the ABAP code into the source code section of the new "Z” or “Y” function module. You may choose to create a "Z” or “Y” program to enter the code into and then insert the "Z" or “Y” program into your function module source code. Save and activate the function module. Assign the function module to the event, country and application. Menu path A. Go to IMG Menu Path: Financial Accounting à Financial Accounting Global SettingsàBusiness Transaction Events: Hence forth for our training purpose we would only use t-code FIBF. Let us distinguish with example when publish and subscribe interface is used and when process interface can be implemented. 1. 1. 2. 3. Examples: 1. Business Scenario for BTE - Publish & Subscribe interfaces Requirement: Display the Debit (Dr)/Credit (Cr) Indicator and Amount Column in Line items Reports for our implementation companies in India. According to client Accounts Dept, they would like to have Debit & Credit amount and indicators (‘Dr’ or ‘Cr’) in separate columns in all the standard line item reports viz. FBL*N. Currently in the existing SAP standard line item reports the amounts for Debit and Credit are shown in the same column with positive or negative sign and the indicator shown is according to the SAP technical indicator which is S (Debit) or H (Credit). These terminologies and the way amounts are depicted are difficult for the users to understand or report. In the current SAP Standard Line Item Report the Debit and Credit amounts are displayed in the same column with or without a negative sign (i.e. ‘-’). This is to be interpreted as below: Amount without a negative sign indicates Debit Amount. Amount with a negative sign indicates Credit Amount. If the user wants to show the Dr./Cr. indicator alongside the amount then the SAP standard report displays S for Debit and H for Credit. However the users in Indian companies have been reporting to legal authorities as well as the management in the format shown below: 1. 2. 3. 4. o o o o 1. Difficulties faced by user on the current SAP Line Item Reports The user cannot split the amount easily into different Debit or Credit columns from the SAP line items, without additional manual efforts. It takes manual efforts from users to modify the debit/credit indicator manually from S or H to Dr or Cr. The auditors in India may not be able to make out whether the line item is a Debit or Credit Users encounter difficulties in differentiating the SAP line items when there are Partial Payments/Clearings/Debit notes or Credit notes. Solution and its advantages The above difficulties can be solved by a simple configuration in FI and a minor development from the technical side. The solution is driven by using the Business Transaction Events (BTE) for the Line Items Layout Display and by adding “Z” fields to the line item layout structure. A Function Module is written to populate the values into these “Z” fields whenever the BTE triggers at the time of Line Item Display execution. This solution will be reflected in the below line item reports * FBL1N * FBL3N * FBL5N Advantages of the Solution: This solution will have no impact to any existing configuration or development. The fields will be available in the line layout for all the company codes irrespective of the countries. These fields can be made available to any company code interested to view them in their report layouts. The development or customizing will not do any modification on the data in any of the database tables. It works only at the time of line item report display. Configuration Steps Required Below steps shown are simple configurations that are required for new Debit and Credit Amount and Indicator columns. Create a Product in Business Transaction Events(BTE): Go to FIBF transaction code > Settings in menu bar > Products > Customer > Create one product as ZDRCR and save. 2. 3. 1. • • • 2. 3. Create an Event(Std) and Assign Product & Customized Functional Module: FIBF Transaction code > Settings in menu bar > P/S module > Of customer > take event as 00001650 > choose the product as ZDRCR > choose the Function module as SAMPLE_INTERFACE_00001650. Note: - Create standard FM as Z through SE37. Activate the Product (ZDRCR): FIBF > Settings in menu bar > Products > Customer > activate ZDRCR product (Check box). Development Steps Required Create 3 Z fields in RFPOS & RFPOSX structures: Append the 3 Z Fields in the above mentioned structures. The Z fields are as below: ZSHKZG - Spl Debit/Credit Indicator, for the display of Debit or Credit Indicator in the Line Layout ZDEB_AMT - Debit Amount, for the display of the Debit Amount, if it is Debit Indicator ZCRE_AMT -Credit Amount, for the display of the Credit Amount, if it is Credit Indicator Create a custom function module by copying the same interface parameters of FM SAMPLE_INTERFACE_00001650 Create a new customizing FM or use the existing customized function module of 1650 event Write the logic in the customized FM to populate the extra fields as per your requirement. The logic should copy values into the new fields for the source as mentioned below: ZSHKZG - Spl. Debit/Credit Indicator, values to be copied from BSEGdisplay as Dr if source is stored as S and Cr if source is stored as H ZDEB_AMT - Debit Amount, values to be copied from BSEG-DMBTR only if BSEG-SHKZG = “S” ZCRE_AMT - Credit Amount, values to be copied from BSEG-DMBTR only if BSEG-SHKZG = “H” Note: This logic can be restricted to certain company codes or it can be available for all. Run the program “RFPOSXEXTEND” ( Extend Z fields ) 4. SHKZG and “ IF lt_bseg-shkzg = 'S'. e_postab-zzshkzg = 'DR'. e_postab-zzdeb_amt = lt_bseg-dmbtr. ELSEIF lt_bseg-shkzg = 'H'. e_postab-zzshkzg = 'CR'. e_postab-zzcre_amt = lt_bseg-dmbtr.” Output of the Line Item Report after the development Line Item Report Layout Change Screen – The extra fields will be available in the Hidden fields section in the entire line items layout, select and copy to the left section to display on the screen Ø FBL1N – Vendor Line Item Report Ø FBL3N – Vendor Line Item Report Ø FBL5N – Customer Line Item Report 1. 2. Business Scenario for BTE - Process Interface Requirement: Client would like to activate the duplicate invoice check functionality when an accounting document is posted for vendor invoicing. - Difficulties faced by user on the current posted documents: Users have to manually use the change document to update the values in assignment field Chances are there that few documents might be missed due to manual update Pre-requisites: It is a prerequisite to check duplicate invoices that you have set the indicator for the check for duplicate invoice/credit memo on screen "Payment transactions accounting" in the vendor master. Vendor master setting for duplicate If we check the BSIP table it would display the duplicate entry: o o o 1. Solution and its advantages The above issue can be resolved by configuration in FI along with minor ABAP development. The solution is driven by using BTE at process level. Solution would be reflected during the FB60 transaction creation Advantages of the Solution: This solution will have no impact to any existing configuration or development. This check can be made available to any company code interested during document creation. The development or customizing will not do any modification on the data in any of the database tables. It works only at the time of creation of invoice. Configuration Steps Required Create a Product in Business Transaction Events(BTE): Go to FIBF transaction code > Settings in menu bar > Products > Customer > Create one product as ZFDUPINV and save. 1. Create an Event(Std) and Assign Product & Customized Functional Module FIBF Transaction code > Settings in menu bar > Process modules > Of customer > take event as 00001110 > choose the product as ZFDUPINV > choose the Function module as ZDUP_INV_PROCESS_00001110. Note: - Create standard FM as Z through SE37. 3. Activate the Product (ZDRCR): FIBF > Settings in menu bar > Products > Customer > activate ZDRCR product (Check box). SAP Note 305201 clarifies this in a more details; please read it. The following fields must be identical for Duplicate invoice check: Company code (BUKRS); Vendor number (LIFNR); Currency (WAERS); Document date (BLDAT) Reference number (XBLNR); Amount in document currency (WRBTR) Note: If the document is having any one of the above field different then the system does not consider it as a duplicate invoice. Development Steps Required 1. You are now in transaction SE37 – Function Builder. This is the function module (SAMPLE_PROCESS_00001110) you will need to copy into a "Z" or “Y” name function module for your coding. Copy “ZDUP_INV_PROCESS_00001110” DATA it_bsip TYPE STANDARD TABLE OF bsip. DATA v_count TYPE i. SELECT * FROM bsip INTO TABLE it_bsip WHERE bukrs = i_bukrs AND waers = i_waers AND lifnr = i_lifnr AND wrbtr = i_wrbtr AND bldat = i_bldat AND xblnr = i_xblnr. IF sy-subrc = 0. DESCRIBE TABLE it_bsip LINES v_count. IF v_count GT 1. MESSAGE 'Entry already exist for company code.' TYPE 'E'. ENDIF. Output During the creation of invoice after the development: After the development since there is already an entry with same details, based on our BTE development the system throws an error message as shown below: Thus based on the requirement, Publish and Subscribe Interfaces or Process Interfaces needs to be configured. References taken: http://scn.sap.com/ http://help.sap.com/