06-16-2008 5:08 AM
Hi Experts
I am developing a BAPI to post the Vendor Invoice, I am not clear the parameters to be passed. Anyhow i have filled some parameters and am getting the following error, Can anyone suggest me about the error.
Error :
Enter a reference to a valid goods receipt (line 000010)
Coding :
data:it_head like bapi_incinv_create_header,
it_item like bapi_incinv_create_item occurs 0 with header line,
it_acct like bapi_incinv_create_account occurs 0 with header line,
it_gl like bapi_incinv_create_gl_account occurs 0 with header line,
it_mat like bapi_incinv_create_material occurs 0 with header line,
it_ven like bapi_incinv_create_vendorsplit occurs 0 with header line,
it_ret like bapiret2 occurs 0 with header line.
data: inv_doc like bapi_incinv_fld-inv_doc_no,
fisc_yr like bapi_incinv_fld-fisc_year.
data: zinvdoc(50) type c, zfiscyr(30) type c.
clear it_head.
move 'x' to it_head-invoice_ind.
move '1000' to it_head-comp_code.
move sy-datum to it_head-doc_date .
move sy-datum to it_head-pstng_date .
move '27-61725' to it_head-ref_doc_no .
move '200' to it_head-gross_amount .
move 'inr' to it_head-currency .
move '27-61725' to it_head-item_text .
move '1WEAVIN20' to it_head-diff_inv .
move 're' to it_head-doc_type .
move sy-datum to it_head-bline_date.
move '2' to it_head-pmtmthsupl.
move 'a' to it_head-pmnt_block.
move 'z' to it_head-pymt_meth.
move '0001' to it_head-pmnttrms.
clear it_item.
it_item-ref_doc = '123'.
it_item-REF_DOC_YEAR = '2008'.
it_item-REF_DOC_IT = '10'.
it_item-po_number = '4511007408'.
it_item-po_item = '10'.
it_item-invoice_doc_item = '00010'. " ( i don't know what this is for so i gave this no.)
it_item-item_amount
it_item-po_unit
it_item-freight_ve
append it_item.
break pp01.
call function 'BAPI_INCOMINGINVOICE_CREATE'
exporting
headerdata = it_head
addressdata
importing
invoicedocnumber = inv_doc
fiscalyear = fisc_yr
tables
itemdata = it_item
accountingdata
glaccountdata
materialdata
taxdata
withtaxdata
vendoritemsplitdata
return = it_ret.
Thanks in advance.
Regards
Rajaram
06-16-2008 6:55 AM
hi,
You are creating a document type 'RE' I think it is returns so you need to pass the reference document no for it.you need to send REF_DOC in the table BAPI_INCINV_CREATE_ITEM for creating the document. For Returns reference document number is mandatory. So it is giving the error.
Regards,
Veeresh
06-16-2008 7:19 AM
Hi Veereshbabu
I have given REF_DOC value also but still its saying the same error.
Enter a reference to a valid goods receipt (line 000010)
What could be the reason.
Regards
Rajaram
06-16-2008 6:55 AM
Hi,
You have to fill the header and item check out 1,2 point in your code...
Fill in the item details
CNT = CNT + 1.
1. ITEMDATA-INVOICE_DOC_ITEM = CNT.
ITEMDATA-PO_NUMBER = WA_EKPO-EBELN.
ITEMDATA-PO_ITEM = WA_EKPO-EBELP.
ITEMDATA-TAX_CODE = <XX>.
ITEMDATA-ITEM_AMOUNT = WA_EKPO-NETWR.
ITEMDATA-QUANTITY = WA_EKPO-MENGE.
ITEMDATA-PO_UNIT = WA_EKPO-MEINS.
APPEND ITEMDATA.
CLEAR ITEMDATA.
Header Info
2. HEADERDATA-INVOICE_IND = 'X'.
HEADERDATA-DOC_DATE = EKKO-BEDAT.
HEADERDATA-BLINE_DATE = EKKO-BEDAT.
HEADERDATA-PSTNG_DATE = SY-DATUM.
HEADERDATA-COMP_CODE = EKKO-BUKRS.
HEADERDATA-CURRENCY = EKKO-WAERS.
HEADERDATA-GROSS_AMOUNT
HEADERDATA-CALC_TAX_IND = ' '.
HEADERDATA-PMNTTRMS = EKKO-ZTERM.
Regadrs,
Prabhu Rajesh
05-19-2009 12:48 PM
06-18-2009 8:58 PM
Raja -
You posted that you have solved this issue. Could you post the resolution as I am experiencing the same issue?
Thanks,
Austin
08-10-2010 10:28 AM
Hi there,
Please post the resolution to this issue.
Thanks and Regards,
Preneshen Govender