Application Development 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: 

Document is not gettign posted

former_member386202
Active Contributor
0 Kudos

Hi,

Below is my code

*--Call BAPI to Post the Document

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = ls_dochdr

TABLES

accountgl = lt_accountgl

accountpayable = lt_accountpay

accounttax = lt_accounttax

currencyamount = lt_curramt

return = lt_bapiret

extension2 = lt_extension.

READ TABLE lt_bapiret TRANSPORTING NO FIELDS WITH KEY type = 'E'.

IF sy-subrc EQ 0.

*--Roll back any update

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

lv_subrc = 1.

ELSE.

*--Update the transaction

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

lv_subrc = 0.

ENDIF.

I m getting succuessful message with doc number in bapi return but I m not able to see document in FB03 (table BKPF) after using commit.

Please answer.

Thanks & Regards,

Prashant

2 REPLIES 2

Former Member
0 Kudos

Hi,

try to use below code

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = wa_account_header

TABLES

accountgl = it_accountgl

accountpayable = it_account_pay

currencyamount = it_currency_amount

return = it_bapi_return.

CLEAR v_lineitem.

v_lineitem = 1.

LOOP AT it_bapi_return INTO wa_type_bapi_return.

-


To Save Success Record Through BAPI Commit----


IF wa_type_bapi_return-type = 'S' .''if it is success

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

ENDLOOP .

Former Member
0 Kudos

Hi ,

There might be an error message of type 'A' in bapireturn.

Regards,

Deepthi