0

I get an exception raised after posting gl account data to bapi_incominginvoice_create1.

This is my gl account data:

DATA : it_glacnt TYPE STANDARD TABLE OF bapi_incinv_create_gl_account,
           wa_glacnt TYPE bapi_incinv_create_gl_account.
    wa_glacnt-invoice_doc_item = '000002'.
    wa_glacnt-gl_account = '0000400100'.
    wa_glacnt-item_amount = '100.0000'.
    wa_glacnt-db_cr_ind = 'H'.
    wa_glacnt-comp_code = '010'.
    wa_glacnt-item_text     = 'Test TEXT'.
*   wa_glacnt-sdoc_item   = '0'.
    wa_glacnt-bus_area    = 'TMKK'.
    wa_glacnt-alloc_nmbr  = v_scanid.
    APPEND wa_glacnt TO it_glacnt .
    CLEAR wa_glacnt.

    CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE1'
      EXPORTING
        headerdata       = wa_miro_header
      IMPORTING
        invoicedocnumber = v_invno
        fiscalyear       = v_miroyr
      TABLES
        itemdata         = it_miro_item
        taxdata          = it_miro_tax
        glaccountdata    = it_glacnt
        withtaxdata      = it_withtax
        return           = it_ret.

    IF NOT v_invno IS INITIAL.

      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = abap_true.
    ELSE.

      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

    ENDIF.

  ENDIF.

I want to post this amount to gl account but when I execute, I get this exception:

Screenshot of exception

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • It looks like your post is mostly code; please add some more details and context – asidis Oct 10 '18 at 09:42
  • I have pass gl account information through this bapi. I have made an internal table it_glacnt for gl account . when I execute this, i am getting this an exception. – Krishna Santara Oct 10 '18 at 10:11
  • You want to post a vendor invoice against a purchase order (BAPI_INCOMINGINVOICE_CREATE1). The purchase order data is missing, see where the exception is raises, above that there is a selection on the purchase order item. Check the fields of PO_NUMBER and PO_ITEM of table ITEMDATA (it_miro_item) – József Szikszai Oct 10 '18 at 11:41
  • Could you please indicate what the BAPI returns, because posting the line of code with the exception "no_records_found" doesn't mean that it will be handled as an exception by the BAPI. Moreover, if this exception leads to a true error, then the BAPI should send back a clear message in the "RETURN" parameter. – Sandra Rossi Oct 10 '18 at 12:06

1 Answers1

1

It looks like records are not found in EKPO (purchasing document item) table. Generally, invoice posting needs PO records.

Jcube
  • 3
  • 2
mkysoft
  • 5,392
  • 1
  • 21
  • 30