Bapi BAPI_ACC_INVOICE_RECEIPT_POST

Hi,
I want to be able to use the bapi with tax. I have the following code which gives me the result: E FF 747 Tax amount must not be greater than the tax base.
Its not clear to me what i do wrong when filling the tables for the bapi. Any help will be appreciated.
FORM FILL_INTERNAL_TABLES.
  CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
       IMPORTING
            OWN_LOGICAL_SYSTEM = GD_DOCUMENTHEADER-OBJ_SYS.
fill header
  GD_DOCUMENTHEADER-OBJ_TYPE   = 'BKPFF'.
  GD_DOCUMENTHEADER-OBJ_KEY    = REF_KEY.
  GD_DOCUMENTHEADER-USERNAME   = SY-UNAME.
  GD_DOCUMENTHEADER-HEADER_TXT = 'AHJD BAPI Test'.
  GD_DOCUMENTHEADER-COMP_CODE  = 'A14'.
  GD_DOCUMENTHEADER-DOC_DATE   = '20050927'.
  GD_DOCUMENTHEADER-PSTNG_DATE = '20050927'.
  GD_DOCUMENTHEADER-DOC_TYPE   = 'KR'.
fill AP (line 1)
  IT_ACCOUNTPAYABLE-ITEMNO_ACC     = 1.
  IT_ACCOUNTPAYABLE-VENDOR_NO      = '0000001001'.
  IT_ACCOUNTPAYABLE-PMNTTRMS       = '30'.
  IT_ACCOUNTPAYABLE-ITEM_TEXT      = 'AP BAPI Test'.
  APPEND IT_ACCOUNTPAYABLE.
  IT_CURRENCYAMOUNT-ITEMNO_ACC   = 1.
  IT_CURRENCYAMOUNT-CURR_TYPE    = '00'.
  IT_CURRENCYAMOUNT-CURRENCY     = 'EUR'.
  IT_CURRENCYAMOUNT-AMT_DOCCUR   = -119.
  APPEND IT_CURRENCYAMOUNT.
fill GL (line 2)
  IT_ACCOUNTGL-ITEMNO_ACC     = 2.
  IT_ACCOUNTGL-GL_ACCOUNT     = '0043419002'.
  IT_ACCOUNTGL-ITEM_TEXT      = 'GL BAPI Test'.
IT_ACCOUNTGL-COSTCENTER     = '0000514200'.
  APPEND IT_ACCOUNTGL.
  IT_CURRENCYAMOUNT-ITEMNO_ACC   = 2.
  IT_CURRENCYAMOUNT-CURR_TYPE    = '00'.
  IT_CURRENCYAMOUNT-CURRENCY     = 'EUR'.
  IT_CURRENCYAMOUNT-AMT_DOCCUR   = 100.
  APPEND IT_CURRENCYAMOUNT.
fill tax
IT_ACCOUNTTAX-ITEMNO_ACC = 3.
IT_ACCOUNTTAX-TAX_CODE   = 'BA'.
APPEND IT_ACCOUNTTAX.
IT_CURRENCYAMOUNT-ITEMNO_ACC   = 3.
IT_CURRENCYAMOUNT-CURR_TYPE    = '00'.
IT_CURRENCYAMOUNT-CURRENCY     = 'EUR'.
IT_CURRENCYAMOUNT-AMT_DOCCUR   = 19.
IT_CURRENCYAMOUNT-AMT_BASE     = 100.
APPEND IT_CURRENCYAMOUNT.

Hi all, And thanks in advance,
We have been reading about this bapi to make an INVOICE. We use it and the table "return" , returns OK, so we supposed the invoice was created with its own invoice number, that´s to say BELNR (this number is inside the range than we have defined for the doc. type ). After that, when we access the BKPF table, the invoice is not there, we can´t find it. Can anyone tell me what´s going wrong?.
REPORT ztestbapi01 .
TABLES bkpf.
PARAMETERS: bukrs LIKE lfb1-bukrs DEFAULT 'PS01' OBLIGATORY.
DATA: header LIKE bapiache03,
      acc_pay LIKE bapiacap03 OCCURS 0 WITH HEADER LINE,
      acc_tgl LIKE bapiacgl03 OCCURS 0 WITH HEADER LINE,
      acc_tax LIKE bapiactx01 OCCURS 0 WITH HEADER LINE,
      cur_amo LIKE bapiaccr01 OCCURS 0 WITH HEADER LINE,
      return  LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
      porder LIKE bapiacpo00 OCCURS 0 WITH HEADER LINE,
      ext_doc LIKE bapiacdockey OCCURS 0 WITH HEADER LINE,
      obj_type LIKE bapiache03-obj_type,
      obj_key LIKE bapiache03-obj_key,
      obj_sys LIKE bapiache03-obj_sys.
START-OF-SELECTION.
FORM fill_header USING    head STRUCTURE bapiache03.
  CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
       IMPORTING
            own_logical_system             = head-obj_sys
       EXCEPTIONS
            own_logical_system_not_defined = 1
            OTHERS                         = 2.
  IF sy-subrc <> 0.
  ENDIF.
  head-username = sy-uname.
  head-header_txt = 'Prueba de App Cont Bapi'.
  head-comp_code = bukrs.
  head-fisc_year = '2005'.
  head-doc_date = sy-datum.
  head-pstng_date = sy-datum.
  head-fis_period = '11'.
  head-doc_type = 'HM'.
  head-obj_type = 'BKPFF '.
  head-obj_key = '100000036PS012005'.
  head-ac_doc_no = '1000000036'.
ENDFORM.                    " fill_header
FORM fill_acc_tgl.
  acc_tgl-itemno_acc = '002'.
  acc_tgl-gl_account = '0000606000'.
  acc_tgl-comp_code = bukrs.
  acc_tgl-tax_code = 'SC'.
  APPEND acc_tgl.
ENDFORM.                    " fill_acc_tgl
FORM fill_cur_amo.
  cur_amo-itemno_acc = '001'.
  cur_amo-currency = cur_amo-currency_iso = 'EUR'.
  cur_amo-curr_type = '00'.
cur_amo-amt_doccur = 69.
  cur_amo-amt_base = 69.
  APPEND cur_amo.
  cur_amo-itemno_acc = '002'.
  cur_amo-currency = cur_amo-currency_iso = 'EUR'.
  cur_amo-curr_type = '00'.
cur_amo-amt_doccur = 69.
  cur_amo-amt_base = 69.
  APPEND cur_amo.
ENDFORM.                    " fill_cur_amo
FORM fill_acc_pay.
  acc_pay-itemno_acc = '001'.
  acc_pay-vendor_no = '0007759049'.
  acc_pay-gl_account = '0000400004'.
  acc_pay-pmnttrms = '0001'.
  acc_pay-bline_date = sy-datum.
  acc_pay-pymt_meth = 'W'.
  acc_pay-pmnt_block = 'A'.
  acc_pay-alloc_nmbr = '20051102'.
  APPEND acc_pay.
ENDFORM.                    " fill_acc_pay
  PERFORM fill_header USING header.
  PERFORM fill_acc_pay.
  PERFORM fill_acc_tgl.
  PERFORM fill_cur_amo.
  CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_CHECK'
       EXPORTING
            documentheader = header
       IMPORTING
            obj_type       = obj_type
            obj_key        = obj_key
            obj_sys        = obj_sys
       TABLES
            accountpayable = acc_pay
            accountgl      = acc_tgl
            accounttax     = acc_tax
            currencyamount = cur_amo
            return         = return.
  LOOP AT return.
    WRITE: / return-type, return-id, return-number, return-message.
  ENDLOOP.
  CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST'
       EXPORTING
            documentheader = header
      IMPORTING
           obj_type       = obj_type
           obj_key        = obj_key
           obj_sys        = obj_sys
       TABLES
            accountpayable = acc_pay
            accountgl      = acc_tgl
            accounttax     = acc_tax
            currencyamount = cur_amo
            return         = return.
  LOOP AT return.
    WRITE: / return-type, return-id, return-number, return-message.
  ENDLOOP.
  REFRESH return. CLEAR return.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       EXPORTING
            wait   = 'X'
       IMPORTING
            return = return.
  LOOP AT return.
    WRITE: / return-type, return-id, return-number, return-message.
  ENDLOOP.

Similar Messages

  • INVOICE or CREDIT MEMO in BAPI  'BAPI_ACC_INVOICE_RECEIPT_POST'

    Hi,
    I use BAPI   'BAPI_ACC_INVOICE_RECEIPT_POST' 
    I search the parameters field in the BAPI ' BAPI_ACC_INVOICE_RECEIPT_POST'  to fill  the type of document   " INVOICE or CREDIT MEMO. "
    best regard

    Hi,
    GOTO T-code VOFA and search for your valid document type,and give the suitable document type.
    Please let me know if you still have any issues.
    Thansk and regards,
    Rajeshwar

  • Error in Bapi : BAPI_ACC_INVOICE_RECEIPT_POST

    Hi Experts,
                    Iam using bapi " BAPI_ACC_INVOICE_RECEIPT_POST " to post outgoing payments ( tcode F-53 ).
    I have passed all the values to the bapi structures. It is giving the error saying -- " Required field DOC_TYPE was not transferred in parameter DOCUMENTHEADER ". What could be the problem.
    Iam passing the doc_type field also. In debugging also, it is showing the doc_type value.
    Still error is throwing.
    Thanks in advance
    Regards
    Murali Krishan.T

    Hi Vinod,
                   Thanks for prompt reply.
                   I have compared my program code with the standard program that you suggested.
    And I passed the values to the bapi strucutres accordingly.
    But it is throwing these errors :
    Error in document: BKPFF $ KDVCLNT201
    Required field USERNAME was not transferred in parameter DOCUMENTHEADER
    Required field COMP_CODE was not transferred in parameter ACCOUNTPAYABLE
    Required field PSTNG_DATE was not transferred in parameter ACCOUNTPAYABLE
    Required field COMP_CODE was not transferred in parameter DOCUMENTHEADER
    Required field PSTNG_DATE was not transferred in parameter DOCUMENTHEADER
    Required field DOC_TYPE was not transferred in parameter DOCUMENTHEADER
    what could be the problem?
    regards,
    Murali

  • Need to upload mass excel sheet using the bapi bapi_acc_document_post.

    I am assigned with an object, where I need to post the records from a mass excel sheet in to ECC or/and BW basing the dimensions using the bapi bapi_acc_document_post.the excel sheet has header and Item data. I am pretty much new to this bapi's
    please do the need ful

    Check report "ACC_BAPI_TEST_INVOICE_RECEIPT",
    this report calls BAPI "BAPI_ACC_INVOICE_RECEIPT_POST",
    but the parameters are nearly the same.
    Best Regards, Dirk

  • What are all mantatory fields for BAPI_ACC_INVOICE_RECEIPT_POST

    Hi Friends..
    I tried to use BAPI_ACC_INVOICE_RECEIPT_POST for FB60 transaction.
    But whenever I gave input it throws some error message in return statement.
    So plz let me know the mantatory input fields for the BAPI "BAPI_ACC_INVOICE_RECEIPT_POST"
    Thanks in Advance.
    Thanks
    Gowrishankar

    Hi,
    Check in the import  tab of the BAPI the parameters that are not marked as optional are mandatory --DOCUMENTHEADER(Table)
    Regards,
    Bhanu

  • BAPI_ACC_INVOICE_RECEIPT_POST - can it calculate taxes

    Hi folks,
    I've serious problems with this BAPI. Thing is that I get document data for posting via IDoc INVOIC01.
    Now I want to map this data into structures of BAPI BAPI_ACC_INVOICE_RECEIPT_POST to post document via RFC in another system. Idoc data don't contain tax data.
    I expected that this BAPI can calculate tax, but it seems like I have to calculate tax one my own. This logic is to difficult.
    Is there a way to start the BAPI so that it calculates the tax internally and creates the line items accordingly???
    Thanks and best regards, Thomas

    Hi folks,
    I've serious problems with this BAPI. Thing is that I get document data for posting via IDoc INVOIC01.
    Now I want to map this data into structures of BAPI BAPI_ACC_INVOICE_RECEIPT_POST to post document via RFC in another system. Idoc data don't contain tax data.
    I expected that this BAPI can calculate tax, but it seems like I have to calculate tax one my own. This logic is to difficult.
    Is there a way to start the BAPI so that it calculates the tax internally and creates the line items accordingly???
    Thanks and best regards, Thomas

  • BAPI_ACC_INVOICE_RECEIPT_POST - BANK Reference Field ?

    Hi All,
    We are using the BAPI BAPI_ACC_INVOICE_RECEIPT_POST to post an Invoice.
    The requirement is to be able to pass the Bank Control Key and the Bank Reference
    field while creating the invoice.
    I am able to find the field to pass the Bank Control Key, but am not able to find a
    field for the Bank Reference field in any of the export parameters or Structures.
    Bank control key is populated in gs_acpa00-ctrl_key field.
    Please advise.
    Thank you
    Lalitha

    Hi. How did you resolve this?
    I am trying to set a different field using a user exit, it is available in the BAPI though, but it is called from a 3rd party application so we can not alter the actual call, we need to find a user exit.
    Any help would be greatly appreciated.
    Regards,
    Dave.

  • BAPI_ACC_INVOICE_RECEIPT_POST - State Withholding

    Hello All,
    I call BAPI_ACC_INVOICE_RECEIPT_POST and pass it tax withholding information in the EXTENSION.  This is then used to populate Structure ACCIT_WT. 
    When there is Federal withholding, the BAPI works correctly and automatically creates the Fed withholding ledger entry. 
    When there is State withholding, the BAPI attempts to create the ledger entry, but returns an error: "Field Region is a required field for G/L account 0050 256167". 
    This is because we have a field called ZZREGION that is required when posting to account 256167.  Sense the BAPI generates the withholding entries automatically through SAP code, ZZREGION is not populated, thus causing the error.
    Any ideas on how to solve this problem?
    Thanks!

    Hi Aaron,
    I saw your thread regarding the BAPI BAPI_ACC_INVOICE_RECEIPT_POST (url: BAPI_ACC_INVOICE_RECEIPT_POST - State Withholding)
    I have a requirement to use the same BAPI. It is working fine for all scenarios other that withholding tax.
    I not getting any idea where to pass the withhold tax details inside the customer exit. please help with this
    Thanks in Advance.

  • BAPI_ACC_INVOICE_RECEIPT_POST how to calculate tax

    Hallo folks,
    i can't figuere out how to calculate the tax with the bapi BAPI_ACC_INVOICE_RECEIPT_POST. I already searched the Forums and google but no Solution helped me.
    I don't really get it, which fields i have to fill. For example i do i have to fill the amt_base for every item or just for the tax structure?
        ls_accgl-comp_code  = ls_outtab-zzfaleiemp.
        ls_accgl-tax_code   = 'V3'.
        ls_accgl-profit_ctr = ls_outtab-prctr.
        ls_accgl-sales_ord  = ls_outtab-kdauf.
        ls_accgl-s_ord_item = ls_outtab-kdpos.
        APPEND ls_accgl TO lt_accgl.
        CLEAR ls_curamt.
        ls_curamt-itemno_acc     = l_itemno.
        ls_curamt-currency_iso   = 'EUR'.
        ls_curamt-amt_doccur     = ls_outtab-zzsum.
      ls_acctax-itemno_acc = l_itemno.
      ls_acctax-tax_rate   = '19.000'.
      ls_acctax-gl_account = ls_accgl-gl_account.
      ls_acctax-tax_code   = 'V3'.
      ls_acctax-acct_key   = 'VST'.
      ls_acctax-cond_key   = 'MWVS'.
      APPEND ls_acctax TO lt_acctax.
      CLEAR ls_curamt.
      ls_curamt-itemno_acc = l_itemno.
      ls_curamt-currency   = 'EUR'.
    *  ls_curamt-amt_doccur = l_sum.
      ls_curamt-amt_base   = l_sum.
      APPEND ls_curamt TO lt_curamt.
    Because it doesn't matter what field i fill in TA FB03 there never come any taxes up.
    has anybody some Ideas?
    Best regards
    Mathias

    Hi,
      check the below code
    Read Invoice Work item data
      CLEAR: lwa_inv_header.
      SELECT SINGLE * INTO lwa_inv_header
        FROM zbw_inv_header
      WHERE zinv_id = i_documentheader-zinv_id.
      IF sy-subrc = 0.
    Get history line count
        SELECT COUNT(*) INTO lv_hist_lineid
          FROM zbw_wi_history
         WHERE zinv_id = i_documentheader-zinv_id.
    Get exception line count
        SELECT COUNT(*) INTO lv_lineid
          FROM zbw_wi_exception
         WHERE zinv_id = i_documentheader-zinv_id.
    Get document type
        SELECT SINGLE zdoctype INTO lv_doc_type
          FROM zbw_doc_types
        WHERE zinvtype = i_documentheader-zinvoicetype AND
              zinvind  = i_documentheader-invoice_ind.
        IF sy-subrc <> 0.
          CLEAR t_return.
          t_return-ztype    = 'E'.
          t_return-zmessage = 'Document type configuration is not done'.
          APPEND t_return.
          lv_lineid = lv_lineid + 1.
          CLEAR lwa_exceptions.
          lwa_exceptions-zinv_id  = i_documentheader-zinv_id.
          lwa_exceptions-zlineid  = lv_lineid.
          lwa_exceptions-zstep_id = i_stepid.
          lwa_exceptions-zuser    = sy-uname.
          lwa_exceptions-zdate    = sy-datum.
          lwa_exceptions-ztime    = sy-uzeit.
          lwa_exceptions-zexception = t_return-zmessage.
          MODIFY zbw_wi_exception FROM lwa_exceptions.
          EXIT.
        ENDIF.
    Read posting date config
        SELECT SINGLE * INTO lwa_posting
          FROM zbw_posting_date
        WHERE zarea = i_documentheader-zinvoicetype.
        IF sy-subrc <> 0.
          CLEAR t_return.
          t_return-ztype    = 'E'.
          t_return-zmessage = 'Posting date configuration is not done'.
          APPEND t_return.
          lv_lineid = lv_lineid + 1.
          CLEAR lwa_exceptions.
          lwa_exceptions-zinv_id  = i_documentheader-zinv_id.
          lwa_exceptions-zlineid  = lv_lineid.
          lwa_exceptions-zstep_id = i_stepid.
          lwa_exceptions-zuser    = sy-uname.
          lwa_exceptions-zdate    = sy-datum.
          lwa_exceptions-ztime    = sy-uzeit.
          lwa_exceptions-zexception = t_return-zmessage.
          MODIFY zbw_wi_exception FROM lwa_exceptions.
          EXIT.
        ENDIF.
        IF lwa_posting-zcurrentdate = 'X'.
    Todays date as posting date
          lwa_documentheader-pstng_date = sy-datum.
        ELSE.
          lv_today = sy-datum.
          CLEAR: lv_days,
                 lv_months,
                 lv_years,
                 lv_calcdt.
    Calculate last day of previous month as posting date
          CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
            EXPORTING
              date      = lv_today
              days      = lv_days
              months    = lv_months
              signum    = '-'
              years     = lv_years
            IMPORTING
              calc_date = lv_calcdt.
          IF sy-subrc <> 0.
            CLEAR t_return.
            t_return-ztype    = 'E'.
            CONCATENATE 'Error while calculating the'
                        'Last day of previous month'
              INTO t_return-zmessage SEPARATED BY space.
            APPEND t_return.
            lv_lineid = lv_lineid + 1.
            CLEAR lwa_exceptions.
            lwa_exceptions-zinv_id  = i_documentheader-zinv_id.
            lwa_exceptions-zlineid  = lv_lineid.
            lwa_exceptions-zstep_id = i_stepid.
            lwa_exceptions-zuser    = sy-uname.
            lwa_exceptions-zdate    = sy-datum.
            lwa_exceptions-ztime    = sy-uzeit.
            lwa_exceptions-zexception = t_return-zmessage.
            MODIFY zbw_wi_exception FROM lwa_exceptions.
            EXIT.
          ENDIF.
          CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
            EXPORTING
              day_in            = lv_calcdt
            IMPORTING
              last_day_of_month = lwa_documentheader-pstng_date
            EXCEPTIONS
              day_in_no_date    = 1
              OTHERS            = 2.
        ENDIF.
    Populate the header data
        lwa_documentheader-obj_type       = 'IBKPF'.
        CONCATENATE sy-datum sy-uzeit lwa_documentheader-comp_code
          INTO lwa_documentheader-obj_key.
        lwa_documentheader-obj_sys        =  sy-sysid.
        lwa_documentheader-username       =  sy-uname.
        lwa_documentheader-header_txt     =  'HD BAPI Test'.
        lwa_documentheader-comp_code      = i_documentheader-comp_code.
        lwa_documentheader-fisc_year      = i_documentheader-zfisc_year.
        lwa_documentheader-doc_date       =  i_documentheader-doc_date.
        lwa_documentheader-trans_date     = sy-datum.
        lwa_documentheader-fis_period     =  i_documentheader-zfisc_period.
        lwa_documentheader-doc_type       =  lv_doc_type.
            ALL ITEM DATA                                               *
    Populate Account payble data
        CLEAR lt_accountpayable.
        lt_accountpayable-itemno_acc      = 1.
        lt_accountpayable-vendor_no       = i_documentheader-zvendor.
        lt_accountpayable-item_text       = 'Webdesk invoice posting'.
        APPEND lt_accountpayable.
        clear lt_accountpayable.
    Populate the currency for Account payble
      CLEAR lt_currencyamount.
      lt_currencyamount-itemno_acc      = 1.
      lt_currencyamount-currency        = i_documentheader-currency.
      lt_currencyamount-amt_doccur      = i_documentheader-gross_amount * -1.
      APPEND lt_currencyamount.
      clear lt_currencyamount.
    Loop the GL table
        CLEAR lv_errfl.
        LOOP AT t_glacc.
          CONCATENATE i_documentheader-supcountry t_glacc-tax_code
            INTO lv_vakey SEPARATED BY space.
          SELECT knumh INTO lv_knumh
           UP TO 1 ROWS
            FROM konh
           WHERE vakey = lv_vakey.
          ENDSELECT.
          IF sy-subrc = 0.
            SELECT SINGLE kbetr INTO lv_kbetr
              FROM konp
             WHERE knumh = lv_knumh.
            IF sy-subrc <> 0.
              lv_errfl = 'X'.
            ENDIF.
          ELSE.
            lv_errfl = 'X'.
          ENDIF.
          lv_kbetr = lv_kbetr / 10.
          IF t_glacc-tax_base_amount IS INITIAL.
            lv_taxamt  =  ( i_documentheader-gross_amount * lv_kbetr ) / 100.
          ELSE.
            lv_taxamt  =  ( t_glacc-tax_base_amount * lv_kbetr ) / 100.
          ENDIF.
    Populate the GL data
          lt_accountgl-itemno_acc           = 2.
          lt_accountgl-gl_account           = t_glacc-gl_account.
          lt_accountgl-tax_code             = t_glacc-tax_code.
          lt_accountgl-acct_key             = t_glacc-zacct_key.
          lt_accountgl-item_text            = 'Webdesk invoice posting'.
          APPEND lt_accountgl.
          clear lt_accountgl.
          CLEAR lt_currencyamount.
          lt_currencyamount-itemno_acc        =  2.
          lt_currencyamount-currency          =  i_documentheader-currency.
          lt_currencyamount-amt_doccur        =  t_glacc-item_amount - lv_taxamt.
          APPEND lt_currencyamount.
          clear lt_currencyamount.
          IF NOT t_glacc-tax_code IS INITIAL.
    Populate the Tax data
            lt_accounttax-itemno_acc = 3.
            lt_accounttax-gl_account = t_glacc-ztaxgl_account.
            lt_accounttax-tax_code   = t_glacc-tax_code.
            lt_accounttax-acct_key   = t_glacc-zacct_key.
            APPEND lt_accounttax.
            clear lt_accounttax.
            CLEAR lt_currencyamount.
            lt_currencyamount-itemno_acc        =  3.
            lt_currencyamount-currency          =  i_documentheader-currency.
            lt_currencyamount-amt_doccur        =  lv_taxamt.
            IF t_glacc-tax_base_amount IS INITIAL.
              lt_currencyamount-amt_base          =  i_documentheader-gross_amount.
            ELSE.
              lt_currencyamount-amt_base          =  t_glacc-tax_base_amount.
            ENDIF.
            APPEND lt_currencyamount.
            clear lt_currencyamount.
          ENDIF.
        ENDLOOP.
        IF lv_errfl = 'X'.
          CLEAR t_return.
          t_return-ztype    = 'E'.
          CONCATENATE 'Error while calculating the'
                      'Tax amount'
            INTO t_return-zmessage SEPARATED BY space.
          APPEND t_return.
          lv_lineid = lv_lineid + 1.
          CLEAR lwa_exceptions.
          lwa_exceptions-zinv_id  = i_documentheader-zinv_id.
          lwa_exceptions-zlineid  = lv_lineid.
          lwa_exceptions-zstep_id = i_stepid.
          lwa_exceptions-zuser    = sy-uname.
          lwa_exceptions-zdate    = sy-datum.
          lwa_exceptions-ztime    = sy-uzeit.
          lwa_exceptions-zexception = t_return-zmessage.
          MODIFY zbw_wi_exception FROM lwa_exceptions.
          EXIT.
        ENDIF.
               CALLING BAPI                                             *
        CLEAR lwa_wi_history.
        lwa_wi_history-zinv_id  = i_documentheader-zinv_id.
        lwa_wi_history-zlineid  = lv_hist_lineid.
        lwa_wi_history-zstep_id = i_stepid.
        lwa_wi_history-zuser    = sy-uname.
        lwa_wi_history-zdate    = sy-datum.
        lwa_wi_history-ztime    = sy-uzeit.
        CLEAR: lt_return[].
        CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST'
          EXPORTING
            documentheader = lwa_documentheader
          IMPORTING
            obj_type       = obj_type
            obj_key        = obj_key
            obj_sys        = obj_sys
          TABLES
            accountpayable = lt_accountpayable
            accountgl      = lt_accountgl
            accounttax     = lt_accounttax
            currencyamount = lt_currencyamount
            return         = lt_return.
    Thanks & Regards,
    Sateesh.

  • BAPI_ACC_INVOICE_RECEIPT_POST withholding tax

    Hi Experts,
    I'm using the BAPI BAPI_ACC_INVOICE_RECEIPT_POST to post an vendor invoice. It is working fine with the normal posting. But when we post with withholding tax base, its not successful.
    I have mapped the Withholding tax code, Business place and Section code to the correct parameters of bapi. Then inside the bapi I have supplied the withholding tax base  to IT_ACCCR-QSSHB.
    But I'm getting the message Balance in Transaction currency. But I'm sure that I'm passing the currencies correctly.
    Please help me with the proper method of posting.
    Thanks in Advance.
    Edited by: Nivash S on Aug 24, 2010 12:32 PM

    I got this working, so I will answer my own post with an explanation of the solution, in case it benefits anyone else.
    There are numerous posts in the forum about calculating Extended Withholding Tax through a BAPI, and the solutions given tend to suggest that BAPI_ACC_DOCUMENT_POST will not work with EWT, but BAPI_ACC_INVOICE_RECEIPT_POST will work if you activate the user exit EXIT_SAPLACC4_001.
    In investigating this, I found the following OSS notes most helpful:
    OSS Note 306504 - Collective note: BAPIs for the AC Interface
    OSS Note 556311 - BAPI in the extended withholding tax
    OSS Note 487722 - Using EXTENSION1 for accounting BAPIs
    Note 556311 explains how to implement extended withholding tax with BAPI_ACC_INVOICE_POST, by implementing a user exit that processes the EXTENSION1 parameter, and it provides sample EWT logic for that user exit.  However, note 487722 explains how to implement Business Transaction Event RWBAPI01, to process the EXTENSION1 table from BAPI_ACC_DOCUMENT_POST.
    By implementing the user exit logic from note 556311, in the BTE described in note 487722, the extended withholding tax was calculated correctly from BAPI_ACC_DOCUMENT_POST.

  • BAPI_ACC_INVOICE_RECEIPT_POST problem with Business place

    Hi Experts,
    I'm using the the BAPI  "BAPI_ACC_INVOICE_RECEIPT_POST" for the F-43 posting, it's working fine. But I have a little problem here, Even though I pass the correct values to the fields "Valuation type" and "Business place" in the posted document I could see only "?".
    Could you please some one help me in finding what might be the problem.
    Thanks
    Nivash

    hi
    hope it will help you.
    <REMOVED BY MODERATOR>
    BAPI_ACC_GL_POSTING_CHECK
    CALL FUNCTION 'BAPI_ACC_GL_POSTING_CHECK'
    EXPORTING
    documentheader = w_documentheader
    TABLES
    accountgl = it_accountgl
    currencyamount = it_currencyamount
    return = it_return.
    Populate the corresponding tables with the data you have.
    For the Date do convert it.
    PERFORM convert_date USING it_header-bldat
    CHANGING w_documentheader-doc_date.
    w_documentheader-comp_code = 'z998'
    w_documentheader-doc_type = 'SA'
    "and fill the respective tables this way .
    <b>
    BAPI_ACC_GL_POSTING_POST
    </b>
    call function 'BAPI_ACC_GL_POSTING_POST'
    exporting
    documentheader = doc_header
    IMPORTING
    OBJ_TYPE = l_objtype
    * OBJ_KEY =
    * OBJ_SYS =
    tables
    accountgl = t_accountgl
    currencyamount = t_curramt
    return = t_return
    * EXTENSION1 =
    Edited by: Alvaro Tejada Galindo on Feb 7, 2008 9:51 AM

  • Accts Payable posting using BAPI

    Hi I am trying to use the Bapi: BAPI_ACC_INVOICE_RECEIPT_POST and am getting an error for "Balance in Transaction Currency. Here is how I am loading the fields, if anyone can see where my error is I would appreciate it.
    * fill header
      gd_documentheader-obj_type   = 'BKPFF'.
      gd_documentheader-obj_key    = ref_key.
    * GD_DOCUMENTHEADER-OBJ_SYS    = FUNKTION OWN_LOGICAL_SYSTEM_GET
      gd_documentheader-username   = sy-uname.
      gd_documentheader-header_txt = '2008 RPT Header'.
      gd_documentheader-comp_code  = '0604'.
      gd_documentheader-fisc_year  = '2008'.
      gd_documentheader-doc_date   = '20081101'.
      gd_documentheader-pstng_date = '20081114'.
      gd_documentheader-doc_type   = 'KR'.
      GD_DOCUMENTHEADER-REF_DOC_NO = '0000003761'.
    * fill AP (line 1)
      it_accountpayable-itemno_acc     = 1.
      it_accountpayable-vendor_no      = '0000111111'.
      it_accountpayable-gl_account     = '0000111111'.
      it_accountpayable-pmnttrms       = 'CINA'.
      it_accountpayable-bline_date     = '20071120'.
      it_accountpayable-pmtmthsupl     = '6'.
      it_accountpayable-pymt_meth      = 'C'.
      it_accountpayable-pmnt_block     = ' '.
      it_accountpayable-item_text      = '2008 RPT Detail'.
      APPEND it_accountpayable.
      it_currencyamount-itemno_acc   = 1.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'USD'.
      IT_CURRENCYAMOUNT-CURRENCY_ISO = 'USD'.
      it_currencyamount-amt_doccur   = -200000.
    *  it_currencyamount-amt_base     = .
      APPEND it_currencyamount.
    * fill GL (line 2)
      it_accountgl-itemno_acc     = 2.
      it_accountgl-gl_account     = '0000222222'.
      it_accountgl-comp_code      = '0604'.
      it_accountgl-pstng_date     = '20081114'.
      IT_ACCOUNTGL-DOC_TYPE       = 'KR'.
      it_accountgl-ac_doc_no      = '0000012345'.
      it_accountgl-fisc_year      = '2008'.
      IT_ACCOUNTGL-FIS_PERIOD     = '11'.
      IT_ACCOUNTGL-TAX_CODE       = 'N1'.
      it_accountgl-item_text      = 'GL BAPI Test'.
      APPEND it_accountgl.
      it_currencyamount-itemno_acc   = 2.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'USD'.
      IT_CURRENCYAMOUNT-CURRENCY_ISO = 'USD'.
      it_currencyamount-amt_doccur   = 200000.
    *  it_currencyamount-amt_base     = .
      APPEND it_currencyamount.
    Thanks
    Mike

    Try with both amounts positive.
    Rob

  • Regarding BAPI_ACC_INVOICE_RECEIPT_POST

    Hi,
    Using this BAPI BAPI_ACC_INVOICE_RECEIPT_POST  i am able to create documents with out tax code population.
    but my requirement is i have to populate tax code, automatically calculate tax, payment referrence...etc.
    but i didn't find these fields in the BAPI.
    automatically calculate tax,
    payment referrence
    Please suggest which BAPI i can use to post vendor invoices. with out populating purchase order nubmer.
    Regards,
    Venkata

    Aparently that field doesn't exist, if you want to change it you have to use the extension.
    Check this thread, Bianchi fills that field with the extension
    BAPI_ACC_DOCUMENT_POST Update reason code on BSEG

  • Error BAPI_ACC_INVOICE_RECEIPT_POST

    Hello,
    I try to use the bapi 'BAPI_ACC_INVOICE_RECEIPT_POST'.
    If I run with transaction SE37 it works correctly.
    But I've created a program that do the same and don't work well.
    The message in the table it_message is the following:
    Vendor 3000320 is not defined in company code 001.
    This exists in tables LFA1, KNA1, LFB1 and KNB1 in the company code 001.
    And if I execute the transaction FB60 and F70 works well too.
    Somebody know what I'm doing wrong?
    Thanks!!
    This is the source code of the program.
    DATA: BEGIN OF it_documentheader OCCURS 0.
            INCLUDE STRUCTURE bapiache03.
    DATA: END OF it_documentheader.
    DATA: BEGIN OF it_customercpd OCCURS 0.
            INCLUDE STRUCTURE bapiacpa00.
    DATA: END OF it_customercpd.
    DATA: BEGIN OF it_accountpayable OCCURS 0.
            INCLUDE STRUCTURE bapiacap03.
    DATA: END OF it_accountpayable.
    DATA: BEGIN OF it_accountgl OCCURS 0.
            INCLUDE STRUCTURE bapiacgl03.
    DATA: END OF it_accountgl.
    DATA: BEGIN OF it_accounttax OCCURS 0.
            INCLUDE STRUCTURE bapiactx01.
    DATA: END OF it_accounttax.
    DATA: BEGIN OF it_currencyamount OCCURS 0.
            INCLUDE STRUCTURE bapiaccr01.
    DATA: END OF it_currencyamount.
    DATA: BEGIN OF it_return OCCURS 0.
            INCLUDE STRUCTURE bapiret2.
    DATA: END OF it_return.
    CLEAR it_documentheader.
    CLEAR it_accountgl.
    CLEAR it_accounttax.
    CLEAR it_currencyamount.
    CLEAR it_return.
    CLEAR it_accountpayable.
    REFRESH it_documentheader.
    REFRESH it_accountgl.
    REFRESH it_accounttax.
    REFRESH it_currencyamount.
    REFRESH it_return.
    REFRESH it_accountpayable.
    */HEADER
    it_documentheader-doc_type   = 'G3'.
    it_documentheader-doc_date   = sy-datum.
    it_documentheader-comp_code  = '001'.
    it_documentheader-pstng_date = sy-datum.
    it_documentheader-header_txt = 'HEADER_TXT'.
    it_documentheader-username   = sy-uname.
    it_documentheader-ref_doc_no = 'REF_DOC_NO'.
    it_documentheader-fisc_year  = 2009.
    APPEND it_documentheader.
    */CUSTOMER CPD
    it_customercpd-name = 'NAME'.
    it_customercpd-city = 'CITY'.
    it_customercpd-country = 'ES'.
    APPEND it_customercpd.
    */ACCOUNTGL
    it_accountgl-itemno_acc = 1.
    it_accountgl-gl_account = '0057100002'.
    it_accountgl-comp_code  = '001'.
    it_accountgl-pstng_date = sy-datum.
    it_accountgl-item_text  = 'ITEM_TEXTS'.
    APPEND it_accountgl.
    */CURRENCY DEL ACCOUNTGL
    it_currencyamount-itemno_acc   = 1.
    it_currencyamount-currency     = 'EUR'.
    it_currencyamount-currency_iso = 'EUR'.
    it_currencyamount-amt_doccur   = '100.00'. 
    APPEND it_currencyamount.
    */ACCOUNTPAYABLE
    it_accountpayable-itemno_acc = 2.
    it_accountpayable-vendor_no  = '003000320'.
    it_accountpayable-item_text  = 'ITEM_TEXTS_ACCOUNT_PAYABLE'.
    APPEND it_accountpayable.
    */CURRENCY DEL ACCOUNTPAYABLE
    it_currencyamount-itemno_acc   = 2.
    it_currencyamount-currency     = 'EUR'.
    it_currencyamount-currency_iso = 'EUR'.
    it_currencyamount-amt_doccur   = '100.00-'.
    APPEND it_currencyamount.
    CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST'
      EXPORTING
        documentheader = it_documentheader
      TABLES
        accountpayable = it_accountpayable
        accountgl      = it_accountgl
        accounttax     = it_accounttax
        currencyamount = it_currencyamount
        return         = it_return.
    BREAK-POINT.
    WAIT UP TO 2 SECONDS.
    COMMIT WORK AND WAIT.
    BREAK-POINT.
    Edited by: Francesc Ribot Cobo on Mar 19, 2009 12:22 PM

    Hi Aaron - I believe that for each line item you should only have only one of the accountgl or accountpayable tables populated but not both. So for the first line item remove the code for the accountgl since it appears it is a vendor item. The GL will be updated inherently.
    Andy

  • Bapi for transaction FB60

    Hi All,
    I need bapi which can create document for transaction FB60 and later we can do the commit explicitly. we need to upload
    *HEADER     *
    BESG-LIFNR, BKPF-BLDAT, BKPF-BUDAT, INVFO-WRBTR,
    BKPF-BUKRS, BKPF-WAERS, BKPF-XBLNR, BSEG-MWSKZ,
    BKPF-BKTXT, INVFO-ZFBDT, INVFO-ZTERM
    LINE ITEM
    BSEG-HKONT, BSEG-SGTXT, BSEG-WRBTR, BSEG-MWSKZ, BSEG-TXJCD, BSEG-KOSTL, BSEG-KSTRG,
    BSEG-MATNR, BSEG-MENGE, BSEG-MEINS
    i know one bapi BAPI_ACC_INVOICE_RECEIPT_POST but i am not able to pass the value of vendor as a header data on this bapi. please suggest.
    Thanks,
    Madhu

    I have one BAPI API_ACC_INVOICE_RECEIPT_POST, i think i hcan use this BAPI for my requirement but while posting the data i am getting errors :
    1. Required field AMT_BASE was not transferred in parameter  CURRENCYAMOUNT
    2. Required field ACCT_KEY was not transferred in parameter ACCOUNTTAX
    In the excel sheet these two fields data is not given, then how can i pass the values in these two fileds.
    Please reply,
    Thanks

Maybe you are looking for

  • Ldap security provider leads in 401 errors in WL 12.1.3

    I'm facing a migration from 10.3.2 to 12.1.3. The configuration is almost the same (I'll bet that config.xml is more or lest the same from previos version). In my environment, the user's authentication and authorization is made using an external (not

  • Hierarchical Expanding List respecting open level

    I am running into a perplexing problem.. I am trying to use a Hierarchical Expanding List as a page 0 menu in a side region. Works great EXCEPT for the fact the current link is CLOSED in the list when you click on the page called by the link. Does an

  • BB desktop manager (DM) keeps asking me to update to 5.0 & i'm already at 5.0

    I've already updated my phone to v5.0.0.699, yet the Desktop Manager just said that there is another update available for my phone (The OS, not one of the apps.) everytime i connect to bb dm v5.0.1 i receive this message: Updated versions of the appl

  • I have lost my catalog

    I have been moving pictures to a new computer. I planned to put my catalogs in C:/ data/pse/catalogs/   But they didn't get there. I have two catalogs that I want one of which is open, I can't find the the largest one.I have been adding things to it

  • IMac to replace my old G4 PowerPC ?

    This may be a often asked question but I cannot locate an answer that satisfies my particular needs. First, this is how I use my setup: I currently work on a G4 1.25 Dual PowerPC (mirror doors) with 1.25 GB RAM and an 80GB harddrive. I have need for