2006 Oct 03 7:57 AM
Hello experts,
Please help me on how to use the BAPI BAPI_ACC_DOCUMENT_POST. I dont have the time to
record via SHDB and do BDC and I would like to try out the said BAPI. I think this will be faster
I need to fill in the header, line items, etc. Any detailed examples will be highly appreciated.
Thanks a lot guys and take care!
Hello experts,
Please help me on how to use the BAPI BAPI_ACC_DOCUMENT_POST. I dont have the time to
record via SHDB and do BDC and I would like to try out the said BAPI. I think this will be faster
I need to fill in the header, line items, etc. Any detailed examples will be highly appreciated.
Thanks a lot guys and take care!
2006 Oct 03 8:12 AM
Take a look at the following code :
* IF GL ACCOUNT
* Accountgl / Compte générale
ws_accountgl-itemno_acc = w_compt.
ws_accountgl-comp_code = p_bukrs.
ws_accountgl-pstng_date = ws_reformat-datecpt.
ws_accountgl-fisc_year = ws_reformat-datecpt(4).
ws_accountgl-fis_period = ws_reformat-datecpt+4(2).
ws_accountgl-doc_type = p_blart.
ws_accountgl-item_text = ws_reformat-libel.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ws_reformat-cptclf
IMPORTING
output = ws_accountgl-gl_account.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ws_reformat-kostl
IMPORTING
output = ws_accountgl-costcenter.
ELSE. " ACC. PAYABLE
* Account Payable / Compte fournisseur
ws_accountpayable-itemno_acc = w_compt.
ws_accountpayable-comp_code = p_bukrs.
ws_accountpayable-item_text = ws_reformat-libel.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ws_reformat-cptclf
IMPORTING
output = ws_accountpayable-vendor_no.
APPEND ws_accountpayable TO accountpayable.
ENDIF.
* Currencyamount Struct.
ws_currencyamount-itemno_acc = w_compt.
ws_currencyamount-currency = 'EUR'.
* ws_currencyamount-curr_type = '00'.
IF ws_reformat-sign EQ 'C'.
ws_reformat-wrbtr_c = ws_reformat-wrbtr_c * ( - 1 ).
ENDIF.
ws_currencyamount-amt_doccur = ws_reformat-wrbtr_c.
APPEND ws_currencyamount TO currencyamount.
* BAPI
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = documentheader
TABLES
accountgl = accountgl
accountpayable = accountpayable
currencyamount = currencyamount
return = t_return.
IF sy-subrc <> 0.
MESSAGE e999(re) WITH 'Problem occured'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |