‎2008 Feb 27 7:03 AM
Hi all,
I am trying to create a G/L document using the BAPI "BAPI_ACC_DOCUMENT_POST". The Bapi is returning me a success message in the return table of BAPI, but I am not able to see the document in BKPF/DFKKOP.
Can somebody please let me know if there is any customization that needs to be done to get the document number reflected in the corresponding tables after i execute this BAPI. Following is the code.
REPORT Z_MASS_FI_DOC_POSTING.
data: lv_doc_header type BAPIACHE09,
lv_conract_header type BAPIACCAHD.
data: lt_return type table of BAPIRET2 with header line,
lt_curr_amt type table of BAPIACCR09 with header line,
lt_account_tax type table of BAPIACTX09 with header line,
lt_cont_item type table of BAPIACCAIT with header line.
lv_doc_header-comp_code = 'A072'.
lv_doc_header-doc_type = 'AB'.
lv_doc_header-username = sy-uname.
lv_doc_header-bus_act = 'RFBU'.
lv_doc_header-doc_date = sy-datum.
lv_doc_header-pstng_date = sy-datum.
lt_curr_amt-ITEMNO_ACC = '0000000010'.
lt_curr_amt-CURRENCY = 'AUD'.
lt_curr_amt-AMT_BASE = '49.0000'.
append lt_curr_amt.
lt_account_tax-ITEMNO_ACC = '0000000010'.
lt_account_tax-TAX_CODE = 'S1'.
append lt_account_tax.
lt_cont_item-ITEMNO_ACC = '0000000010'.
lt_cont_item-CONT_ACCT = '000001000220'.
lt_cont_item-MAIN_TRANS = 'CDOC'.
lt_cont_item-SUB_TRANS = '0010'.
lt_cont_item-VTREF = '00000000000100000047'.
append lt_cont_item.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = lv_doc_header
CUSTOMERCPD =
CONTRACTHEADER =
IMPORTING
OBJ_TYPE =
OBJ_KEY =
OBJ_SYS =
TABLES
ACCOUNTGL =
ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE =
ACCOUNTTAX = lt_account_tax
CURRENCYAMOUNT = lt_curr_amt
CRITERIA =
VALUEFIELD =
EXTENSION1 =
RETURN = lt_return
PAYMENTCARD =
CONTRACTITEM = lt_cont_item.
EXTENSION2 =
REALESTATE =
ACCOUNTWT =
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
IMPORTING
RETURN =
.
Commit work.
I have tried putting values for following fields.
docheader-obj_type = 'REACI'.
docheader-obj_key = 'TEST'.
docheader-obj_sys = 'ECSCLNT010'.
In that case also, it doesn't work.
People have faced similar problems.I saw them on some other threads. But nobody seems to have provided the solution.
Any input will be appriciated.
Regards,
Devang Shah
‎2008 Feb 27 7:20 AM
Hi,
Provided you have use the parameters of BAPI_ACC_DOCUMENT_POST correctly and it returns successful message, do you have specific needs to set the WAIT parameter in 'BAPI_TRANSACTION_COMMIT'? If you do not need it, try removing the WAIT parameter (WAIT = ' ').
Jeffrey Satriadi
‎2008 Feb 27 7:31 AM
Hi
Use BAPI_TRANSACTION_COMMIT and set the wait parameter in it to 'X'. This should work.
Thanks
Vijay
PLZ reward points if helpful