Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI error

Former Member
0 Kudos

Hi Experts,

When I am test excuting the BAPI 'BAPI_INCOMINGINVOICE_CREATE' in se37, the BAPI is executing correctly without any error and is returning an invoice number.

But when I am using the same data to execute the BAPI in my program, it is throwing a BAPI error:

Error Type: F

Error ID: F5

Error Message:Program error: incorrect callup of FI_PERIOD_CHECK

I am filling the input files like this,i.e. my code:

IF NOT t_inputfile IS INITIAL.

SORT t_inputfile BY inv_doc_no .

LOOP AT t_inputfile assigning <f_inputfile>.

at new inv_doc_no.

wa_invoice_header-invoice_ind = c_inv_indicator.

wa_invoice_header-doc_type = c_doc_type.

wa_invoice_header-doc_date = <f_inputfile>-doc_date.

wa_invoice_header-pstng_date = <f_inputfile>-pstng_date.

wa_invoice_header-ref_doc_no = <f_inputfile>-ref_doc_no.

wa_invoice_header-comp_code = <f_inputfile>-comp_code.

wa_invoice_header-diff_inv = <f_inputfile>-diff_inv.

wa_invoice_header-currency = <f_inputfile>-currency.

wa_invoice_header-gross_amount = <f_inputfile>-gross_amount.

wa_invoice_header-calc_tax_ind = c_calc_tax_ind.

wa_invoice_header-bline_date = <f_inputfile>-bline_date.

endat.

at new invoice_doc_item.

wa_invoice_item-invoice_doc_item = <f_inputfile>-invoice_doc_item.

wa_invoice_item-po_number = <f_inputfile>-po_number.

wa_invoice_item-po_item = <f_inputfile>-po_item.

wa_invoice_item-ref_doc = <f_inputfile>-ref_doc.

wa_invoice_item-ref_doc_year = <f_inputfile>-ref_doc_year.

wa_invoice_item-ref_doc_it = <f_inputfile>-ref_doc_it.

wa_invoice_item-de_cre_ind = c_de_cr_ind.

wa_invoice_item-tax_code = <f_inputfile>-tax_code.

wa_invoice_item-item_amount = <f_inputfile>-item_amount.

wa_invoice_item-quantity = <f_inputfile>-quantity.

wa_invoice_item-po_unit = <f_inputfile>-po_unit.

wa_invoice_item-po_pr_qnt = <f_inputfile>-po_pr_qnt.

wa_invoice_item-po_pr_uom = <f_inputfile>-po_pr_uom.

append wa_invoice_item to t_invoice_item.

clear wa_invoice_item.

endat.

at end of inv_doc_no.

CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'

EXPORTING

headerdata = wa_invoice_header

  • ADDRESSDATA =

IMPORTING

INVOICEDOCNUMBER = v_inv_no

FISCALYEAR = v_year

tables

itemdata = t_invoice_item

  • ACCOUNTINGDATA =

  • GLACCOUNTDATA =

  • MATERIALDATA =

  • TAXDATA =

  • WITHTAXDATA =

  • VENDORITEMSPLITDATA =

return = t_return

  • EXTENSIONIN =

.

Where can I be wrong.

Regards,

Sangeeta.

6 REPLIES 6

Former Member
0 Kudos

Hi

Check if this example helps you:

Example: Incoming Invoice

This example shows the header data that you need to enter in table Headerdata and the item data that you need to enter in table Itemdata to post an invoice.

Purchase order: 10 pc of material A @ $10/pc
Goods receipt:  10 pc of material A

You receive an invoice against this purchase order referencing PO number 4500007491, PO item 10, for a quantity of 10 pc of material A and an amount of $116, including 16% VAT. Enter the following data:

HeaderData table

INVOICE_IND (Post invoice/credit memo): X
DOC_DATE (Document date): 05.20.2000
PSTNG_DATE (Posting date): 05.23.2000
COMP_CODE (Company code): 1000
GROSS_AMOUNT (Gross amount): 116.00
CURRENCY (Currency key): USD
CALC_TAX_IND (Calculate tax): X
ItemData table

INVOICE_DOC_ITEM (Invoice document item): 00001
PO_NUMBER (Purchase order number): 4500007491
PO_ITEM (Purchase order item): 00010
TAX_CODE (Tax code): VN
ITEM_AMOUNT (Item amount): 100
QUANTITY (Quantity): 10
PO_UNIT (Unit of measure): PC

Regards,

Vishwa.

0 Kudos

I have entered all the required header data and item data.

Document type: RE

debit/credit indicator:X

and all

but still it showing me error while running the BAPI through program. But if I run it through se37, I don't get any error.

0 Kudos

Hello,

this message means that something 's wrong with the company code or

(more likely) with the posting date. Remember that the posting date is need in the form YYYYMMDD if you call the BAPI from your program.

Regrads Wolfgang

Former Member
0 Kudos

Could be how you are passing <f_inputfile>-pstng_date since it could be using that to determine which period to pass to the FM. Check you're formatting the date the same as you did in SE37

0 Kudos

Hi,

On debugging I found the BAPI is internally converting the dates to yyyymmdd format.

Regards,

Sangeeta.

0 Kudos

Hi

Thats because of the user settings. You can change the user settings in SU01 transaction code.

Regards,

Vishwa.