- ABAP Development - Business Transaction Event - RWBAPI01 - For Accounting Document Interface

August 1, 2017 | Author: Adi Bathineni | Category: Financial Transaction, Payments, Debits And Credits, Corporate Jargon, Technology
Share Embed Donate


Short Description

Business Transaction Event - RWBAPI01 - For Accounting Document Interface...

Description

3/3/13

SAP Community Network Wiki - ABAP Development - Business Transaction Event - RWBAPI01 - For Accounting Document Interface Welcome, Guest Login Register Getting Started Newsletters Store

Solutions Services & Support About SCN Downloads Industries Training & Education Partnership Developer Center Lines of Business University Alliances Events & Webinars Innovation

Business Transaction Event - RWBAPI01 - For Accounting Document Interface Added by Vinod Kumar, edited by Moshe Naveh on Jul 22, 2010

You are viewing an old version of this page. View the current version. Compare with Current | View Page History >

Business Transaction Event - RWBAPI01 - For Accounting Document Interface

Useful Inform ation Short quick summary to catch the

Link to Content's target Space : http://w iki.sdn.sap.com/w iki/display/ABAP/BTE+-+Business+Transaction+Event

reader's attention and of course the search engine

BTE, RWBAPI01, BAPI_ACC_DOCUMENT_POST, Business

Applies to:

Transaction Events, FICO, FI

SAP 4.7x and above.

Summary While Creating the Accounting document through BAPI - BAPI_ACC_DOCUMENT_POST posting keys are determined automatically based on the configuration. Since this BAPI doesn't have any structure field to pass the posting key, posting keys are picked up automatically based on the document type passed in BAPI header structure. This document narrates how to change the default posting key w hile creating the Accounting document using the above BAPI. This document also explains the steps involved in implementing a Business Transaction Event.

Author(s): Vinod Kumar T

Com pany:

NIIT Technologies Limited

Created on:

20.07.2010

Author(s) Bio Vinod Kumar is an ABAP Consultant w orking w ith NIIT Technologies Limited.

Posting of Accounting Document Using BAPI - BAPI_ACC_Document Post Scenario Create the accounting document for Customer advance payment against Net-banking transaction. Document is to be created w ith the accounting document type (DZ-Customer Payment). Based on the Configuration, Customer line item is posted against the posting key 01(Invoice-Debit) and GL Account line item is posted against the posting key 50(GL-Credit). Since the FI documents of customer payment and Advance payment is to be separated, Customer line item of above entries are to be posted w ith posting key 04 (Other Receivables - Debit) and GL Account line item to be posted w ith posting key 50 (GL - Credit)

Additional Structure for BAPI For passing the additional data related to posting keys, Structure EXTENSION1 is to be filled w ith the required data. Business Transaction Event used for changing the Posting key w ill be executed only w hen the record(s) are available in this structure. See the Call to BTE in line number 59 of BAPI.

Code for Creating Account document using BAPI

wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=195726664

1/4

3/3/13

SAP Community Network Wiki - ABAP Development - Business Transaction Event - RWBAPI01 - For Accounting Document Interface

Code for Creating Account document using BAPI 001. 002. 003. 004. 005. 006. 007. 008. 009. 010. 011. 012. 013. 014. 015. 016. 017. 018. 019. 020. 021. 022. 023. 024. 025. 026. 027. 028. 029. 030. 031. 032. 033. 034. 035. 036. 037. 038. 039. 040. 041. 042. 043. 044. 045. 046. 047. 048. 049. 050. 051. 052. 053. 054. 055. 056. 057. 058. 059. 060. 061. 062. 063. 064. 065. 066. 067. 068. 069. 070. 071. 072. 073. 074. 075. 076. 077. 078. 079. 080. 081. 082. 083. 084. 085. 086. 087. 088. 089. 090. 091. 092. 093. 094. 095. 096. 097. 098. 099. 100. 101. 102. 103. 104. 105. 106. 107.

REPORT zacctesting. ** Internal table and Work area declarations DATA : wa_documentheader TYPE bapiache09, it_accountgl TYPE STANDARD TABLE OF bapiacgl09, wa_accountgl TYPE bapiacgl09, it_accountreceivable TYPE STANDARD TABLE OF bapiacar09, wa_accountreceivable TYPE bapiacar09, it_currencyamount TYPE STANDARD TABLE OF bapiaccr09, wa_currencyamount TYPE bapiaccr09, it_return TYPE STANDARD TABLE OF bapiret2, wa_return TYPE bapiret2, it_extension1 TYPE STANDARD TABLE OF bapiacextc, wa_extension1 TYPE bapiacextc. DATA : doc_amt_cr doc_amt_dr DATA: lv_type lv_key lv_sys

TYPE bapiwrbtr VALUE '-50.00', TYPE bapiwrbtr VALUE '50.00'. TYPE bapiache09-obj_type, TYPE bapiache09-obj_key, TYPE bapiache09-obj_sys.

** clear internal table REFRESH :it_accountgl, it_accountreceivable, it_currencyamount, it_return, it_extension1. ** Fill header data. CLEAR : wa_documentheader. MOVE sy-uname TO wa_documentheader-username. "Username" MOVE 'Test' TO wa_documentheader-header_txt."Header Text" MOVE '0103' TO wa_documentheader-comp_code. "Company Code" MOVE sy-datum TO wa_documentheader-doc_date. "Doc Date" MOVE sy-datum TO wa_documentheader-pstng_date."Posting Date" MOVE 'DZ' TO wa_documentheader-doc_type. "Doc Type" MOVE 'Test' TO wa_documentheader-ref_doc_no."Reference" MOVE 'RFBU' TO wa_documentheader-bus_act. MOVE 'BKPFF' TO wa_documentheader-obj_type. "Comment for >= ECC5.0 MOVE '$' TO wa_documentheader-obj_key. "Comment for >= ECC5.0 MOVE sy-mandt TO wa_documentheader-obj_sys. "Comment for >= ECC5.0 **Fill GL Account Line item. CLEAR : wa_accountgl, wa_currencyamount. MOVE '0000000001' TO wa_accountgl-itemno_acc. "Line Item No" MOVE '0014000041' TO wa_accountgl-gl_account. "G/L Account" MOVE 'ItemTest' TO wa_accountgl-item_text. "Item Text" MOVE '0103' TO wa_accountgl-comp_code. "Company Code" MOVE '0000900390' TO wa_accountgl-profit_ctr. "Profit Center" MOVE 'Assign1' TO wa_accountgl-alloc_nmbr. "Assignment" APPEND wa_accountgl TO it_accountgl. MOVE '0000000001' TO wa_currencyamount-itemno_acc. "Line Item No" MOVE '00' TO wa_currencyamount-curr_type. "Currency Type" MOVE 'INR' TO wa_currencyamount-currency. "Currency" MOVE doc_amt_cr TO wa_currencyamount-amt_doccur. "Amount" APPEND wa_currencyamount TO it_currencyamount. ** Fill Customer Line item CLEAR :wa_accountreceivable, wa_currencyamount. MOVE '0000000002' TO wa_accountreceivable-itemno_acc. "Item No" MOVE '0001000076' TO wa_accountreceivable-customer. "Customer" MOVE 'ItemTest' TO wa_accountreceivable-item_text. "Item Text" MOVE '0103' TO wa_accountreceivable-comp_code. "Company Code" MOVE 'Assign2' TO wa_accountreceivable-alloc_nmbr. "Assignment. APPEND wa_accountreceivable TO it_accountreceivable. MOVE '0000000002' TO wa_currencyamount-itemno_acc. "Line Item No" MOVE '00' TO wa_currencyamount-curr_type. "Currency Type" MOVE 'INR' TO wa_currencyamount-currency. "Currency" MOVE doc_amt_dr TO wa_currencyamount-amt_doccur. "Amount" APPEND wa_currencyamount TO it_currencyamount. **Fill Extension1 Structure used by BTE **Posting key is to be changed for only for Customer line item (0000000002) **Records in this internal table will be checked in BTE CLEAR : wa_extension1. MOVE '000000000204' TO wa_extension1-field1. APPEND wa_extension1 TO it_extension1. ** Call Bapi CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST' EXPORTING documentheader = wa_documentheader IMPORTING "Comment for >=ECC5.0 obj_type = lv_type "Comment for >=ECC5.0 obj_key = lv_key "Comment for >=ECC5.0 obj_sys = lv_sys "Comment for >=ECC5.0 TABLES accountgl = it_accountgl accountreceivable = it_accountreceivable currencyamount = it_currencyamount extension1 = it_extension1 return = it_return. ** Check for errors. CLEAR : wa_return. READ TABLE it_return INTO wa_return WITH KEY type = 'E'. IF sy-subrc NE 0. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. ENDIF. ** display the output LOOP AT it_return INTO wa_return. WRITE :/ wa_return-type, wa_return-id, wa_return-number, wa_return-message. ENDLOOP.

wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=195726664

2/4

3/3/13

SAP Community Network Wiki - ABAP Development - Business Transaction Event - RWBAPI01 - For Accounting Document Interface

Implementing Business Transaction Event - RWBAPI01 Code for BTE Function Module Step 1: Create a New function group using transaction code SE80 Step 2: Copy the standard function module of BTE "SAMPLE_INTERFACE_RWBAPI01" to a Z Function module, say "ZSAMPLE_INTERFACE_RWBAPI01" Step 3: Add Follow ing Code into the new function module and activate 01. 02. 03. 04. 05. 06. 07. 08. 09. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22.

FUNCTION zsample_interface_rwbapi01. *"-------------------------------------------------------------------*"*"Local Interface: *" TABLES *" IT_ACCIT STRUCTURE ACCIT *" IT_ACCCR STRUCTURE ACCCR *" RETURN STRUCTURE BAPIRET2 *" EXTENSION STRUCTURE BAPIACEXTC *" IT_ACCWT STRUCTURE ACCIT_WT *" CHANGING *" VALUE(DOCUMENT_HEADER) LIKE ACCHD STRUCTURE ACCHD *"-------------------------------------------------------------------DATA : wa_extension TYPE bapiacextc. CLEAR: wa_extension. LOOP AT extension INTO wa_extension. READ TABLE it_accit WITH KEY posnr = wa_extension-field1(10). IF sy-subrc EQ 0. it_accit-bschl = wa_extension-field1+10(2). MODIFY it_accit INDEX sy-tabix. ENDIF. ENDLOOP. ENDFUNCTION.

Configuration Step 1: Go To Transaction code FIBF Step 2: Add Customer Product. Use Menu Option : Settings -> Products -> ...of a Customer

Step 3: Save the Product. Step 4: Create a Link betw een BTE and Product created in Step2. Use the menu option : Settings -> Process Modules -> ... of a customer

Step 5: Save the Link.

Summary When the BAPI is executed, Code w ritten in the BTE - function module w ill be executed and the posting key of related line item w ill be changed before posting the documents.

Related Content https://forums.sme.sap.com/message.jspa?messageID=8284886 http://forums.sdn.sap.com/message.jspa?messageID=9288661 http://forums.sdn.sap.com/thread.jspa?threadID=999473

wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=195726664

3/4

3/3/13

SAP Community Network Wiki - ABAP Development - Business Transaction Event - RWBAPI01 - For Accounting Document Interface

Follow SCN Contact Us SAP Help Portal Privacy Terms of Use Legal Disclosure Copyright

wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=195726664

4/4

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF