Skip to Content
author's profile photo Former Member
Former Member

BAPI_ACC_INVOICE_RECEIPT_POST Error..!

Hi Guys,

I am trying post an Invoice for Employee Vendor in AP.

Here is my code.

FUNCTION ztm_post_ta. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" VALUE(PERNR) TYPE LFB1-PERNR *" REFERENCE(WAGE_TYPE) TYPE WAGETYPE *" REFERENCE(DOC_DATE) TYPE BLDAT *" REFERENCE(AMOUNT) TYPE NETPR *"---------------------------------------------------------------------- ** Reference: have a look at standard report ACC_BAPI_TEST_INVOICE_RECEIPT. CONSTANTS: lc_bukrs TYPE bukrs VALUE 'CC01'. DATA: document_header LIKE bapiache03, account_payable LIKE bapiacap03 OCCURS 0, account_gl LIKE bapiacgl03 OCCURS 0, account_tax LIKE bapiactx01 OCCURS 0, currency_amount LIKE bapiaccr01 OCCURS 0, t_return LIKE bapiret2 OCCURS 0. ** PERFORM fill_account_payable. DATA: wa_account_payable LIKE bapiacap03. DATA: wa_account_gl LIKE bapiacgl03. DATA: wa_currency_amount LIKE bapiaccr01. DATA: lv_fiscalyr TYPE gjahr, lv_period TYPE monat, lv_lifnr TYPE lifnr, lv_gl_acc TYPE saknr, lv_amount TYPE netpr. * get fiscal year and period - (requires date and company code) CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD' EXPORTING companycodeid = lc_bukrs posting_date = doc_date IMPORTING fiscal_year = lv_fiscalyr fiscal_period = lv_period. ** fill document header. document_header-username = sy-uname."mandatory document_header-comp_code = lc_bukrs."mandatory document_header-fisc_year = lv_fiscalyr. document_header-doc_date = doc_date. document_header-pstng_date = doc_date. "mandatory document_header-fis_period = lv_period. document_header-doc_type = 'KR'. "mandatory SELECT SINGLE lifnr FROM lfb1 INTO lv_lifnr WHERE pernr = pernr. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = lv_lifnr IMPORTING output = lv_lifnr. ** Fill Vendor details (Accounts Payable) wa_account_payable-itemno_acc = '0000000010'. wa_account_payable-vendor_no = lv_lifnr. "mandatory APPEND wa_account_payable TO account_payable. SELECT SINGLE gl_account FROM ztm_wagetyp_gl INTO lv_gl_acc WHERE wage_type = wage_type. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = lv_gl_acc IMPORTING output = lv_gl_acc. ** fill GL account details wa_account_gl-itemno_acc = '0000000020'. wa_account_gl-gl_account = lv_gl_acc."mandatory wa_account_gl-pstng_date = doc_date."mandatory APPEND wa_account_gl TO account_gl. ** Fill currency details wa_currency_amount-itemno_acc = '0000000010'. wa_currency_amount-currency = 'AUD'. "mandatory wa_currency_amount-amt_doccur = amount. APPEND wa_currency_amount TO currency_amount. lv_amount = amount * -1. wa_currency_amount-itemno_acc = '0000000020'. wa_currency_amount-currency = 'AUD'. "mandatory wa_currency_amount-amt_doccur = lv_amount. APPEND wa_currency_amount TO currency_amount. CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST' EXPORTING documentheader = document_header TABLES accountpayable = account_payable accountgl = account_gl accounttax = account_tax "pode ir vazio currencyamount = currency_amount return = t_return. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. ENDFUNCTION.

Getting the following error

I checked that the vendor has been assigned to the company code CC01, but still throwing that error.

Thanks

Sam

Vendor Error.JPG (44.4 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Aug 23, 2012 at 06:41 AM

    Do the error messages not sound clear enough?

    - The vendor does not exist in the company - check LFB1 just after selecting from LFA1. (*)

    (Also remove the call to CONVERSION_EXIT_ALPHA_INPUT as you read data from database value is already in internal format.)

    - Check the GL account, it is associated to a primary cost element in controlling, check field status group and ask functional to identify a correct assignment like cost center, order, wbs, etc.

    (Check your ztm_wagetyp_gl table for a field like a cost-center in its definition.)

    Regards,

    Raymond

    (*) I read again your post, so add BUKRS in your where clause.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 23, 2012 at 06:45 AM

    Dear,

    You have to assign Account asignment 50103 to CO object through oby* tcode.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.