You are on page 1of 4

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
<< Previous Version 8 Next >>

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

Useful Inform ation Short quick summary to catch the reader's attention and of course the search engine

Applies to:
SAP 4.7x and above.

BTE, RWBAPI01, BAPI_ACC_DOCUMENT_POST, Business Transaction Events, FICO, FI

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: Created on:

NIIT Technologies Limited 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

" R e f e r e n c e " M O V E' R F B U ' T Ow a _ d o c u m e n t h e a d e r b u s _ a c t . T Y P Eb a p i a c h e 0 9 o b j _ s y s . w a _ r e t u r n T Y P Eb a p i r e t 2 . 0 6 9 . 0 9 5 . 0 2 0 . i t _ c u r r e n c y a m o u n t T Y P ES T A N D A R DT A B L EO Fb a p i a c c r 0 9 . " C o m p a n yC o d e " M O V E' A s s i g n 2 ' T Ow a _ a c c o u n t r e c e i v a b l e a l l o c _ n m b r . 0 2 3 . 0 7 9 . 0 2 1 . 0 9 4 .w a _ c u r r e n c y a m o u n t . 0 1 7 .Business Transaction Event . D A T A:d o c _ a m t _ c r d o c _ a m t _ d r D A T A : l v _ t y p e l v _ k e y l v _ s y s T Y P Eb a p i w r b t rV A L U E' 5 0 . wiki. M O V E' 0 0 0 0 0 0 0 0 0 1 'T Ow a _ c u r r e n c y a m o u n t i t e m n o _ a c c . 0 9 0 . 1 0 3 . 0 2 5 . 0 9 8 . E N D L O O P . 0 5 6 .RWBAPI01 . 0 4 3 . 0 9 7 . i t _ a c c o u n t r e c e i v a b l e . 0 * * F i l lG LA c c o u n tL i n ei t e m . 0 6 8 . 0 o b j _ t y p e =l v _ t y p e " C o m m e n tf o r> = E C C 5 . * *I n t e r n a lt a b l ea n dW o r ka r e ad e c l a r a t i o n s D A T A:w a _ d o c u m e n t h e a d e r T Y P Eb a p i a c h e 0 9 . 0 0 5 . 0 1 1 . 1 0 0 . " I t e mT e x t " M O V E' 0 1 0 3 ' T Ow a _ a c c o u n t g l c o m p _ c o d e . 0 1 3 . " L i n eI t e mN o " M O V E' 0 0 ' T Ow a _ c u r r e n c y a m o u n t c u r r _ t y p e . 0 2 4 . M O V E' 0 0 0 0 0 0 0 0 0 1 'T Ow a _ a c c o u n t g l i t e m n o _ a c c . " L i n eI t e mN o " M O V E' 0 0 1 4 0 0 0 0 4 1 'T Ow a _ a c c o u n t g l g l _ a c c o u n t . 0 7 0 . 0 4 0 . 0 9 3 . 0 8 8 . 0 6 0 . i t _ a c c o u n t g l T Y P ES T A N D A R DT A B L EO Fb a p i a c g l 0 9 . " C o m m e n tf o r> =E C C 5 . 1 0 5 . 0 1 0 . M O V Es y u n a m e T Ow a _ d o c u m e n t h e a d e r u s e r n a m e . 0 5 7 . 0 3 8 . 0 5 1 . 1 0 2 .sdn. 0 0 7 . 0 4 2 . 0 8 2 . 0 3 0 . 0 8 7 . 0 8 9 . 0 5 9 . 0 8 6 . 0 7 5 . 0 7 7 . " D o cT y p e " M O V E' T e s t ' T Ow a _ d o c u m e n t h e a d e r r e f _ d o c _ n o . 0 o b j _ s y s =l v _ s y s " C o m m e n tf o r> = E C C 5 . 0 0 6 . 0 5 4 . 0 7 6 . M O V E' 0 0 0 0 0 0 0 0 0 2 'T Ow a _ a c c o u n t r e c e i v a b l e i t e m n o _ a c c . 0 3 7 . 0 1 2 . 0 1 9 . 0 1 6 . 0 5 0 . 0 T A B L E S a c c o u n t g l =i t _ a c c o u n t g l a c c o u n t r e c e i v a b l e=i t _ a c c o u n t r e c e i v a b l e c u r r e n c y a m o u n t =i t _ c u r r e n c y a m o u n t e x t e n s i o n 1 =i t _ e x t e n s i o n 1 r e t u r n =i t _ r e t u r n . 0 o b j _ k e y =l v _ k e y " C o m m e n tf o r> = E C C 5 . W R I T E: /w a _ r e t u r n t y p e . 0 5 2 . 0 3 1 . M O V E' B K P F F ' T Ow a _ d o c u m e n t h e a d e r o b j _ t y p e . " C o m p a n yC o d e " M O V E' 0 0 0 0 9 0 0 3 9 0 'T Ow a _ a c c o u n t g l p r o f i t _ c t r .w a _ c u r r e n c y a m o u n t . 0 3 2 . 0 6 7 . 0 3 3 . " C o m m e n tf o r> =E C C 5 . " C u r r e n c yT y p e " M O V E' I N R ' T Ow a _ c u r r e n c y a m o u n t c u r r e n c y . 0 0 ' . 0 0 4 . 0 7 4 . w a _ a c c o u n t g l T Y P Eb a p i a c g l 0 9 . R E A DT A B L Ei t _ r e t u r nI N T Ow a _ r e t u r nW I T HK E Yt y p e=' E ' . 0 6 6 . " P o s t i n gD a t e " M O V E' D Z ' T Ow a _ d o c u m e n t h e a d e r d o c _ t y p e . 1 0 1 . * *d i s p l a yt h eo u t p u t L O O PA Ti t _ r e t u r nI N T Ow a _ r e t u r n . I Fs y s u b r cN E0 . 1 0 4 . 0 7 3 . C L E A R:w a _ d o c u m e n t h e a d e r . " C u r r e n c y " M O V Ed o c _ a m t _ d r T Ow a _ c u r r e n c y a m o u n t a m t _ d o c c u r . " C u r r e n c yT y p e " M O V E' I N R ' T Ow a _ c u r r e n c y a m o u n t c u r r e n c y . " U s e r n a m e " M O V E' T e s t ' T Ow a _ d o c u m e n t h e a d e r h e a d e r _ t x t . i t _ e x t e n s i o n 1 . A P P E N Dw a _ a c c o u n t r e c e i v a b l eT Oi t _ a c c o u n t r e c e i v a b l e . 0 4 4 . " A s s i g n m e n t " A P P E N Dw a _ a c c o u n t g lT Oi t _ a c c o u n t g l . w a _ r e t u r n m e s s a g e . 0 0 2 . 0 6 3 .For Accounting Document Interface R E P O R T z a c c t e s t i n g . A P P E N Dw a _ e x t e n s i o n 1T Oi t _ e x t e n s i o n 1 . 0 1 4 . * *C a l lB a p i C A L LF U N C T I O N' B A P I _ A C C _ D O C U M E N T _ P O S T ' E X P O R T I N G d o c u m e n t h e a d e r =w a _ d o c u m e n t h e a d e r I M P O R T I N G " C o m m e n tf o r> = E C C 5 . 0 M O V E' $ ' T Ow a _ d o c u m e n t h e a d e r o b j _ k e y . 0 2 8 . i t _ a c c o u n t r e c e i v a b l eT Y P ES T A N D A R DT A B L EO Fb a p i a c a r 0 9 . 0 7 8 . 0 9 2 . " L i n eI t e mN o " M O V E' 0 0 ' T Ow a _ c u r r e n c y a m o u n t c u r r _ t y p e . 0 5 8 . M O V E' 0 0 0 0 0 0 0 0 0 2 'T Ow a _ c u r r e n c y a m o u n t i t e m n o _ a c c . " C o m m e n tf o r> =E C C 5 . T Y P Eb a p i a c h e 0 9 o b j _ t y p e .com/wiki/pages/viewpage. C A L LF U N C T I O N' B A P I _ T R A N S A C T I O N _ C O M M I T ' . * *F i l lh e a d e rd a t a . 0 9 9 . 0 4 1 .ABAP Development . * *F i l lC u s t o m e rL i n ei t e m C L E A R: w a _ a c c o u n t r e c e i v a b l e ." A m o u n t " A P P E N Dw a _ c u r r e n c y a m o u n tT Oi t _ c u r r e n c y a m o u n t . 0 0 ' . 0 8 3 . " C u s t o m e r " M O V E' I t e m T e s t ' T Ow a _ a c c o u n t r e c e i v a b l e i t e m _ t e x t . 0 5 3 . 0 2 9 . 0 9 6 . " G / LA c c o u n t " M O V E' I t e m T e s t ' T Ow a _ a c c o u n t g l i t e m _ t e x t . i t _ r e t u r n . T Y P Eb a p i w r b t rV A L U E' 5 0 . C L E A R:w a _ r e t u r n .sap." I t e mN o " M O V E' 0 0 0 1 0 0 0 0 7 6 'T Ow a _ a c c o u n t r e c e i v a b l e c u s t o m e r . 0 0 8 . 0 4 8 . 0 4 5 ." C o m p a n yC o d e " M O V Es y d a t u m T Ow a _ d o c u m e n t h e a d e r d o c _ d a t e . SAP Community Network Wiki . 0 2 2 . 0 8 4 . E N D I F . w a _ a c c o u n t r e c e i v a b l eT Y P Eb a p i a c a r 0 9 . 0 0 3 . 0 6 5 . 0 6 4 . 0 6 2 . 0 0 9 . 0 1 5 . w a _ c u r r e n c y a m o u n t T Y P Eb a p i a c c r 0 9 ." A s s i g n m e n t . 1 0 6 .action?pageId=195726664 2/4 . " H e a d e rT e x t " M O V E' 0 1 0 3 ' T Ow a _ d o c u m e n t h e a d e r c o m p _ c o d e . 1 0 7 . " P r o f i tC e n t e r " M O V E' A s s i g n 1 ' T Ow a _ a c c o u n t g l a l l o c _ n m b r . w a _ e x t e n s i o n 1 T Y P Eb a p i a c e x t c . 0 1 8 . 0 2 7 . M O V E' 0 0 0 0 0 0 0 0 0 2 0 4 'T Ow a _ e x t e n s i o n 1 f i e l d 1 . i t _ e x t e n s i o n 1 T Y P ES T A N D A R DT A B L EO Fb a p i a c e x t c . * *C h e c kf o re r r o r s . 0 3 9 . T Y P Eb a p i a c h e 0 9 o b j _ k e y . 0 3 6 . 0 5 5 . " C u r r e n c y " M O V Ed o c _ a m t _ c r T Ow a _ c u r r e n c y a m o u n t a m t _ d o c c u r . 0 8 0 . w a _ r e t u r n n u m b e r . 0 8 5 . i t _ r e t u r n T Y P ES T A N D A R DT A B L EO Fb a p i r e t 2 . 0 7 1 . 0 4 6 . " D o cD a t e " M O V Es y d a t u m T Ow a _ d o c u m e n t h e a d e r p s t n g _ d a t e . 0 4 7 . i t _ c u r r e n c y a m o u n t . 0 M O V Es y m a n d t T Ow a _ d o c u m e n t h e a d e r o b j _ s y s . C L E A R:w a _ a c c o u n t g l ." A m o u n t " A P P E N Dw a _ c u r r e n c y a m o u n tT Oi t _ c u r r e n c y a m o u n t . 0 7 2 . 0 9 1 . 0 2 6 . * * F i l lE x t e n s i o n 1S t r u c t u r eu s e db yB T E * * P o s t i n gk e yi st ob ec h a n g e df o ro n l yf o rC u s t o m e rl i n ei t e m( 0 0 0 0 0 0 0 0 0 2 ) * * R e c o r d si nt h i si n t e r n a lt a b l ew i l lb ec h e c k e di nB T E C L E A R:w a _ e x t e n s i o n 1 .3/3/13 Code for Creating Account document using BAPI 0 0 1 . 0 3 4 . w a _ r e t u r n i d . 0 4 9 . 0 8 1 . " I t e mT e x t " M O V E' 0 1 0 3 ' T Ow a _ a c c o u n t r e c e i v a b l e c o m p _ c o d e . 0 6 1 . 0 3 5 . * *c l e a ri n t e r n a lt a b l e R E F R E S H: i t _ a c c o u n t g l .

. 1 6 . C L E A R :w a _ e x t e n s i o n . Related Content https://forums.RWBAPI01 . 0 7 . 0 6 . L O O PA Te x t e n s i o nI N T Ow a _ e x t e n s i o n . of a customer Step 5: Save the Link. E N D L O O P . 0 2 .ABAP Development .. 1 9 .action?pageId=195726664 3/4 . 1 3 . M O D I F Yi t _ a c c i tI N D E Xs y t a b i x .com/thread.com/message.jspa?messageID=8284886 http://forums.sap.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. 0 8 . i t _ a c c i t b s c h l=w a _ e x t e n s i o n f i e l d 1 + 1 0 ( 2 ) .For Accounting Document Interface Implementing Business Transaction Event . E N D I F .3/3/13 SAP Community Network Wiki .sap.sdn. F U N C T I O Nz s a m p l e _ i n t e r f a c e _ r w b a p i 0 1 . I Fs y s u b r cE Q0 . Summary When the BAPI is executed.jspa?messageID=9288661 http://forums. Use the menu option : Settings -> Process Modules -> . Step 4: Create a Link betw een BTE and Product created in Step2.com/message.. 2 0 . 1 7 .sdn. 0 3 .sap. 0 5 .of a Customer Step 3: Save the Product. 2 1 . * " * " * " L o c a lI n t e r f a c e : * " T A B L E S * " I T _ A C C I TS T R U C T U R E A C C I T * " I T _ A C C C RS T R U C T U R E A C C C R * " R E T U R NS T R U C T U R E B A P I R E T 2 * " E X T E N S I O NS T R U C T U R E B A P I A C E X T C * " I T _ A C C W TS T R U C T U R E A C C I T _ W T * " C H A N G I N G * " V A L U E ( D O C U M E N T _ H E A D E R )L I K E A C C H DS T R U C T U R E A C C H D * " D A T A:w a _ e x t e n s i o nT Y P Eb a p i a c e x t c . Configuration Step 1: Go To Transaction code FIBF Step 2: Add Customer Product. 1 8 . say "ZSAMPLE_INTERFACE_RWBAPI01" Step 3: Add Follow ing Code into the new function module and activate 0 1 . 1 4 .sdn. Use Menu Option : Settings -> Products -> . Code w ritten in the BTE .sap. 0 9 .function module w ill be executed and the posting key of related line item w ill be changed before posting the documents. R E A DT A B L Ei t _ a c c i tW I T HK E Yp o s n r=w a _ e x t e n s i o n f i e l d 1 ( 1 0 ) .com/wiki/pages/viewpage.jspa?threadID=999473 wiki. E N D F U N C T I O N .Business Transaction Event .. 1 0 .sme. 1 5 . 2 2 . 1 1 . 0 4 . 1 2 .

ABAP Development .For Accounting Document Interface Follow SCN Contact Us SAP Help Portal Privacy Terms of Use Legal Disclosure Copyright wiki.Business Transaction Event .3/3/13 SAP Community Network Wiki .RWBAPI01 .sap.sdn.action?pageId=195726664 4/4 .com/wiki/pages/viewpage.