Issue in BAPI_ACC_DOCUMENT_POST

Dear Sapgurus,
in se37 with bapi with test values i am going execute
In document Header BUS_ACT RFBU,USERNAME  *****,COMP_CODE 1001,DOC_DATE 25.03.2010,PSTNG_DATE 25.03.2010,FISC_YEAR2009, FIS_PERIOD 00,DOC_TYPE KV, In Account G/L TabITEMNO_ACC  0000000002,GL_ACCOUNT 114812,DOC_TYPE  LB,COMP_CODE 1001, BUS_AREA K001, FISC_YEAR2009,PSTNG_DATE 25.03.2010,VALUE_DATE 25.03.2010, In Account Receivable Table ITEMNO_ACC 0000000001,CUSTOMER A-C-P-234,GL_ACCOUNT 224011,COMP_CODE 1010, BUS_AREA K001, In Amount Table  0000000002    INR   INR 1,000.0000,0000000003 INR INR 103.0000,0000000001INR ,  INR 1,103.0000, After Executive bapi with example value system popup error message
E RW                   609 Error in document: BKPFF $ DERCLNT210
E F5                   702 Balance in transaction currency
Regards
Rajani

I think the error is coming because there is no item for "0000000003 INR INR 103.0000" in amount table.

Similar Messages

  • Tax issues in BAPI_ACC_DOCUMENT_POST

    Hi Friends,
    We have a requirement wherein, the incoming invoice details for the AP Interface have a single Customer Line and multiple G/L lines (with G/L amounts EXCLUSIVE of tax). For eg: If the amount at Customer Line is +6700, the sum of the amounts of G/L lines willl be   -6000. Currently, we are calculating the tax for each of the G/L lines based on the Tax Code and Tax Jurisdiction. For this, we are using the Function Module - CALCULATE_TAX_FROM_NET_AMOUNT and populating the BAPI tax lines as shown herein:
    Calculate tax from the base amount using FM
      CALL FUNCTION 'CALCULATE_TAX_FROM_NET_AMOUNT'
        EXPORTING
          i_bukrs           = lv_bukrs
          i_mwskz         = lv_mwskz
          i_txjcd            = gv_txjcd
          i_waers          = lv_waers
          i_wrbtr            = lv_wrbtr
        IMPORTING
          e_fwast         = lv_taxded
        TABLES
          t_mwdat        = lt_mwdat
        EXCEPTIONS
          bukrs_not_found   = 1
          country_not_found = 2
          mwskz_not_defined = 3
          mwskz_not_valid   = 4
          ktosl_not_found   = 5
          kalsm_not_found   = 6
          parameter_error   = 7
          knumh_not_found   = 8
          kschl_not_found   = 9
          unknown_error     = 10
          account_not_found = 11
          txjcd_not_valid   = 12
          OTHERS            = 13.
      IF sy-subrc EQ 0.
    LOOP AT lt_mwdat INTO ls_mwdat WHERE wmwst IS NOT INITIAL.
      Increment the Line Item Number
        gv_no_item = gv_no_item + 1.
      Populate the tax table
        ls_bapitax-itemno_acc       = gv_no_item.
        ls_bapitax-gl_account       = ls_mwdat-hkont.
        ls_bapitax-acct_key         = ls_mwdat-ktosl.
        ls_bapitax-tax_code         = lv_mwskz.
        ls_bapitax-taxjurcode       = ls_mwdat-txjcd.
        ls_bapitax-taxjurcode_deep  = ls_mwdat-txjcd_deep.
        ls_bapitax-taxjurcode_level = ls_mwdat-txjlv.
        ls_bapitax-tax_rate         = ls_mwdat-msatz.          
        ls_bapitax-itemno_tax       = gv_no_item - 1.          
        ls_bapitax-tax_date         = sy-datum.               
        ls_bapitax-cond_key        = ls_mwdat-kschl.         
        APPEND ls_bapitax TO ct_bapitax.
        CLEAR ls_bapitax.
        Populate the currency table
        ls_curr-itemno_acc = gv_no_item.
        ls_curr-amt_doccur = ls_mwdat-wmwst.  " Net amount after tax
        ls_curr-amt_base   = lv_wrbtr.        
        ls_curr-tax_amt = ls_mwdat-wmwst.
        ls_curr-currency   = ls_head-waers.   " Currency is at header
        APPEND ls_curr TO ct_currency.
        CLEAR ls_curr.
      ENDLOOP.
    ENDIF.
    However, this approach is not working as, the tax amount is now getting split into multiple lines. This split is happening against the different Profit Centres populated in the G/L lines. This happens ONLY in the 'General Ledger View' of the transaction FB03.
    It would be great if anyone could suggest what the problem is herein.
    Thanks in advance!!
    Anju.

    Hi Anju ,
    i dont see any probs in this ? , yes it will creates multiple lines based on the Profit centres that too  in GL view only , as per my knowledge its SAP standard ? so whats the issue ? , what ur functional ppls are saying ?
    Regards
    Prabhu

  • Issue while trying to post using BAPI_ACC_DOCUMENT_POST

    Hello All,
    I am trying to create a vendor credit memo using the BAPI BAPI_ACC_DOCUMENT_POST. Here in the header I am passing username,company code, doc date,posting date,doc type (as KG for credit memo) and reference document number.
    In the account payable internal table I am passing itemacc as 1, vendor number,payment currency and payment amount.
    In account GL internal table I am passing Item no (for 2 line items 2 and 3) the GL account
    In Currency Amount internal table I have 3 entries 1 for the accounts payable and 2 for teh GL entered as above. The line items numbers are 1 (for accounts payable item) and 2,3 for the GL account items.
    First amount value is 15680 and the other 2 in GL are   -14000 and -1680 (so the sum is matching with vendor amount). Upon execution I am receiving 2 errors in the return tables
    as Error in document BKPFF and
         Enter a payment currency different to USD.
    Could any one let me know what I am missing ? Why an error stating enter a payment currency different to USD ?
    Waiting for a response.
    Thanks and Regards,
    Sachin

    Hello,
    i was able to solve this issue on my by using the same BAPI (BAPI_ACC_DOCUMENT_POST). Just needed to enter the vendor info in the accounts payable internal table and the GL info in the GL table with the amount in the currency amount table. Needed to reverse the sum in GL against the amount in accounts payable entry.
    Regards
    Sachin

  • Issue with posting G/L using the BAPI " BAPI_ACC_DOCUMENT_POST"

    Hi all,
    I am trying to create a G/L document using the BAPI "BAPI_ACC_DOCUMENT_POST". The Bapi is returning me a success message, but i am not able to see the document in BKPF/BSEG.
    Can somebody please let me know if there is any customization that needs to be done to get the document number reflected in the corresponding tables after i execute this BAPI.
    Here is the part of the code that i am using to fill the header structure:
      docheader-obj_type = 'REACI'.
        docheader-obj_key = 'TEST'.
        docheader-obj_sys = 'ECSCLNT010'.
        docheader-bus_act = 'RFBU'.
        docheader-username = sy-uname.
        docheader-header_txt = 'HDR TEXT'.
        docheader-comp_code = 'SC01'.
        docheader-doc_date = sy-datum.
        docheader-pstng_date = sy-datum.
        CASE wa_input_tmp-batch_type .
          WHEN '0'.
            docheader-doc_type = 'SA'.
          WHEN '1'.
            docheader-doc_type = 'RA'.
        ENDCASE.
    Any help is much appreciated.
    Thanks in Advance,
    Suresh

    See the below code :
    I have tested program in my system :
    *&---HEADER DECLARATION
    DATA: HEADER TYPE BAPIACHE09.                " HEADER DATA
                 INTERNAL TABLE DECLARATION
    *&----G/L ACCOUNT ITEM
    DATA: ACCOUNTGL TYPE STANDARD TABLE OF BAPIACGL09.
    *&---CURRENCY ITEMS
    DATA: CURRENCY_AMOUNT TYPE STANDARD TABLE OF BAPIACCR09.
    *&----RETURN PARAMETER
    DATA: RETURN  TYPE STANDARD TABLE OF BAPIRET2 with header line.
                         WORK-AREA DECLARATION
    *&----WORKAREA FOR G/L ACCOUNT ITEM
    DATA: WA_ACCOUNTGL TYPE BAPIACGL09.
    *&---WORKAREA FOR CURRENCY ITEMS
    DATA: WA_CURRENCY_AMOUNT TYPE BAPIACCR09.
                        INITIALIZATION
    HEADER-HEADER_TXT  = 'TEST HEADER'.
    HEADER-USERNAME    = 'DEVELOPER'.
    HEADER-COMP_CODE   = '0002'.
    HEADER-FISC_YEAR   = '2007'.
    HEADER-DOC_DATE    = '20070502'.
    HEADER-PSTNG_DATE  = '20070502'.
    HEADER-TRANS_DATE  = '20070502'.
    HEADER-DOC_TYPE    = 'SA'.
    HEADER-BUS_ACT     = 'RFBU'.
    WA_ACCOUNTGL-ITEMNO_ACC  = '0000000010'.
    WA_ACCOUNTGL-GL_ACCOUNT = '0000113020'.
    WA_ACCOUNTGL-ITEM_TEXT  = 'SO_DOC'.
    WA_ACCOUNTGL-DE_CRE_IND = 'S'.
    APPEND WA_ACCOUNTGL TO ACCOUNTGL.
    CLEAR WA_ACCOUNTGL.
    WA_ACCOUNTGL-ITEMNO_ACC  = '0000000020'.
    WA_ACCOUNTGL-GL_ACCOUNT = '0000113020'.
    WA_ACCOUNTGL-ITEM_TEXT  = 'SO_DOC'.
    WA_ACCOUNTGL-DE_CRE_IND = 'H'.
    APPEND WA_ACCOUNTGL TO ACCOUNTGL.
    CLEAR WA_ACCOUNTGL.
    WA_CURRENCY_AMOUNT-ITEMNO_ACC = '0000000010'.
    WA_CURRENCY_AMOUNT-AMT_DOCCUR = '500'.
    WA_CURRENCY_AMOUNT-CURRENCY   = 'INR'.
    APPEND WA_CURRENCY_AMOUNT TO CURRENCY_AMOUNT.
    CLEAR WA_CURRENCY_AMOUNT.
    WA_CURRENCY_AMOUNT-ITEMNO_ACC = '0000000020'.
    WA_CURRENCY_AMOUNT-AMT_DOCCUR = '-500'.
    WA_CURRENCY_AMOUNT-CURRENCY   = 'INR'.
    APPEND WA_CURRENCY_AMOUNT TO CURRENCY_AMOUNT.
    CLEAR WA_CURRENCY_AMOUNT.
                    START-OF-SELECTION
    START-OF-SELECTION.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        documentheader          = HEADER
      CUSTOMERCPD             =
      CONTRACTHEADER          =
    IMPORTING
      OBJ_TYPE                =
      OBJ_KEY                 =
      OBJ_SYS                 =
      tables
       ACCOUNTGL               =   ACCOUNTGL
      ACCOUNTRECEIVABLE       =
      ACCOUNTPAYABLE          =
      ACCOUNTTAX              =
        currencyamount          = CURRENCY_AMOUNT
      CRITERIA                =
      VALUEFIELD              =
      EXTENSION1              =
        return                  = RETURN
      PAYMENTCARD             =
      CONTRACTITEM            =
      EXTENSION2              =
      REALESTATE              =
    IF return-type NA 'EA'.
    call function 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       WAIT          = 'X'.
    IMPORTING
      RETURN        = RETURN.
      write:/ return-message.
    else.
      write:/ return-message.
    ENDIF.
    Reward Points if it is helpful
    Thanks
    Seshu

  • Issue with using BAPI_ACC_DOCUMENT_POST to write to table FAGLFLEXA.

    Hi,
    I'm using BAPI_ACC_DOCUMENT_POST to do intercompany posting. The posting is successful and I got the document created. The only problem is data is not written into table FAGLFLEXA. I searched in the forum and it said to make us of BTE RWBAPI01 to pass in the ledger to the document header. I have tried that, but that only writting the ledger to the document header in BKPF, still the data is not writting to the FAGLFLEXA table.

    Hi,
    I'm having the same problem. Could you solve this?
    Thank you in advance.
    Andrea

  • BAPI_ACC_DOCUMENT_POST tax line items issue

    Hi All,
    i am posting a document using BAPI_ACC_DOCUMENT_POST...
    Please find the below code:
    Populate BAPI item structures
    FORM fill_bapi_item .
    *Local data declarations
      DATA : lv_taxded TYPE bset-fwste,
             lv_taxtot TYPE bset-fwste,
             lv_amt    TYPE wrbtr,
             lv_ref2   TYPE xref2,
             ls_mwdat  TYPE rtax1u15,
             lt_mwdat  TYPE TABLE OF rtax1u15.
    Tax juris code for vendor
      IF gs_item1-koart = gc_v.  " vendor
        gv_tjxcd = gs_item1-txjcd.
      ENDIF.
      gv_item = gv_item + 1.
    Concatenate the legacy number, store and division and pass it
    to field XREF2 of the BAPI
      CLEAR lv_ref2.
      CONCATENATE gs_item1-legacy gs_item1-divsn gs_item1-store
      INTO lv_ref2.
    Fill the GL account structure if the account type is G
    otherwise fill the Vendor structure.
      IF gs_item-koart = gc_g
      OR gs_item-koart = space.  " For offset clearing account
        gs_accountgl-itemno_acc  = gv_item.
        gs_accountgl-gl_account  = gs_item1-newko.
        gs_accountgl-de_cre_ind  = gs_item1-shkzg.
        gs_accountgl-item_text   = gs_item1-sgtxt.
        gs_accountgl-comp_code   = gs_item1-newbk  .
        gs_accountgl-tax_code    = gs_item1-mwskz.
        gs_accountgl-taxjurcode  = gv_tjxcd.
        gs_accountgl-alloc_nmbr  = gs_item1-zuonr.
        gs_accountgl-ref_key_1   = gs_item1-xref1.
        gs_accountgl-ref_key_2   = lv_ref2. " legacy accountstoredivision
        gs_accountgl-profit_ctr  = gs_item1-prctr.
        gs_accountgl-costcenter  = gs_item1-kostl.
        APPEND gs_accountgl TO gt_accountgl.
        CLEAR gs_accountgl.
        CLEAR : lv_taxded, lv_taxtot , lv_amt , ls_mwdat.
        REFRESH : lt_mwdat.
    Fetch the tax amount based on the gross amount, tax code and juris code
        CALL FUNCTION 'CALCULATE_TAX_FROM_GROSSAMOUNT'
          EXPORTING
            i_bukrs                 = gs_header1-bukrs
            i_mwskz                 = gs_item1-mwskz
            i_txjcd                 = gv_tjxcd
            i_waers                 = gs_header1-waers
            i_wrbtr                 = gs_item1-wrbtr
          IMPORTING
            e_fwste                 = lv_taxtot
            e_fwast                 = lv_taxded
          TABLES
            t_mwdat                 = lt_mwdat
          EXCEPTIONS
            bukrs_not_found         = 1
            country_not_found       = 2
            mwskz_not_defined       = 3
            mwskz_not_valid         = 4
            account_not_found       = 5
            different_discount_base = 6
            different_tax_base      = 7
            txjcd_not_valid         = 8
            not_found               = 9
            ktosl_not_found         = 10
            kalsm_not_found         = 11
            parameter_error         = 12
            knumh_not_found         = 13
            kschl_not_found         = 14
            unknown_error           = 15
            OTHERS                  = 16.
        IF sy-subrc NE 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ELSE.
    Calculate the amounts.
          lv_amt = gs_item-wrbtr - lv_taxded.  " Tax deductable.
    Get the GL Account, Condition,etc. for TAX amount
          READ TABLE lt_mwdat INTO ls_mwdat INDEX 1.
          IF sy-subrc EQ 0.
        Do Nothing
          ENDIF.
    Fill the currency structures for GL Account
          gs_curr-itemno_acc = gv_item.
          gs_curr-amt_doccur = lv_amt.           " Net amount after tax
          gs_curr-currency   = gs_header1-waers. " Currency is at header
          APPEND gs_curr TO gt_curr.
          CLEAR : gs_curr.
    Fill the tax structure for GL Account.
          gv_item = gv_item + 1.
          gs_tax-itemno_acc = gv_item.
          gs_tax-gl_account = ls_mwdat-hkont.
          gs_tax-cond_key   = ls_mwdat-kschl.
          gs_tax-acct_key   = ls_mwdat-ktosl.
          gs_tax-tax_code   = gs_item1-mwskz.
          gs_tax-taxjurcode = ls_mwdat-txjcd.
          gs_tax-taxjurcode_deep   = ls_mwdat-txjcd_deep.
          gs_tax-taxjurcode_level  = ls_mwdat-txjlv.
          APPEND gs_tax TO gt_tax.
          CLEAR gt_tax.
    Fill the TAX amount in the currency structure.
          gs_curr-itemno_acc = gv_item.
          gs_curr-amt_base   = lv_taxded.        " Tax
          gs_curr-currency   = gs_header1-waers. " Currency is at header
          APPEND gs_curr TO gt_curr.
          CLEAR : gs_curr.
        ENDIF.
    Vendor
      ELSEIF gs_item-koart = gc_v.
        gs_vendor-itemno_acc  = gv_item.
        gs_vendor-gl_account  = gs_item1-newko.
        gs_vendor-item_text   = gs_item1-sgtxt.
        gs_vendor-comp_code   = gs_item1-newbk.
        gs_vendor-tax_code    = gs_item1-mwskz.
        gs_vendor-taxjurcode  = gv_tjxcd.
        gs_vendor-alloc_nmbr  = gs_item1-zuonr.
        gs_vendor-ref_key_1   = gs_item1-xref1.
        gs_vendor-ref_key_2   = lv_ref2.  " legacy accountstoredivision
        gs_vendor-profit_ctr  = gs_item1-prctr.
        APPEND gs_vendor TO gt_vendor.
        CLEAR gs_vendor.
    Fill the currency structures for vendor(No Tax calculation here)
        gs_curr-itemno_acc = gv_item.
        gs_curr-amt_doccur = gs_item1-wrbtr.
        gs_curr-currency   = gs_header1-waers. " Currency is at header
        APPEND gs_curr TO gt_curr.
        CLEAR : gs_curr.
      ENDIF.
    ENDFORM.                    " FILL_BAPI_ITEM
    But if i post using FB01 and give the tax amount and gross amount, there are 6 items for tax getting created....(sum of 6 items = tax amoutn passed)...
    But when i create using BAPI, one taxx item is created but with total tax amount...
    How to achieve the same way as in FB01(6 items or so)..
    Thanks
    Shiva

    Can you try and use 'CALCULATE_TAX_FROM_NET_AMOUNT' instead of the one you are using and see if you are getting 6 entries?
    In this the tax lines come as an internal table. This is the same FM that SAP uses to derive the tax lines within the standard transaction. Please let me know if this was helpful.
    Thanks and Regards,
    Hari

  • Issue in posting a accounting document using BAPI BAPI_ACC_DOCUMENT_POST

    Hi All,
    I 'm able to post a document using BAPI ' BAPI_ACC_DOCUMENT_POST ' but the problem i face is the header text is not getting updated for the document that is getting posted. Even though i'm populating the header text in the parameters i'm passing to the BAPI.
    Any pointers to this would be highly appreciated.
    Regards,
    Chaitanya

    Hi,
    put a  break in subroutine FORM fill_acchd
    and execute the bapi.
    Here you have:
      CLEAR gs_acchd.
      MOVE-CORRESPONDING gs_aw TO gs_acchd.
      gs_acchd-usnam = gs_bapi_acchd-username.
      gs_acchd-awsys = gs_bapi_acchd-obj_sys.
      gs_acchd-bktxt = gs_bapi_acchd-header_txt."---->¡¡¡CHECK THIS!!!
      gs_acchd-glvor = gs_bapi_acchd-bus_act.
      gs_acchd-tcode = sy-tcode.
      gs_acchd-acc_principle = gs_bapi_acchd-acc_principle.
    Check if there is something wrong there.
    Best regards

  • Issue with BAPI_ACC_DOCUMENT_CHECK & BAPI_ACC_DOCUMENT_POST

    I wrote a program code to post a document for F-43 transaction using a BAPI.
    Unfortunately, the BAPI comes back with an error message
    1 E RW 609     Error in document: BKPF 1900022387208 2010 SYS01                  1900022387208 2010
    2 E RW 628     Incorrect entry in field OBJ_TYPE: BKPF                                          DOCUMENTHEADER 1 OBJ_TYPE
    Any help would be appreciated.
    REPORT z_test_f44 NO STANDARD PAGE HEADING LINE-COUNT 65 LINE-SIZE 132
    MESSAGE-ID zfi.
    TABLES: bsik, t003.
    TYPES:
      BEGIN OF tp_tab_bsik,
        bukrs TYPE bukrs,
        lifnr TYPE lifnr,
        gjahr TYPE gjahr,
        budat TYPE budat,
        bldat TYPE bldat,
        blart TYPE blart,
        bschl TYPE bschl,
      END OF tp_tab_bsik.
    SELECTION-SCREEN:BEGIN OF BLOCK blck01 WITH FRAME TITLE text-001.
    PARAMETERS:
        p_per(2)            TYPE c                    DEFAULT sy-datum+4(2),
        p_dt                LIKE sy-datum             DEFAULT sy-datum,
        p_hkont             TYPE hkont                DEFAULT '105010',
        p_waers             LIKE bkpf-waers           DEFAULT 'USD',
        p_blart             LIKE bkpf-blart           DEFAULT 'KR',
        p_xblnr            LIKE bkpf-xblnr            DEFAULT 'V01',
        p_xblnr1           LIKE bkpf-xblnr            DEFAULT 'A01',
        p_amt              LIKE bseg-wrbtr            DEFAULT '10.00',
        p_bukrs            LIKE bkpf-bukrs            DEFAULT '208',
        p_lifnr            LIKE lfa1-lifnr            DEFAULT '1000165'.
    SELECTION-SCREEN:END OF BLOCK blck01.
    *----------------end of selection parameters-----------------------*
    *------------------START OF SELECTION----------------------------------*
    START-OF-SELECTION.
      PERFORM process_data.          "Posting using F-44(Bapi)
    *&      Form  process_data
    *       text
    FORM process_data.
      DATA:
      l_documentheader   LIKE bapiache09,
      l_accountgl        LIKE bapiacgl09 OCCURS 2 WITH HEADER LINE,
      l_vendoritem       LIKE bapiacap09 OCCURS 2 WITH HEADER LINE,
      l_currencyamount   LIKE bapiaccr09 OCCURS 2 WITH HEADER LINE,
      l_currencytype     LIKE bapiaccr09-currency_iso,
      l_return           LIKE bapiret2 OCCURS 5 WITH HEADER LINE,
      l_obj_type         LIKE bapiache02-obj_type,
      l_obj_key          LIKE bapiache02-obj_key,
      l_obj_sys          LIKE bapiache02-obj_sys,
      l_obj_sys_1        LIKE tbdls-logsys,
      ls_t003            TYPE t003,
      l_belnr            TYPE bkpf-belnr,
      l_awtyp            LIKE acchd-awtyp,   " Anwendungsreferenz
      l_awref            LIKE acchd-awref,   "
      l_aworg            LIKE acchd-aworg,   "
      l_awsys            LIKE acchd-awsys,   "
      l_awkey            LIKE bkpf-awkey.    "
      BREAK-POINT.
      CLEAR:
             l_documentheader, l_vendoritem, l_accountgl,
             l_currencyamount, l_return.
      REFRESH:l_vendoritem, l_currencyamount, l_return.
    * Get Your Logical System
      CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
        IMPORTING
          own_logical_system             = l_obj_sys_1
        EXCEPTIONS
          own_logical_system_not_defined = 1
          OTHERS                         = 2.
    * Number Range Information
      SELECT SINGLE *
        FROM t003
        INTO CORRESPONDING FIELDS OF t003
       WHERE blart = p_blart.
    * Get the additional Number Range Details.
      CALL FUNCTION 'FAGL_GET_NUMBER_RANGE_FOR_PN'
        EXPORTING
          i_rldnr       = '0L'     "Ledger
          i_blart       = p_blart
        IMPORTING
          es_t003       = ls_t003
        EXCEPTIONS
          error_message = 1.
    * Get the next BELNR
      t003-numkr = ls_t003-numkr.
      CALL FUNCTION 'RF_GET_DOCUMENT_NUMBER'
        EXPORTING
          company         = p_bukrs
          range           = t003-numkr
          year            = sy-datum+0(4)
        IMPORTING
          document_number = l_belnr.
    * Create Reference Keys
      CALL FUNCTION 'FI_REFERENCE_CREATE'
        EXPORTING
          i_awtyp           = 'BKPF '
          i_bukrs           = p_bukrs
          i_gjahr           = sy-datum+0(4)
          i_belnr           = l_belnr
        IMPORTING
          e_awtyp           = l_awtyp
          e_awref           = l_awref
          e_aworg           = l_aworg
          e_awkey           = l_awkey
          e_awsys           = l_awsys
        EXCEPTIONS
          object_type       = 1
          missing_parameter = 2
          OTHERS            = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    * Build Document Header
      l_documentheader-obj_type   = l_awtyp. "'BKPF'.
      l_documentheader-obj_key    = l_awkey.
      l_documentheader-obj_sys    = l_obj_sys_1.
      l_documentheader-bus_act    = 'RFBU'.
      l_documentheader-ac_doc_no  = l_belnr.
      l_documentheader-username   = sy-uname.
      l_documentheader-comp_code  = p_bukrs.
      l_documentheader-fis_period = p_per.
      l_documentheader-doc_date   = p_dt.
      l_documentheader-pstng_date = sy-datum.
      l_documentheader-fisc_year  = sy-datum+0(4).
      l_documentheader-doc_type   = p_blart.
      l_documentheader-ref_doc_no = p_xblnr.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = p_hkont
        IMPORTING
          output = p_hkont.
    * G/L Item
      l_accountgl-itemno_acc     = '000000001'.
    *  l_accountgl-acct_key       = 'RFBU'.
      l_accountgl-gl_account     = p_hkont.
      l_accountgl-comp_code      = p_bukrs.
      l_accountgl-pstng_date     = sy-datum.
      l_accountgl-doc_type       = p_blart.
      APPEND l_accountgl. CLEAR l_accountgl.
    * G/L Item $$$s
    * Posting Key 50
      l_currencyamount-itemno_acc   = '000000001'.
      l_currencyamount-currency_iso = p_waers.
      l_currencyamount-currency     = p_waers.
      l_currencyamount-amt_doccur   = p_amt.
      APPEND l_currencyamount. CLEAR l_currencyamount.
    * Vendor Item
      l_vendoritem-itemno_acc     = '000000002'.
    *  l_accountgl-acct_key       = 'RFBU'.
      l_vendoritem-vendor_no     = p_lifnr.
      l_vendoritem-comp_code     = p_bukrs.
      APPEND l_vendoritem. CLEAR l_vendoritem.
    * Vendor Item $$$s
    * Posting Key 31
      l_currencyamount-itemno_acc   = '000000002'.
      l_currencyamount-currency_iso = p_waers.
      l_currencyamount-currency     = p_waers.
      l_currencyamount-amt_doccur   = p_amt.
      l_currencyamount-amt_doccur = l_currencyamount-amt_doccur * -1.
      APPEND l_currencyamount. CLEAR l_currencyamount.
      BREAK-POINT.
      CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
        EXPORTING
          documentheader = l_documentheader
        TABLES
          accountgl      = l_accountgl
          accountpayable = l_vendoritem
          currencyamount = l_currencyamount
          return         = l_return.
    *  CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
    *    EXPORTING
    *      documentheader = l_documentheader
    *    IMPORTING
    *      obj_key        = l_obj_key
    *    TABLES
    *      accountgl      = l_accountgl
    *      accountpayable = l_vendoritem
    *      currencyamount = l_currencyamount
    *      return         = l_return.
      BREAK-POINT.
    *  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    ENDFORM.                    "process_data

    Actually I am using Standard SAP Function modules to generate the OBJ_TYP.
    Unfortunately the "Code" tag is not working for me in this browser to align the program code correctly.
    But yes, to answer your question obj_typ is correctly done.
    * Create Reference Keys
      call function 'FI_REFERENCE_CREATE'
        exporting
          i_awtyp           = 'BKPF '
          i_bukrs           = p_bukrs
          i_gjahr           = sy-datum+0(4)
          i_belnr           = l_belnr
        importing
          e_awtyp           = l_awtyp
          e_awref           = l_awref
          e_aworg           = l_aworg
          e_awkey           = l_awkey
          e_awsys           = l_awsys
        exceptions
          object_type       = 1
          missing_parameter = 2
          others            = 3.

  • BAPI_ACC_DOCUMENT_POST Issue with assigning Cost Objects

    Hi Forums,
    I am passing only the order number to this BAPI I am getting the following error.
    Account 654080 requires an assignment to a CO object
    I am passing the order number to this and should populate enough information to fill in the data?
    any ideas?

    Issue was in the code: I was not assigning the order id correctly

  • Issue with creating a G/L account using the BAPI "BAPI_ACC_DOCUMENT_POST"

    Hi All,
    I am trying to create a G/L account (FB50) using the BAPI "BAPI_ACC_DOCUMENT_POST". Can somebody help in populating values to the following parameters :
    1) OBJ_TYPE
    2) OBJ_KEY
    3) BUS_ACT
    I tried passing BKPF & BKPFF to the Object type but i am getting error saying that "Incorrect Entry".
    Please let me where to find the values for the fields.
    Any Help is much appreciated.
    Thanks in Advance.

    Hi Ram,
    Thanks for your input. The BAPI is working fine now, but one small change, i am passing REACI for the object type instead of BKPFF.
    Here's the values that i am passing to the BAPI.
    OBJ_TYPE                       REACI
    OBJ_KEY                        TEST
    OBJ_SYS                        ECSCLNT010
    BUS_ACT                        RFBU
    USERNAME                       KKUMAR
    HEADER_TXT                     TEST_BAPI
    Thanks Once agian.

  • Problem while Posting a Document Using BAPI_ACC_DOCUMENT_POST

    Hi All,
    When i try to post my General Ledger Document using BAPI_ACC_DOCUMENT_POST, i face a situation due to the exchange rate. The field EXCH_RATE in CURRENCYAMOUNT table accepts only 5 decimals. But according to my scenario it should accept more than 5 decimals. Is there any BAPI or other way to solve this issue.
    Thanks & Regards,
    Venkatesh. R

    We restricted our entry to five decimals and solved the issue.

  • Issue in Inter Company postings

    Hi All,
               Currently I face an issue with inter-company posting transaction. Let me explain the issue.
    Using ‘FB01’ we can create inter-company postings by giving G/l and New Company code fields in the first screen. Let us say there are two company codes 0020,0040.
    Giving these company codes and their corresponding G/ls in ‘FB01’ system creates 2 documents, one in each company code i.e, one document in 0020 and another document 0040. There will also be a link in the field ‘Cross-CC no’ which says this is an inter-company transaction.
    Following are my questions.
    1.Can I create the ‘INTER-COMPANY’ Postings using ‘BAPI_ACC_DOCUMENT_POST’ ?  We can create accounting documents in both company codes 0020,0040 using this BAPI. But these two are becoming independent entries in each company code without any link ( Like the above case ‘Cross_CC no’) between them.
    2.My another requirement is that I have to give an error message to user inside a user-exit while validating data. If I give message type ‘E’ inside the user-exit it is giving the message but the normal flow is halted. It is going out with a blank screen with error message and the transaction is not going further. Is it possible to give error messages inside a user-exit without obstructing the normal flow of any transaction? The transaction can also be executed in Background.
    Thanks for your help.
    Vinod.

    For question one I'm interested in doing the same thing.
    Did you get an answer on how to do INTER-COMPANY postings using this BAPI?
    BR and many thanks in advance.
    Mattias

  • BAPI_ACC_DOCUMENT_POST with TAX posting for FB60 t-code

    Hi Experts,
    I am trying upload the data using BAPI_ACC_DOCUMENT_POST with Tax(ACCOUNTTAX) for the FB60 t-code. But not getting right.
    Any help on this issue greatly appreciated.
    Thanks & Regards,
    Harish

    Hi,
    Check out this-
    FU BAPI_ACC_DOCUMENT_POST
    Short Text
    Accounting: Posting
    Functionality
    Using this method you can create a posing in accounting for certain business transactions.
    Possible ( Business Transactions):
    Postings that generally only affect the general ledger. (RFBU)
    Billing: For billing in Sales and Distribution, accounting is supplied with the relevant billing data. (SD00) Billing Document
    Accounting can use the data of a logistics system that result from an Invoice Receipt. (RMRP)
    Goods Movement are triggered by transactions in Sales and Distribution or by inventory postings. Within logistics, they lead to a change in the warehouse stocks of <DS:GLOS.Inventory Management>Inventory Management. This results in a posting in accounting. This is why accounting is supplied with the relevant data from logistics. (RMWA)
    Example
    Billing document:
    By selling goods in accordance with targets, revenue is generated. The revenue is posted in billing and forwarded to accounting.
    Invoice receipt:
    Raw materials are purchased in accordance with targets. The invoice receipt is posted in a logistics system. The data from the raw materials is forwarded to accounting.
    Goods Movment:
    The use of raw materials leads to a change in stock in inventory managment. The posting of raw material consumption is forwarded to accounting.
    G/L Account Posting:
    Provision posting for an expected warranty service. This can refer to acquisitions or retirements belonging to stocks that are not in subledger accounting relevant to inventory management. This is particularly the case if such materials are not displayed as vendor/customer, materials, loans etc. or cannot be displayed in this way. This can also refer to write-ups or depreciation that contain higher aggregations of values than are maintained in a corresponding subledger that is relevant to inventory management.
    The conversion of foreign currencies for receivables/payables due to large exchange rate changes that should not lead to an update of the accounts payable or accounts receivable accounting. A similar transaction can arise for the revaluation of raw materials if this revaluation takes place at a correspondingly aggreagated level.
    Reclassification of inventory of P&L statement accounts that are only used for reconcilliation purposes in the general ledger (this rearranges values for balance sheet items).
    Balance reclassifications of stocks to receivables with different return times.
    Notes
    If the parameter CurrencyAmount is filled with the currency fields, a complete document check including characteristics and value components of profitability analysis (CO-PA). Otherwise, the account assignment objects are checked.
    Messages are returned in the parameter Return. In the parameter documentation you can find the return values and their meaning.
    Further information
    You can find further information in the SAP Library under "Financials -> Accounting - General (AC) -> Interfaces to Accounting (AC)".
    Parameters
    DOCUMENTHEADER
    CUSTOMERCPD
    CONTRACTHEADER
    OBJ_TYPE
    OBJ_KEY
    OBJ_SYS
    ACCOUNTGL
    ACCOUNTRECEIVABLE
    ACCOUNTPAYABLE
    ACCOUNTTAX
    CURRENCYAMOUNT
    CRITERIA
    VALUEFIELD
    EXTENSION1
    RETURN
    PAYMENTCARD
    CONTRACTITEM
    EXTENSION2
    REALESTATE
    ACCOUNTWT
    Reward if useful!

  • BAPI_ACC_DOCUMENT_POST not calculating TAX

    Hi,
    I am using BAPI_ACC_DOCUMENT_POST for posting the FI document for RC type. I tried posting it normally and it posted correctly. But when i give some ACCOUNT TAX information, it is not calculating.
    Here is how I am filling the details.
    Header:
    BUS_ACT = RFBU.
    USERNAME = SY_UNAME.
    HEADER_TEXT = TEXT.
    COMP_CODE = BUKRS.
    DOC_DATE = 12/12/2011
    PSTNG_DATE = 12/05/2011.
    FIS_PERIOD = 00
    REF_DOC_NO = 9700000036.
    AC_DOC_NO = 9700000036.
    Account GL Table:.
    ITEMNO_ACC = 10.
    GL_ACCOUNT = 412010.
    DOC_TYPE = RC.
    COMP_CODE = RECN.
    FIS_PERIOD = 00.
    PSTNG_DATE = 12/05/2011
    TAX_CODE = TN
    TAXJURCODE = TN3707600
    COST CENTER = 107
    Account Receivable:
    ITEMNO_ACC = 20.
    CUSTOMER = 1126045
    COMP_CODE = RECN
    BLINE_DATE = 12/12/2011.
    PYMT_METH = B
    CURRENCY AMOUNT : 2 LINE ITEMS
    1ST LINE ITEM
    ITEMNO_ACC = 10
    CURRENCY = USD
    AMT_DOCCUR = 500.00-
    DISC_BASE = 500.00-.
    2ND LINE ITEM
    ITEMNO_ACC = 20
    CURRENCY = USD
    AMT_DOCCUR = 500.00
    AMT_BASE = 500.00.
    I did not enter the account tax table as I am not sure how to enter the date. But I know that the tax rate is 9.25% and for 500 the tax would be 42.33. I need to make sure that the BAPI posts the document as it posts from FB01 when we check the check box 'calculate tax'. Right now, with these details it is posting the data but not calculating the tax.
    Please help.
    Regards
    Guru
    Edited by: GuruCharan on Dec 15, 2011 6:28 PM

    Raymond,
    Thanks for the reply. I did read the notes you have suggested. They are quite informative but unfortunately -
    Note 367175 is related to the other BAPI`s. My issue is with the BAPI_ACC_DOCUMENT_POST.
    Note 487064 is related to the error when the tax amount is greater than the base amount.
    Since I am using the Acc document post BAPI, please help me understand how to fill in the data for ACCOUNT TAX table or post the document from the BAPI along with the tax as it does in FB01.
    Thanks Again,
    Regards,
    Guru.

  • Bapi_Acc_Document_Post - E 018 : Invalid tax code and company code combination

    Hi All,
    I need the help of this forum once again.
    I am using bapi Bapi_Acc_Document_Post to create KR documents in SAP. The bapi works absolutely fine except for one scenario:
    For a particular type of invoice coded to Company "XXXX" with lines having tax code "I0", the bapi returns error message "E 018 : Invalid tax code and company code combination". The tax code "I0" and the company code "XXXX" has been mapped in SAP and if I try to create the invoice manually in SAP using the GUI, the invoice gets created without any issue.
    I have tried searching the forum but could not find any post on this topic.
    Therefore, requesting the masters to please help me out on this.
    Best Regards
    Sutirtha Roy

    Hi Gowthami,
    how have you solved your problem, because I am facing the similiar issue and trying desperately to post the following combination with BAPI_ACC_POST_DOCUMENT:
    001 40       490100     Aufw. aus Marge PP              R2                 15,92
    002 31       10000003   Kreditor                                R2                 15,92-
    003 50       175060     Abzugsverfahren USt            R2                  3,18-
    004 40       154060     Abzugsverfahren Vst             R2                  3,18
    THANX!
    Regards
    Marko

Maybe you are looking for

  • Want to run a Mac Mini into a 50" Samsung Plasma screen TV...will it work?

    The TV is a Samsung PN50B850 Plasma screen with a VGA input: http://reviews.cnet.com/flat-panel-tvs/samsung-pn50b850/4505-6482_7-33490381.htm l Hee are the tech specs: http://ecoustics-cnet.com.com/flat-panel-tvs/samsung-pn50b850/4507-6482_7-334903 8

  • Latest update already installed but can't open file

    I have recently downloaded the latest update for Pages (version 5.2), and my Appstore updates pages confirm this by showing "installed" but when I go to open a Pages documents, I get a message saying I need a newer version of Pages to open the file. 

  • Validation of Input message

    Hello All, Here my requirement is to validate(check for mandatory fields and length limitation) the incoming message before message mapping. In PI 7.1, we can do validation of the incoming message at Sender Agreement and Receiver Agreement level by s

  • How to view variable and constant value

    Hi there, I try to view a variable in sql plus command line and oracle xe object browser. The following is a small code to assign a value to a variable from an existing column name id that has value 4567 from table airplane. I'm a newbie, so pardon m

  • HT5642 An error won't allow me to update the software

    An error won't allow me to update iOs 6.1