将gl帐户数据发布到bapi_incominginvoice_create1后引发异常

时间:2018-10-10 09:31:54

标签: sap abap bapi

将gl帐户数据发布到bapi_incominginvoice_create1后,我引发了异常。

这是我的gl帐户数据:

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.

我想将这笔款项过账到gl帐户,但是当我执行该操作时,出现了这个异常:

Screenshot of exception

1 个答案:

答案 0 :(得分:1)

似乎在EKPO(采购凭证项目)表中找不到记录。通常,发票过帐需要PO记录。