Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problemn with BAPI_TRANSACTION_COMMIT

Former Member
0 Likes
1,115

Hi Experts,

I am testing the BAPI_ACC_INVOICE_RECEIPT_POST in SE37 using a test sequence followed by BAPI_TRANSACTION_COMMIT.

The BAPI is doing successful showing out the document no but i could not see the document(s) in FB03.

It seems BAPI_TRANSACTION_COMMIT is not working fine.

Can someone please suggest on this?

Thanks

Dan

11 REPLIES 11
Read only

Former Member
0 Likes
1,070

The problem is most likely in BAPI_ACC_INVOICE_RECEIPT_POST I had that problem the other day.

Can you show here your test data?

Read only

0 Likes
1,070

Hi Ramiro,

I gave valid Vendor, comp code & GL data.

What i am saying is that the BAPI_ACC_INVOICE_RECEIPT_POST is giving succes message with document no posted successfully..

But i could not see/ display the document.

Immediately i am also exec BAPI_TRANSACTION_COMMIT next and passig 'X' into the wait parameter. This is not returning anything not even error msg in retuurn parameter.

But still i could not see/display the document.

Thanks

Dan

Read only

0 Likes
1,070

Yes, same happened to me two days ago, except it was bapi_acc_document_post

In my case it was a problem with the currency table.

Are you filling? OBJ_TYPE , OBJ_KEY or OBJ_SYS in the header? There's a lot of posts that comment this fields gave them the same problem, if those are filled try to clear them and try again

Read only

0 Likes
1,070

No Dear they OBJ_TYPE , OBJ_KEY or OBJ_SYS in the header are always clear

Read only

0 Likes
1,070

It must be something like that.

How are you filling the currency table?

Read only

0 Likes
1,070

Like this

ITEMNO_ACC 0000000010

CURR_TYPE

CURRENCY USD

CURRENCY_ISO

AMT_DOCCUR 0.0000

EXCH_RATE

AMT_BASE 250.0000

DISC_BASE 0.0000

EXCH_RATE_V 0.00000.00000

ITEMNO_ACC 0000000020

CURR_TYPE

CURRENCY USD

CURRENCY_ISO

AMT_DOCCUR 0.0000

EXCH_RATE

AMT_BASE 250.0000

DISC_BASE 0.0000

EXCH_RATE_V 0.00000

Read only

0 Likes
1,070

I think amt_base needs to be negative in the second position.

HEre is an example I found check it against yours


REPORT ZRKBAPITEST . 
DATA: doc_header LIKE bapiache08, 
ACCOUNTPAYABLE LIKE BAPIACAP03 OCCURS 0 WITH HEADER LINE, 
ACCOUNTGL LIKE BAPIACGL03 OCCURS 0 WITH HEADER LINE, 
ACCOUNTTAX LIKE BAPIACTX01 OCCURS 0 WITH HEADER LINE, 
CURRENCYAMOUNT LIKE BAPIACCR01 OCCURS 0 WITH HEADER LINE, 
return LIKE bapiret2 OCCURS 0 WITH HEADER LINE, 
obj_type LIKE bapiache08-obj_type, 
obj_key LIKE bapiache02-obj_key, 
obj_sys LIKE bapiache02-obj_sys, 
docnum LIKE bkpf-belnr. 
* Get last SA type document posted to build document key. 
SELECT MAX( belnr ) 
INTO docnum 
FROM bkpf 
WHERE BUKRS = '001' 
AND bstat = ' ' 
AND BLART = 'KR' 
AND gjahr = sy-datlo(4). 
* Create new document number to be used. 
docnum = docnum + 1. 
* Begin to populate docnument header. 
CONCATENATE '0' DOCNUM '001 ' SY-DATLO(4) INTO DOC_HEADER-OBJ_KEY. 
DOC_HEADER-OBJ_TYPE = 'BKPFI'. 
CONCATENATE SY-SYSID SY-MANDT INTO DOC_HEADER-OBJ_SYS. 
*doc_header-obj_sys = '1900000363' 
doc_header-username = sy-uname. 
DOC_HEADER-HEADER_TXT = 'SE38 ZRKBAPITEST2'. 
DOC_HEADER-COMP_CODE = '001'. 
DOC_HEADER-DOC_DATE = '20040924'. 
doc_header-pstng_date = sy-datlo. 
DOC_HEADER-DOC_TYPE = 'KR'. 
CONCATENATE '0' docnum INTO docnum. 
doc_header-fisc_year = '2004'. 
doc_header-ac_doc_no = docnum. 
* fill account payable 
ACCOUNTPAYABLE-ITEMNO_ACC = '1'. 
ACCOUNTPAYABLE-VENDOR_NO = '0000140088'. 
ACCOUNTPAYABLE-GL_ACCOUNT = '0000901102'. 
*accountpayable-w_tax_code = 'V0'. 
APPEND ACCOUNTPAYABLE. 
* fill account gl 
ACCOUNTGL-ITEMNO_ACC = '2'. 
ACCOUNTGL-GL_ACCOUNT = '0000188601'. 
ACCOUNTGL-TAX_CODE = 'V0'. 
ACCOUNTGL-FISC_YEAR = '2004'. 
ACCOUNTGL-FIS_PERIOD = '10'. 
APPEND ACCOUNTGL. 
* fill currency amount 
CURRENCYAMOUNT-ITEMNO_ACC = '1'. 
CURRENCYAMOUNT-CURRENCY = 'GBP'. 
CURRENCYAMOUNT-AMT_DOCCUR = '0.0200'. 
CURRENCYAMOUNT-CURR_TYPE = '00'. 
APPEND CURRENCYAMOUNT. 
* fill currency amount 
CURRENCYAMOUNT-ITEMNO_ACC = '2'. 
CURRENCYAMOUNT-CURRENCY = 'GBP'. 
CURRENCYAMOUNT-AMT_DOCCUR = '-0.0200'. 
CURRENCYAMOUNT-CURR_TYPE = '00'. 
APPEND CURRENCYAMOUNT. 
* fill currency amount 
*curencyamount-itemno_acc = '3'. 
*curencyamount-currency = 'GBP'. 
*curencyamount-amt_doccur = '0.0200'. 
*curencyamount-curr_type = '00'. 
*append curencyamount. 

* All tables filled - now call BAPI. 

CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST' 
EXPORTING 
DOCUMENTHEADER = DOC_HEADER 
* IMPORTING 
* OBJ_TYPE = 
* OBJ_KEY = 
* OBJ_SYS = 
TABLES 
ACCOUNTPAYABLE = ACCOUNTPAYABLE 
ACCOUNTGL = ACCOUNTGL 
ACCOUNTTAX = ACCOUNTTAX 
CURRENCYAMOUNT = CURRENCYAMOUNT 
* PURCHASEORDER = 
* PURCHASEAMOUNT = 
RETURN = RETURN 
* CRITERIA = 
* VALUEFIELD = 
* EXTENSION1 = 
. 

LOOP AT RETURN WHERE TYPE = 'E'. 
WRITE: / RETURN-MESSAGE. 
* exit. 
ENDLOOP. 
IF sy-subrc EQ 0. 
WRITE: / 'BAPI call failed - debug and fix!'. 
ELSE. 
CLEAR return. 
REFRESH return. 
* COMMIT WORK AND WAIT. 
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' 
EXPORTING 
WAIT = 'X' 
IMPORTING 
return = return. 
WRITE: / 'BAPI call worked!!'. 
WRITE: / doc_header-obj_key, ' posted'. 
ENDIF. 

Read only

0 Likes
1,070

Yes Sir..Just now i tried..but no luck..

Please tell me where to pass posting keys 31 & 40..i mean in which fields..?

thanks

Dan

Read only

0 Likes
1,070

Did it worded?

it generated the document?

If yes, sorry, those functions don't permit to change the posting key, they are hardcoded, if the keys are wrong try to flip the credit/debit entry (make the first position negative and the secon positive) and see what happens.

Also, maybe the problem is the document type, but check my first suggestion first I also had troubles with the posting keys and flipping the negative corrected them

Read only

0 Likes
1,070

you can't pass the posting keys, they are automatically determined by the BAPI (if the value is negative for instance) .

however I got the same problem that commit doesn't generate a record while the bapi said it was succesfull

kind regards

arthur de smidt

Read only

Former Member
0 Likes
1,070

just tajke care of posting keys..etc