Hi experts,
when i am trying to create invoice from BAPI_INCOMINGINVOICE_CREATE ii am getting the following error meesage: SE 509 Account assignment for entry sheet missing
Please advice
Thanks & Regards,
Here the code:
DATA: wa_header LIKE bapi_incinv_create_header.
DATA: it_item TYPE STANDARD TABLE OF bapi_incinv_create_item,
wa_item TYPE bapi_incinv_create_item,
wa_item_account TYPE STANDARD TABLE OF BAPI_INCINV_CREATE_GL_ACCOUNT WITH HEADER LINE,
wa_item_withtax TYPE STANDARD TABLE OF BAPI_INCINV_CREATE_WITHTAX WITH HEADER LINE.
DATA: it_ret LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: g_invno LIKE bapi_incinv_fld-inv_doc_no,
g_fyear LIKE bapi_incinv_fld-fisc_year.
wa_header-invoice_ind = 'X'.
wa_header-DOC_TYPE = '01'.
wa_header-doc_date = '20160412'. "Enter the document date
wa_header-pstng_date = '20160412'. "Enter the posting date
wa_header-ref_doc_no = '01-00004-0000087'.
wa_header-comp_code = 'SFER'.
wa_header-currency = 'PEN'.
wa_header-gross_amount = '268.80'. "Enter the gross amount(aft. tax) for the invoice
wa_header-bline_date = '20160412'.
wa_header-calc_tax_ind = 'X'.
wa_header-PMNTTRMS = 'P060'.
*wa_header-PLANNING_LEVEL = 'F1'.
*wa_header-DIFF_INV = '1100000176'.
wa_header-DEL_COSTS_TAXC = 'P1'.
wa_item-invoice_doc_item = '00001'.
wa_item-po_number = '4500002510'. "Enter the PO number
wa_item-po_item = '10'. "Enter the PO item number
*wa_item-ref_doc = '5000002126'. "Enter the GR number
wa_item-ref_doc_it = '0010'. "Enter the GR item number
wa_item-ref_doc_year = '2016'. "Enter the GR fiscal year
wa_item-tax_code = 'DA'. "Enter the tax code applicable
wa_item-item_amount = '227.80'. "Enter the item amount
wa_item-quantity = '34'. "Enter the invoice quantity
wa_item-po_unit = 'TON'. "Enter the UoM
*wa_item-SHEET_NO = '1000001065'.
*wa_item-SHEET_ITEM = '00010'.
APPEND wa_item TO it_item.
wa_item_account-INVOICE_DOC_ITEM = '000001'.
wa_item_account-TAX_CODE = 'VN'.
wa_item_account-ITEM_AMOUNT = '268.80'.
wa_item_account-QUANTITY = '34'.
wa_item_account-BASE_UOM = 'TON'.
wa_item_account-GL_ACCOUNT = '63990010'.
wa_item_account-COSTCENTER = '1406013'.
wa_item_account-DB_CR_IND = 'S'.
wa_item_account-COMP_CODE = 'SFER'.
APPEND wa_item_account.
wa_item_withtax-WI_TAX_TYPE = 'DA'.
wa_item_withtax-WI_TAX_CODE = '37'.
APPEND wa_item_withtax.
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
EXPORTING
headerdata = wa_header
* ADDRESSDATA =
IMPORTING
invoicedocnumber = g_invno
fiscalyear = g_fyear
TABLES
itemdata = it_item
* ACCOUNTINGDATA =
* GLACCOUNTDATA = wa_item_account
* MATERIALDATA =
* TAXDATA =
* WITHTAXDATA = wa_item_withtax
* VENDORITEMSPLITDATA =
return = it_ret
* EXTENSIONIN =
.
IF g_invno IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.
ENDIF.
WRITE:/1 g_invno, g_fyear.
LOOP AT it_ret.
WRITE:/1 it_ret-message.
ENDLOOP.