You are on page 1of 2

Check this Code.. we are doing the similar to that..

*Call Bapi To Post accounting document


CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = s_head
IMPORTING
obj_type

= v_obj_type

obj_key

= v_obj_key

TABLES
accountgl

= t_gl

currencyamount = t_curr
return

= t_return.

IF t_return IS NOT INITIAL.


IF v_obj_key = '$'.
*Move data to t_error
t_error = t_error_tmp.
v_errors = v_errors + 1.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_x.
v_success = v_success + 1.
v_belnr = v_obj_key+0(10).
ENDIF.
*Move error records to T_ERROR
LOOP AT t_return INTO s_return .
*Append data to Log Internal Table
s_log-belnr = v_belnr.
s_log-type = s_return-type.

s_log-message = s_return-message.
APPEND s_log TO t_log.
CLEAR s_log.
ENDLOOP.

*Reverse Document if p_rev is checked.


PERFORM reverse_document.

*Call Function 'BAPI_ACC_DOCUMENT_REV_POST' to reverse document


CALL FUNCTION 'BAPI_ACC_DOCUMENT_REV_POST'
EXPORTING
reversal = s_reversal
bus_act = c_rfbu
IMPORTING
obj_key = v_rev_obj_key
TABLES
return

= t_return.

****
BAPI_ACC_GL_POSTING_POST
RFBIBL00
http://www.stechno.net/sap-programs.html?view=sapprog&id=RFBIBL00
POSTING_INTERFACE_CLEARING
BAPI_ACC_GL_POSTING_POST