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

Error BAPI bapi_incominginvoice_create

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2005 at 09:01 AM

    Hello Edgar,

    it looks like you are losing 2 digit in the item data. BAPI fields use type <b>BAPIWRBTR</b>, which is DEC(23,4).

    You take the item data from <b>IT_EKPO-NETWR</b>, which is CURR(13,2) and linked to the currenc-key EKKO-WAERS.

    You might find you 2 digit offset in this area.

    If you find my answer useful, please don't forget the reward.

    Regards,

    Juergen

    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.