‎2010 Jun 22 4:00 PM
Hi all,
i'm using BAPI_ACC_INVOICE_RECEIPT_POST to automate posting of invoices but I'm stuck.
I just tried to use the BAPI in my program with test-data but I get the error message:
"Fehler im Beleg: BKPFF
Kreditor 17770 ist im Buchungskreis 0025 nicht vorgesehen."
in english:
"Error in Invoice: BKPFF
Vendor 17770 is not in company code 0025"
However when I post my Invoice direcly via Transaction FV60 wit exactly that vendor and company code the Invoice is posted without error messages!
My Code:
documentheader-obj_type = 'BKPFF'.
documentheader-obj_key = sy-uzeit.
documentheader-comp_code = '0025'.
documentheader-obj_sys = sy-sysid.
documentheader-doc_date = sy-datum.
documentheader-pstng_date = sy-datum.
documentheader-fis_period = sy-datum+4(2).
documentheader-doc_type = 'KR'.
documentheader-ref_doc_no = 'Rechnungsnummer'.
documentheader-header_txt = 'Verwendungszweck'.
documentheader-username = sy-uname.
wa_accountpayable-VENDOR_NO = '17770'.
wa_accountpayable-ITEMNO_ACC = '1'.
APPEND wa_accountpayable TO accountpayable.
wa_accountgl-GL_ACCOUNT = '0000152100'.
wa_accountgl-ITEMNO_ACC = '2'.
wa_accountgl-TAX_CODE = 'V1'.
wa_accountgl-FISC_YEAR = '2001'.
wa_accountgl-FIS_PERIOD = sy-datum+4(2).
APPEND wa_accountgl TO accountgl.
wa_accounttax-TAX_CODE = 'V1'.
wa_accounttax-gl_account = '0000152100'.
wa_accounttax-ITEMNO_ACC = '3'.
wa_accounttax-ACCT_KEY = 'VST'.
APPEND wa_accounttax TO accounttax.
wa_currencyamount-ITEMNO_ACC = '1'.
wa_currencyamount-amt_base = '1031'.
wa_currencyamount-CURRENCY = 'USD'.
APPEND wa_currencyamount TO currencyamount.
CLEAR wa_currencyamount.
wa_currencyamount-ITEMNO_ACC = '2'.
wa_currencyamount-amt_base = '1031'.
wa_currencyamount-CURRENCY = 'USD'.
APPEND wa_currencyamount TO currencyamount.
CLEAR wa_currencyamount.
wa_currencyamount-ITEMNO_ACC = '3'.
wa_currencyamount-amt_base = '1031'.
wa_currencyamount-CURRENCY = 'USD'.
APPEND wa_currencyamount TO currencyamount.
CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST'
EXPORTING
DOCUMENTHEADER = documentheader
TABLES
ACCOUNTPAYABLE = accountpayable
ACCOUNTGL = accountgl
ACCOUNTTAX = accounttax
CURRENCYAMOUNT = currencyamount
RETURN = return.
* CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT = 'X'.any suggestions?
cheers,
jaf
‎2010 Jun 22 4:11 PM
solved...I just had to use 0000017770 instead of 17770 only for the vendor