Skip to Content
0
Former Member
Oct 10, 2005 at 06:39 PM

Error BAPI bapi_incominginvoice_create

667 Views

I have a problem with the above BAPI - it gives me error message M8 534 - 'BALANCE NOT ZERO:23.343.912 DEBITS 235.798 CREDITS 23.579.710' the entered data in the header and the item. Gross_amount , for a case it has sum of detail item_amount. for second case Gross_amount it has sum of derail item_amount + sum of tax.

----


  • headerdata: *

----


wa_headerdata-invoice_ind = 'X'.

wa_headerdata-doc_type = doc_type.

wa_headerdata-doc_date = WA_FECHA.

wa_headerdata-pstng_date = WA_FECHA. "sy-datum.

wa_headerdata-ref_doc_no = Wa_BELNR.

IF ZL-W = 'R7' OR TABLA-CEDVEN-W = '891900090' OR

TABLA-CEDVEN-W = '860007538'.

wa_headerdata-calc_tax_ind = 'X'.

ENDIF.

wa_headerdata-currency = 'COP'.

wa_headerdata-gross_amount = Wa_Total.

wa_headerdata-header_txt = TABLA-NUMCON.

wa_headerdata-comp_code = '2111'.

wa_headerdata-CALC_TAX_IND = 'X'.

wa_headerdata-alloc_nmbr = CEDVEN-W.

wa_headerdata-ITEM_TEXT = TABLA-NUMCON.

----


  • llena estructura con inf de retenciones-WITHTAXDATA: *

----


w_conta = 1.

LOOP AT RE2.

wa_withtaxdata-split_key = w_conta.

wa_withtaxdata-wi_tax_type = RE2-WITHT.

wa_withtaxdata-wi_tax_code = RE2-WITHT.

IF RE2-WITHT EQ '2H'.

wa_withtaxdata-wi_tax_base = BASE.

wa_withtaxdata-wi_tax_amt = TABLA-RTEFTEW.

ELSEIF RE2-WITHT EQ 'FM'.

wa_withtaxdata-wi_tax_base = BASEFONDO.

wa_withtaxdata-wi_tax_amt = TABLA-FONDOTABAW.

ENDIF.

IF re2-witht = 'R7' OR RE2-WITHT EQ '37' OR RE2-WITHT EQ '38' .

V_Reguimen = RE2-WITHT.

EndIf.

APPEND wa_withtaxdata TO it_withtaxdata.

ENDLOOP.

----


  • itemdata: *

----


CLEAR w_conta.

LOOP AT IT_EKPO.

  • LOOP AT RE2.

ADD 1 TO w_conta.

wa_itemdata-invoice_doc_item = w_conta.

wa_itemdata-po_number = IT_EKPO-EBELN.

wa_itemdata-po_item = IT_EKPO-EBELP.

wa_itemdata-ref_doc = IT_EKPO-BELNR.

wa_itemdata-ref_doc_year = IT_EKPO-GJAHR.

wa_itemdata-ref_doc_it = w_conta.

  • EAFA 07.10.2005

IF V_Reguimen EQ 'R7'.

wa_itemdata-tax_code = 'KE'.

ELSE.

wa_itemdata-tax_code = 'KG'.

ENDIF.

wa_itemdata-item_amount = IT_EKPO-NETWR.

wa_itemdata-quantity = IT_EKPO-MENGE.

wa_itemdata-po_unit = IT_EKPO-MEINS.

APPEND wa_itemdata TO it_itemdata.

ENDLOOP.

CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'

EXPORTING

headerdata = wa_headerdata

IMPORTING

invoicedocnumber = wa_doc-BELNR

fiscalyear = wa_doc-GJAHR

TABLES

itemdata = it_itemdata

withtaxdata = it_withtaxdata

return = it_return.

When I assign the direct value gross_amount leaves the error to me the amount retention surpasses the amount of deudores/acreedores pos 001.

Tranks,

Edgar