BAPI_ACC_DOCUMENT_POST in BW system

Hi,
   I Need to write a report in BW system and use BAPI_ACC_DOCUMENT_POST to post accounting docuement in R/3. How can I call this BAPI in BW? Will the BAPI Structures be available in BW system ?
If anyone has a sample program for this it will be very much helpful.

Hi Vaibhav,
Just check out this BAPI is available in BW system from SE37 transaction.
if it is there i will tell you how to use it.
Regards,
Satish

Similar Messages

  • Lock Error while posting document through bapi_acc_document_post

    Hi,
       We are trying to Post documents in R/3 using Bapi_acc_document_post from BW system using ABAP report. The report groups data using certain criteria and makes a Bapi call for each group.
    Problem : The program has 2 modes test mode and actual run.
    When the program was run in a test mode 15 groups were created. Hence 15 documents should get created in R/3.
    Now when the actual run was done the program gave an output saying doc1 created,doc2 created....doc11 created.. and suddenly Bapi error .. doc1 is locked by another user, doc1 is locked by another user, doc1 is locked by another user, doc1 is locked by another user.
    Moreover Doc1 never got created in R/3. Doc 2 to Doc11 were created in R/3 and then the BApi error.
    Can anyone please help me understand why this could have happened?
    P.S : We use same Bapi for Check run as well as Actual run. Only difference is that in actual run a BApi_commit is done.
    Do you think using BAP_ACC_DOCUMENT_CHECK during check run will help ?
    PLease advice.

    Setting the WAIT parameter = 'X' will make your updates synchronous which might solve your problem.
    Please try and let me know.

  • Calc of VAT in ext system: how to get complete data in BSET/RFUMSV00

    Hello
    We have a system that posts into SAP FI GL via BAPI BAPI_ACC_DOCUMENT_POST . The external system does not contain tax codes but it does calculate tax amounts and has GL account determination. How do I get the complete data in BSET so that I can use RFUMSV00 as the sole report on VAT for the client? Other formulation: how do I post an invoice from a vendor without using a tax code or should I use a dummy tax code VST without percentage number?
    regards
    Arjan

    Hi Deepa,
    I tend to develop a substitution (OBB)that adds a tax code to the interface posting so that in SAP I have for every VAT amount/document a tax code. Otherwise I cannot use RFUMSV00...

  • Down payment & BAPI_ACC_DOCUMENT_POST

    May be someone knows the decision of the problem:
    At dialogue creation down payment (F-48), the system creates communications between the purchasing order and the accounting document.
    I.e. in history of a position of the purchasing order there is a record with number accounting the document.
    And in the accounting document down payment there is a reference to number of the purchasing order in a browser of relations (look FB03 it is cluck in the menu: Environment-> Document Environment-> relationship Browser).
    I use ' BAPI_ACC_DOCUMENT_POST ' for creation down payment:
    As a result I receive the normal document of down payment, but links on the purchasing order it was not created, i.e. there is no record with number of the accounting document in history of a position of the purchasing order, and there is no reference to the purchasing order in a browser of relations of the accounting document.
    Is it possible to create the high-grade document down payment with all references what is at dialogue work of transaction F-48? What I for this purpose should make?
    Edited by: Soloviev Ivan on Apr 1, 2008 1:46 AM

    Hi,
    Just wait for a moment(10 to 15  mins) since you have given WAIT in BAPI_TRANSACTION_COMMIT.
    Check again, and hope it updates the values.
    or else, Just give BAPI_TRANSACTION_COMMIT after the BAPI with no parameters.
    Regards,
    Anbalagan

  • Error getting while using BAPI "BAPI_ACC_DOCUMENT_POST" in the Web Dynpro

    Hello Everyone,
    I am trying to use BAPI_ACC_DOCUMENT_POST to post a docuemnt, for this I have created a web application and in that I have created one view. In the layout of the view I have developed three groups 1. document header 2.Currency 3. GL account. for user inputs and at the root node i have created a button and on the action f the button I am calling the BAPI but when i tested it I am getting the following error:
    The following error text was processed in the system RS2 : Adapter error in INPUT_FIELD "GROUP_2_ITEMNO_ACC" of view "ZTEST_RAGI_INVOICE_POST.MAIN": Context binding of property VALUE cannot be resolved: Node MAIN.1.CURRENCYAMOUNT does not contain any elements .
    Can you please help me in this.
    Thanks,
    Rajat

    helll rajat ,
    The following error text was processed in the system RS2 : Adapter error in INPUT_FIELD "GROUP_2_ITEMNO_ACC" of view "ZTEST_RAGI_INVOICE_POST.MAIN": Context binding of property VALUE cannot be resolved: Node MAIN.1.CURRENCYAMOUNT does not contain any elements .
    ---> pass amount to that currency table.
    regards
    Prabhu

  • 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

  • Making Down Payment Request using BAPI_ACC_DOCUMENT_POST

    Hi, all...
    I faced a problem while I'm testing BAPI_ACC_DOCUMENT_POST to make down payment request(F-47), so I need some help.
    I've found a BAPI_ACC_DOCUMENT_POST in down payment about this topic and followed its parameter settings except for currency settings.
    In that posting, the accountpayable-pymt_cur and currencyamount-currency are set different currency.
    While I set the two fields with same currency(USD). Belows are my source codes.
      DOCUMENTHEADER-OBJ_TYPE   = 'IDOC'.
      DOCUMENTHEADER-OBJ_KEY    = '$'.
      DOCUMENTHEADER-OBJ_SYS    = 'D10CLNT200'.
      DOCUMENTHEADER-BUS_ACT    = 'RFBU'.
      DOCUMENTHEADER-USERNAME   = SY-UNAME.
      DOCUMENTHEADER-HEADER_TXT = 'DOWN PAYMENT REQUEST'.
      DOCUMENTHEADER-COMP_CODE  = '1000'.
      DOCUMENTHEADER-DOC_DATE   = '2006.09.01'.
      DOCUMENTHEADER-PSTNG_DATE = '2006.09.01'.
      DOCUMENTHEADER-DOC_TYPE   = 'KG'.
      ACCOUNTPAYABLE-ITEMNO_ACC    = '0000000001'.
      ACCOUNTPAYABLE-VENDOR_NO     = '0002314908'.
      ACCOUNTPAYABLE-GL_ACCOUNT    = '0091120100'.
      ACCOUNTPAYABLE-COMP_CODE     = '1000'.
      ACCOUNTPAYABLE-PYMT_METH     = 'L'.
      ACCOUNTPAYABLE-PMNT_BLOCK    = 'A'.
      ACCOUNTPAYABLE-BUSINESSPLACE = '1001'.
      ACCOUNTPAYABLE-PYMT_CUR      = 'USD'.
      ACCOUNTPAYABLE-PYMT_AMT      = '123,438.0000'.
      ACCOUNTPAYABLE-SP_GL_IND     = '2'.
      ACCOUNTPAYABLE-TAX_CODE      = 'RR'.
      CURRENCYAMOUNT-ITEMNO_ACC = '0000000001'.
      CURRENCYAMOUNT-CURRENCY   = 'USD'.
      CURRENCYAMOUNT-AMT_DOCCUR = '123,438.0000'.
    But the function returns an error:
    'Enter a payment currency different to USD'
    But if I would set with different currencies, it returns an error:
    'Balance in transaction currency'
    If the ACCOUNTPAYABLE-PYMT_CUR and ACCOUNTPAYABLE-PYMT_AMT were remained empty, it returns
    'Balance in transaction currency'
    What should I do about this currency setting.
    Someone please let me know about doing this right way.
    Thank you.
    Message was edited by: Jong-woon Lee

    Hi,
    Just in case you found this thread with the same problem.
    At least in my case what was happening is that I wanted to leave the currency fields blank (the same currency as payment value) but I was filling in ACCOUNTPAYABLE-PYMT_AMT, so was receiving error telling me that currency fields could not be empty. And if I set them to the same as payment, I would receive a message telling me that currency must be different.
    If you want to use only one currency you don't need to fill in these 3 fields:
    ACCOUNTPAYABLE-PYMT_AMT
    ACCOUNTPAYABLE-PYMT_CUR
    ACCOUNTPAYABLE-PYMT_CUR_ISO
    The same probably applies for the ACCOUNTRECEIVABLE table.
    Cheers,
    Erick
    Ps.
    Some extra text so you can find this thread by searching for error messages:
    Required field CURRENCY was not transferred in parameter ACCOUNTPAYABLE
    For the ISO code  there is no unique SAP currency code for ALE
    For the ISO code  there is no unique SAP currency code for ALE
        Message no. B1888
    Diagnosis
        There are several entries in TCURC for this ISO code, but none with the
        primary flag set.
    Procedure
        In table TCURC set the primary flag for ISO codes used multiple times.
    Required field CURRENCY was not transferred in parameter ACCOUNTPAYABLE
        Message no. RW602
    Diagnosis
        Field CURRENCY is required in parameter ACCOUNTPAYABLE for processing
        the document. The document is incomplete without this field.
    System Response
        The document cannot be processed.
    Procedure
        Enter a valid value in field CURRENCY in parameter ACCOUNTPAYABLE.

  • 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!

  • How to populate field XBLNR_ALT in table BKPF through BAPI_ACC_DOCUMENT_POST

    I have a requirement  to populate BKPF-XBLNR_ALT field through my program which is using BAPI_ACC_DOCUMENT_POST to create accounting document. But the header structure 'DOCUMENTHEADER' has no field which can be used for this purpose. How can i solve this problem?
    Regards,
    Meenu

    Hi Susmitha,
    I can not find BTE RWBAPI01 in my system. Can you suggest what should i do?
    I tried using BTE 00001120.  here I populated T_BKPF-XBLNR_ALT with desired value but after complete execution BKPF-XBLNR_ALT is still empty.
    Reagrds,
    Meenu

  • How to use EXTENSION1 in BAPI_ACC_DOCUMENT_POST

    Hi,
    I am using BAPI_ACC_DOCUMENT_POST for posting documents similar to what is posted using FBS1 transaction code.
    I'm not able to populate reversal date in the BAPI_ACC_DOCUMENT_POST. There is a provision it seems using the EXTENSION1 tables parameter.
    Can anyone please tell me the procedure preferably a small piece of sample code in which I can know how to pass the Reversal Date using the EXTENSION1 structure.
    Also which process code is required to be used in the Business Transaction Events enhancements to implement this.
    Thanks and regards,
    Satyadev Dutta

    hi
    good
    go through this program which ll help you to give greater knowledge about use of EXTENSION1 in BAPI_ACC_DOCUMENT_POST
    ======================================
    report zbapi_factura_acreedor2 .
    *REPORT  acc_bapi_test_document                  .
    selection-screen begin of block bl01 .
    parameters:
      check_l             radiobutton group rb1,
      check_a default 'X' radiobutton group rb1,
      post                radiobutton group rb1.
    selection-screen uline.
    parameters:
      rev_c               radiobutton group rb1,
      rev_p               radiobutton group rb1.
    selection-screen uline.
    parameters:
      ref_key like bapiache01-obj_key default 'TEST000001BAPICALL',
      dest    like bdi_logsys-logsys  default '          '.
    selection-screen end   of block bl01 .
    data:
      gd_documentheader    like bapiache09,
      gd_customercpd       like bapiacpa09,
      gd_fica_hd           like bapiaccahd,
      it_accountreceivable like table of bapiacar09 with header line,
      it_accountgl         like table of bapiacgl09 with header line,
      it_accounttax        like table of bapiactx09 with header line,
      it_criteria          like table of bapiackec9 with header line,
      it_valuefield        like table of bapiackev9 with header line,
      it_currencyamount    like table of bapiaccr09 with header line,
      it_return            like table of bapiret2   with header line,
      it_receivers         like table of bdi_logsys with header line,
      it_fica_it           like table of bapiaccait with header line,
      it_accountpayable    like table of bapiacap09 with header line,
      it_paymentcard       like table of bapiacpc09 with header line,
      it_ext               like table of bapiacextc with header line.
    it_re                LIKE TABLE OF bapiacre09 WITH HEADER LINE,
    it_ext2              LIKE TABLE OF bapiparex  WITH HEADER LINE.
    perform fill_internal_tables.
    if check_l = 'X'.
      call function 'BAPI_ACC_DOCUMENT_CHECK'
           destination dest
           exporting
                documentheader    = gd_documentheader
                customercpd       = gd_customercpd
                contractheader    = gd_fica_hd
           tables
                accountgl         = it_accountgl
                accountreceivable = it_accountreceivable
                accountpayable    = it_accountpayable
                accounttax        = it_accounttax
               currencyamount    = it_currencyamount
                criteria          = it_criteria
                valuefield        = it_valuefield
                extension1        = it_ext
                return            = it_return
                paymentcard       = it_paymentcard
                contractitem      = it_fica_it.
               extension2        = it_ext2
               realestate        = it_re.
      write: / 'Result of check lines:'.                        "#EC NOTEXT
      perform show_messages.
    endif.
    if check_a = 'X'.
      call function 'BAPI_ACC_DOCUMENT_CHECK'
        destination dest
        exporting
          documentheader    = gd_documentheader
          customercpd       = gd_customercpd
          contractheader    = gd_fica_hd
        tables
          accountgl         = it_accountgl
          accountreceivable = it_accountreceivable
          accountpayable    = it_accountpayable
          accounttax        = it_accounttax
          currencyamount    = it_currencyamount
          criteria          = it_criteria
          valuefield        = it_valuefield
          extension1        = it_ext
          return            = it_return
          paymentcard       = it_paymentcard
          contractitem      = it_fica_it.
         extension2        = it_ext2
         realestate        = it_re.
      write: / 'Result of check all:'.                          "#EC NOTEXT
      perform show_messages.
    endif.
    if post = 'X'.
      data: l_type like gd_documentheader-obj_type,
            l_key  like gd_documentheader-obj_key,
            l_sys  like gd_documentheader-obj_sys.
      if dest = space or
         dest = gd_documentheader-obj_sys.
       post synchron
        call function 'BAPI_ACC_DOCUMENT_POST'
          exporting
            documentheader    = gd_documentheader
            customercpd       = gd_customercpd
            contractheader    = gd_fica_hd
          importing
            obj_type          = l_type
            obj_key           = l_key
            obj_sys           = l_sys
          tables
            accountgl         = it_accountgl
            accountreceivable = it_accountreceivable
            accountpayable    = it_accountpayable
            accounttax        = it_accounttax
            currencyamount    = it_currencyamount
            criteria          = it_criteria
            valuefield        = it_valuefield
            extension1        = it_ext
            return            = it_return
            paymentcard       = it_paymentcard
            contractitem      = it_fica_it.
           extension2        = it_ext2
           realestate        = it_re.
        write: / 'Result of post:'.                             "#EC NOTEXT
        perform show_messages.
      else.
      create Idoc
        it_receivers-logsys = dest.
        append it_receivers.
        call function 'ALE_ACC_DOCUMENT_POST'
          exporting
            documentheader    = gd_documentheader
            customercpd       = gd_customercpd
            contractheader    = gd_fica_hd
          tables
            accountgl         = it_accountgl
            accountreceivable = it_accountreceivable
            accountpayable    = it_accountpayable
            accounttax        = it_accounttax
            currencyamount    = it_currencyamount
            criteria          = it_criteria
            valuefield        = it_valuefield
            extension1        = it_ext
            paymentcard       = it_paymentcard
            contractitem      = it_fica_it
           extension2        = it_ext2
           realestate        = it_re
            receivers         = it_receivers
          COMMUNICATION_DOCUMENTS =
          APPLICATION_OBJECTS     =
          exceptions
            error_creating_idocs    = 1
            others                  = 2  .
        if sy-subrc = 0.
          write: / 'IDoc created'.                              "#EC NOTEXT
        else.
          write: sy-msgid.
        endif.
      endif.
    endif.
    if rev_p = 'X' or rev_c = 'X'.
      data: rev like bapiacrev,
            rev_key like ref_key.
      rev_key       = ref_key.
      rev_key(1)    = 'R'.
      rev-obj_type  = gd_documentheader-obj_type.
      rev-obj_key   = rev_key.
      rev-obj_sys   = gd_documentheader-obj_sys.
      rev-obj_key_r = ref_key.
      if rev_c is initial.
        if dest = space or
           dest = gd_documentheader-obj_sys.
          call function 'BAPI_ACC_DOCUMENT_REV_POST'
            exporting
              reversal = rev
              bus_act  = gd_documentheader-bus_act
            tables
              return   = it_return.
        else.
          it_receivers-logsys = dest.
          append it_receivers.
          call function 'ALE_ACC_DOCUMENT_REV_POST'
            exporting
              reversal                      = rev
              busact                        = gd_documentheader-bus_act
            OBJ_TYPE                      = 'BUS6035'
            SERIAL_ID                     = '0'
            tables
              receivers                     = it_receivers
            COMMUNICATION_DOCUMENTS       =
            APPLICATION_OBJECTS           =
            exceptions
              error_creating_idocs          = 1
              others                        = 2
          if sy-subrc <> 0.
            message id sy-msgid type sy-msgty number sy-msgno
                    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          else.
            write: / 'IDoc created'.                            "#EC NOTEXT
          endif.
        endif.
      else.
        call function 'BAPI_ACC_DOCUMENT_REV_CHECK'
          exporting
            reversal = rev
            bus_act  = gd_documentheader-bus_act
          tables
            return   = it_return.
      endif.
      write: / 'Result of Reversal Posting:'.                   "#EC NOTEXT
      perform show_messages.
    endif.
    commit work.
         Form  fill_internal_tables
    form fill_internal_tables.
      perform fill_header.
      perform fill_accountgl.
    perform fill_accountar.
      perform fill_accountap.
      perform fill_accounttax.
      perform fill_currencyamount.
    perform fill_criteria.
    perform fill_valuefield.
    perform fill_re.
    perform fill_cpd.
    perform fill_contractitem.
    perform fill_contractheader.
    perform fill_paymentcard.
    perform fill_extension.
    endform.                               " fill_internal_tables
         Form  Show_messages
    form show_messages.
      if it_return[] is initial.
        write: / 'no messages'.
      else.
        skip 1.
        loop at it_return.
          write: /    it_return-type,
                 (2)  it_return-id,
                      it_return-number,
                 (80) it_return-message,
                    IT_RETURN-LOG_NO
                    IT_RETURN-LOG_MSG_NO
                      it_return-message_v1,
                    IT_RETURN-MESSAGE_V2
                    IT_RETURN-MESSAGE_V3
                    IT_RETURN-MESSAGE_V4
                 (20) it_return-parameter,
                 (3)  it_return-row,
                      it_return-field.
                    IT_RETURN-SYSTEM
        endloop.
      endif.
      uline.
    endform.                               " Show_messages
          FORM fill_accountgl                                           *
    form fill_accountgl.
      clear it_accountgl.
      it_accountgl-itemno_acc     = 2.
      it_accountgl-gl_account     = '0021510201'.
      it_accountgl-item_text      = 'BAPI Test G/L line item'.  "#EC NOTEXT
    it_accountgl-bus_area       = '01'.
    it_accountgl-profit_ctr     = '0000010101'.
    it_accountgl-comp_code      = 'SLOC'.
      append it_accountgl.
      clear it_accountgl.
      it_accountgl-itemno_acc     = 3.
      it_accountgl-gl_account     = '0082000201'.
      it_accountgl-item_text      = 'BAPI Test G/L line item'.  "#EC NOTEXT
      it_accountgl-bus_area       = '01'.
      it_accountgl-profit_ctr     = '0000010101'.
      it_accountgl-comp_code      = 'SLOC'.
      it_accountgl-tax_code       = 'A3'.
      append it_accountgl.
      clear it_accountgl.
      it_accountgl-itemno_acc     = 5.
      it_accountgl-gl_account     = '0021510201'.
      it_accountgl-item_text      = 'BAPI Test G/L line item'.  "#EC NOTEXT
    it_accountgl-bus_area       = '01'.
    it_accountgl-profit_ctr     = '0000010301'.
    it_accountgl-comp_code      = 'SLOC'.
      append it_accountgl.
      clear it_accountgl.
      it_accountgl-itemno_acc     = 6.
      it_accountgl-gl_account     = '0082000201'.
      it_accountgl-item_text      = 'BAPI Test G/L line item'.  "#EC NOTEXT
      it_accountgl-bus_area       = '01'.
      it_accountgl-profit_ctr     = '0000010301'.
      it_accountgl-comp_code      = 'SLOC'.
      it_accountgl-tax_code       = 'A3'.
      append it_accountgl.
      clear it_accountgl.
      it_accountgl-itemno_acc     = 7.
    it_accountgl-itemno_acc     = 8.
      it_accountgl-gl_account     = '0021510201'.
      it_accountgl-item_text      = 'BAPI Test G/L line item'.  "#EC NOTEXT
    it_accountgl-bus_area       = '90'.
    it_accountgl-profit_ctr     = '0000900008'.
    it_accountgl-comp_code      = 'CORP'.
      append it_accountgl.
      clear it_accountgl.
      it_accountgl-itemno_acc     = 8.
    it_accountgl-itemno_acc     = 9.
      it_accountgl-gl_account     = '0082000201'.
      it_accountgl-item_text      = 'BAPI Test G/L line item'.  "#EC NOTEXT
      it_accountgl-bus_area       = '90'.
      it_accountgl-profit_ctr     = '0000900008'.
      it_accountgl-comp_code      = 'CORP'.
    it_accountgl-tax_code       = 'A3'.
      append it_accountgl.
    endform.                    "fill_accountgl
          FORM fill_header                                              *
    form fill_header.
    CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
       IMPORTING
         own_logical_system = gd_documentheader-obj_sys.
    OBJ_TYPE has to be replaced by customers object key (Y* or Z*)
    gd_documentheader-obj_type   = 'IDOC'.
    gd_documentheader-obj_key    = ref_key.
      gd_documentheader-username   = sy-uname.
      gd_documentheader-header_txt = 'BAPI Test'.               "#EC NOTEXT
    gd_documentheader-obj_key_r  =
    GD_DOCUMENTHEADER-reason_rev =
    gd_documentheader-comp_code  = 'SLOC'.
    GD_DOCUMENTHEADER-AC_DOC_NO  =
      gd_documentheader-fisc_year  = sy-datum(4).
      gd_documentheader-doc_date   = sy-datum.
      gd_documentheader-pstng_date = sy-datum.
    GD_DOCUMENTHEADER-TRANS_DATE =
    GD_DOCUMENTHEADER-VALUE_DATE =
    GD_DOCUMENTHEADER-FIS_PERIOD =
    gd_documentheader-doc_type   = 'KR'.
    gd_documentheader-ref_doc_no = 'xxxx'.
    GD_DOCUMENTHEADER-COMPO_ACC  =
      gd_documentheader-bus_act    = 'RFBU'.
    endform.                    "fill_header
          FORM fill_contractheader                                     *
    form fill_contractheader.
    gd_fica_hd-doc_no           =
    gd_fica_hd-doc_type_ca      =
    gd_fica_hd-res_key          =
    gd_fica_hd-fikey            =
    gd_fica_hd-payment_form_ref =
    endform.                    "fill_contractheader
          FORM fill_cpd                                                 *
    form fill_cpd.
    gd_customercpd-name
    gd_customercpd-name_2
    gd_customercpd-name_3
    gd_customercpd-name_4
    gd_customercpd-postl_code
    gd_customercpd-city
    gd_customercpd-country
    gd_customercpd-country_iso
    gd_customercpd-street
    gd_customercpd-po_box
    gd_customercpd-pobx_pcd
    gd_customercpd-pobk_curac
    gd_customercpd-bank_acct
    gd_customercpd-bank_no
    gd_customercpd-bank_ctry
    gd_customercpd-bank_ctry_iso
    gd_customercpd-tax_no_1
    gd_customercpd-tax_no_2
    gd_customercpd-tax
    gd_customercpd-equal_tax
    gd_customercpd-region
    gd_customercpd-ctrl_key
    gd_customercpd-instr_key
    gd_customercpd-dme_ind
    gd_customercpd-langu_iso
    endform.                    "fill_cpd
          FORM fill_ar                                                  *
    form fill_accountar.
    CLEAR it_accountreceivable.
    it_accountreceivable-itemno_acc =
    it_accountreceivable-customer   =
    IT_ACCOUNTRECEIVABLE-REF_KEY_1  =
    IT_ACCOUNTRECEIVABLE-REF_KEY_2  =
    IT_ACCOUNTRECEIVABLE-REF_KEY_3  =
    IT_ACCOUNTRECEIVABLE-PMNTTRMS   =
    IT_ACCOUNTRECEIVABLE-BLINE_DATE =
    IT_ACCOUNTRECEIVABLE-DSCT_DAYS1 =
    IT_ACCOUNTRECEIVABLE-DSCT_DAYS2 =
    IT_ACCOUNTRECEIVABLE-NETTERMS   =
    IT_ACCOUNTRECEIVABLE-DSCT_PCT1  =
    IT_ACCOUNTRECEIVABLE-DSCT_PCT2  =
    IT_ACCOUNTRECEIVABLE-PYMT_METH  =
    IT_ACCOUNTRECEIVABLE-DUNN_KEY   =
    IT_ACCOUNTRECEIVABLE-DUNN_BLOCK =
    IT_ACCOUNTRECEIVABLE-PMNT_BLOCK =
    IT_ACCOUNTRECEIVABLE-VAT_REG_NO =
    IT_ACCOUNTRECEIVABLE-ALLOC_NMBR =
    it_accountreceivable-item_text  =
    IT_ACCOUNTRECEIVABLE-PARTNER_BK =
    IT_ACCOUNTRECEIVABLE-GL_ACCOUNT =
    it_accountreceivable-comp_code
    it_accountreceivable-bus_area
    it_accountreceivable-pmtmthsupl
    it_accountreceivable-paymt_ref
    it_accountreceivable-scbank_ind
    it_accountreceivable-businessplace
    it_accountreceivable-sectioncode
    it_accountreceivable-branch
    it_accountreceivable-pymt_cur
    it_accountreceivable-pymt_cur_iso
    it_accountreceivable-pymt_amt
    it_accountreceivable-c_ctr_area
    it_accountreceivable-bank_id
    it_accountreceivable-supcountry
    it_accountreceivable-supcountry_iso
    it_accountreceivable-tax_code
    it_accountreceivable-taxjurcode
    it_accountreceivable-tax_date
    it_accountreceivable-sp_gl_ind
    it_accountreceivable-partner_guid = '1465464654'.
    APPEND it_accountreceivable.
    endform.                    "fill_accountar
          FORM fill_ap                                                  *
    form fill_accountap.
      clear it_accountpayable.
      it_accountpayable-itemno_acc = 1.
    it_accountpayable-vendor_no  = '0000060259'.
      it_accountpayable-vendor_no  = '0000060693'.
    it_accountpayable-gl_account
    it_accountpayable-ref_key_1
    it_accountpayable-ref_key_2
    it_accountpayable-ref_key_3
    it_accountpayable-comp_code = 'SLOC'.
    it_accountpayable-bus_area = '01'.
    it_accountpayable-pmnttrms = 'A000'.
    it_accountpayable-bline_date
    it_accountpayable-dsct_days1
    it_accountpayable-dsct_days2
    it_accountpayable-netterms
    it_accountpayable-dsct_pct1
    it_accountpayable-dsct_pct2
    it_accountpayable-pymt_meth
    it_accountpayable-pmtmthsupl
    it_accountpayable-pmnt_block
    it_accountpayable-scbank_ind
    it_accountpayable-supcountry
    it_accountpayable-supcountry_iso
    it_accountpayable-bllsrv_ind
    it_accountpayable-alloc_nmbr
      it_accountpayable-item_text  = 'BAPI Test A/P line item'. "#EC NOTEXT
    it_accountpayable-po_sub_no
    it_accountpayable-po_checkdg
    it_accountpayable-po_ref_no
    it_accountpayable-w_tax_code
    it_accountpayable-businessplace
    it_accountpayable-sectioncode
    it_accountpayable-instr1
    it_accountpayable-instr2
    it_accountpayable-instr3
    it_accountpayable-instr4
    it_accountpayable-branch
    it_accountpayable-pymt_cur
    it_accountpayable-pymt_amt
    it_accountpayable-pymt_cur_iso
    it_accountpayable-sp_gl_ind
      append it_accountpayable.
    endform.                    "fill_accountap
          FORM fill_tax                                                 *
    form fill_accounttax.
      clear it_accounttax.
      it_accounttax-itemno_acc = 4.
      it_accounttax-gl_account = '0011361502'.
      it_accounttax-tax_code   = 'A3'.
      it_accounttax-acct_key   = 'VST'.
      it_accounttax-cond_key   = 'MWVS'.
    it_accounttax-itemno_tax = 8.
      append it_accounttax.
    clear it_accounttax.
    it_accounttax-itemno_acc = 7.
    it_accounttax-gl_account = '0011361502'.
    it_accounttax-tax_code   = 'A3'.
    it_accounttax-acct_key   = 'VST'.
    it_accounttax-COND_KEY   = 'MWVS'.
    append it_accounttax.
    clear it_accounttax.
    it_accounttax-itemno_acc = 10.
    it_accounttax-itemno_acc = 9.
    it_accounttax-gl_account = '0011361502'.
    it_accounttax-tax_code   = 'A3'.
    it_accounttax-acct_key   = 'VST'.
    it_accounttax-cond_key   = 'MWVS'.
    it_accounttax-itemno_tax = 4.
    append it_accounttax.
    endform.                    "fill_accounttax
          FORM fill_currencyamount                                      *
    form fill_currencyamount.
      clear it_currencyamount.
      it_currencyamount-itemno_acc   = 1.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'MXN'.
      it_currencyamount-amt_doccur   = '-7408036.2'.
      append it_currencyamount.
      clear it_currencyamount.
      it_currencyamount-itemno_acc   = 2.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'MXN'.
      it_currencyamount-amt_doccur   = '5336472.00'.
      append it_currencyamount.
      clear it_currencyamount.
      it_currencyamount-itemno_acc   = 3.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'MXN'.
      it_currencyamount-amt_doccur   = '3840.00'.
      append it_currencyamount.
      clear it_currencyamount.
      it_currencyamount-itemno_acc   = 4.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'MXN'.
      it_currencyamount-amt_base   = '5548.00'.
      it_currencyamount-amt_doccur   = '832.2'.
    it_currencyamount-amt_doccur   = '576.00'.
    it_currencyamount-amt_base   = '3840.00'.
      append it_currencyamount.
      clear it_currencyamount.
      it_currencyamount-itemno_acc   = 5.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'MXN'.
      it_currencyamount-amt_doccur   = '2051279.00'.
      append it_currencyamount.
      clear it_currencyamount.
      it_currencyamount-itemno_acc   = 6.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'MXN'.
      it_currencyamount-amt_doccur   = '1690.00'.
      append it_currencyamount.
    clear it_currencyamount.
    it_currencyamount-itemno_acc   = 7.
    it_currencyamount-curr_type    = '00'.
    it_currencyamount-currency     = 'MXN'.
    it_currencyamount-amt_base     = '1690.00'.
    it_currencyamount-amt_doccur   = '253.5'.
    append it_currencyamount.
      clear it_currencyamount.
    it_currencyamount-itemno_acc   = 8.
      it_currencyamount-itemno_acc   = 7.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'MXN'.
      it_currencyamount-amt_doccur   = '13905.00'.
      append it_currencyamount.
      clear it_currencyamount.
    it_currencyamount-itemno_acc   = 9.
      it_currencyamount-itemno_acc   = 8.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'MXN'.
    it_currencyamount-amt_base     = '2.70'.
      it_currencyamount-amt_doccur   = '18.00'.
      append it_currencyamount.
    clear it_currencyamount.
    it_currencyamount-itemno_acc   = 10.
    it_currencyamount-itemno_acc   = 9.
    it_currencyamount-curr_type    = '00'.
    it_currencyamount-currency     = 'MXN'.
    it_currencyamount-amt_doccur   = '2.70'.
    it_currencyamount-amt_base     = '18.00'.
    append it_currencyamount.
    endform.                    "fill_currencyamount
          FORM fill_criteria                                            *
    form fill_criteria.
    CLEAR it_criteria.
    it_criteria-itemno_acc = 2.
    it_criteria-fieldname = 'BZIRK'.
    it_criteria-character = '000001'.
    append it_criteria.
    endform.                    "fill_criteria
          FORM fill_valuefield                                          *
    form fill_valuefield.
    CLEAR it_valuefield.
    it_valuefield-itemno_acc = 2.
    it_valuefield-fieldname = 'VV010'.
    it_valuefield-curr_type
    it_valuefield-currency = 'EUR'.
    it_valuefield-currency_iso
    it_valuefield-amt_valcom
    it_valuefield-base_uom
    it_valuefield-base_uom_iso
    it_valuefield-qua_valcom
    append it_valuefield.
    endform.                    "fill_valuefield
          FORM fill_extension                                           *
    form fill_extension.
    CLEAR it_ext.
    it_ext-field1
    it_ext-field2
    it_ext-field3
    it_ext-field4
    APPEND it_ext.
    DATA: ls_zzz TYPE ZZZ_ACCIT.
    CLEAR it_ext2.
    it_ext2-structure = 'ZZZ_ACCIT'.
    ls_zzz-posnr = 2.
    ls_zzz-awref_reb = '123654'.
    ls_zzz-aworg_reb = '654654'.
    ls_zzz-grant_nbr = '0022002'.
    MOVE ls_zzz TO it_ext2-valuepart1.
    APPEND it_ext2.
    endform.                    "fill_extension
          FORM fill_paymentcard                                         *
    form fill_paymentcard.
    CLEAR it_paymentcard.
    it_paymentcard-itemno_acc = 1.
    it_paymentcard-cc_glaccount
    it_paymentcard-cc_type
    it_paymentcard-cc_number
    it_paymentcard-cc_seq_no
    it_paymentcard-cc_valid_f
    it_paymentcard-cc_valid_t
    it_paymentcard-cc_name
    it_paymentcard-dataorigin
    it_paymentcard-authamount = '100'.
    it_paymentcard-currency = 'EUR'.
    it_paymentcard-currency_iso
    it_paymentcard-cc_autth_no
    it_paymentcard-auth_refno
    it_paymentcard-auth_date
    it_paymentcard-auth_time
    it_paymentcard-merchidcl
    it_paymentcard-point_of_receipt
    it_paymentcard-terminal
    it_paymentcard-cctyp = '1'.
    APPEND it_paymentcard.
    endform.                    "fill_paymentcard
          FORM fill_contractitem                                        *
    form fill_contractitem.
    CLEAR it_fica_it.
    it_fica_it-itemno_acc
    it_fica_it-cont_acct
    it_fica_it-main_trans
    it_fica_it-sub_trans
    it_fica_it-func_area
    it_fica_it-fm_area
    it_fica_it-cmmt_item
    it_fica_it-funds_ctr
    it_fica_it-fund
    append it_fica_it.
    endform.                    "fill_contractitem
    *&      Form  fill_re
    form fill_re .
    CLEAR it_re.
    it_re-itemno_acc      =
    it_re-business_entity =
    it_re-building        =
    it_re-property        =
    it_re-rental_object   =
    it_re-serv_charge_key =
    it_re-settlement_unit =
    it_re-contract_no     =
    APPEND it_re.
    endform.                    "fill_re
    thanks
    mrutyun^

  • BAPI - BAPI_ACC_DOCUMENT_POST  Error due to Currency table.

    Hi Guys ,
    I am facing an error while posting documents using BAPI_ACC_DOCUMENT_POST.  The error occurs is in the tables parameters "currencyamount" .I am appending Amt in document currency, Amt in Local currency, Amount in 2nd Currency and Amount in 3rd Currency using Currency type (CURR_TYP)  00,10,30 and 60 respectively for every line item. All these 4 currency fields might have different values.The error in the "return" parameter says "Balance in currencies".
    Can anyone suggest an appropriate way to pass all the above 4  currency fields to the same line item ?
    Thanks,
    Venkat.

    Hi VG,
    while using this bapi...the total amount or net amount should be zero.
    Thru Txn we assign posting key  ..and system autiomatically take the sign on the basiss of Posting key..but in this bapi we dont have posting key field....so we have to give the amount with the sign...and total of all the line items should be zero ...
    Thnx
    RK

  • Error FI/CO interface: Balance in transaction currency from BAPI BAPI_ACC_DOCUMENT_POST

    Hi All,
    We are facing error FI/CO interface: Balance in transaction currency from BAPI BAPI_ACC_DOCUMENT_POST.
    This error we are getting only in case of passing tax data.
    Can anyone help me on this.
    Below is the code :
       *fill header
    gd_documentheader-username   =  sy-uname.
    gd_documentheader-header_txt = 'Test'.
    gd_documentheader-comp_code  = p_ccode.   "SQ
    gd_documentheader-doc_date   =  sy-datum.
    gd_documentheader-pstng_date =  sy-datum.
    gd_documentheader-doc_type   = 'KR'.
    gd_documentheader-ref_doc_no = p_xblnr. "SQ
    *gd_documentheader-bus_act = 'RMWE'.
    city = p_city.
    state = p_state.
    zipcode = p_zip.
    *get tax juridisction code
    IF NOT ( city     IS INITIAL ) AND
       NOT ( state    IS INITIAL ) AND
       NOT ( zipcode IS INITIAL ).
      SELECT SINGLE rfcdest INTO ttxd-rfcdest FROM ttxd
       WHERE kalsm = 'TAXUSX'.
      CLEAR x_com_jur.
      REFRESH t_com_jur.
      x_com_jur-city     =  city.
      x_com_jur-state    =  state.
      IF zipcode+5(4) EQ space.
        zipcode+5(4) = '0000'.
      ENDIF.
      CONCATENATE zipcode+0(5) '-' zipcode+5(4)
             INTO x_com_jur-zipcode.
      x_com_jur-country  = 'US'.
      CALL FUNCTION 'RFC_DETERMINE_JURISDICTION'
        DESTINATION ttxd-rfcdest
        EXPORTING
          location_data    = x_com_jur
        IMPORTING
          location_err     = x_com_err
        TABLES
          location_results = t_com_jur.
      IF sy-subrc = 0.
        READ TABLE t_com_jur INTO x_com_jur INDEX 1.
        it_accountgl-taxjurcode =  x_com_jur-txjcd.
      ENDIF.
    ENDIF.
    *fill AP (line 1) - vendor related data
    SELECT SINGLE zterm FROM lfb1 INTO p_zterm WHERE lifnr = p_lifnr.
    it_accountpayable-itemno_acc = 1.
    it_accountpayable-tax_code = p_txcd.
    it_accountpayable-pmnttrms   = p_zterm. "SQ
    it_accountpayable-vendor_no  = p_lifnr. "SQ
    *it_accountpayable-item_text = 'S2P Testing in UDR1'. - SQ
    it_accountpayable-pymt_meth = p_pmet. "- SQ
    APPEND it_accountpayable.
    *fill GL (line 2)
    it_accountgl-itemno_acc      =  2.
    *item_text - sq
    IF p_asset IS NOT INITIAL.
      TABLES : anlz,
               anla.
      SELECT SINGLE * FROM anlz  WHERE anln1 = p_asset.
      SELECT SINGLE * FROM anla WHERE anln1 = p_asset.
    *concatenate '00' anla-KTOGR into it_accountgl-gl_account .
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = anla-ktogr
        IMPORTING
          output = it_accountgl-gl_account.
      it_accountgl-asset_no = p_asset.
      it_accountgl-sub_number = '0000'.
      it_accountgl-cs_trans_t = '105'.
      it_accountgl-acct_type = 'A'.
    ELSE.
      it_accountgl-gl_account      = p_gl.
      it_accountgl-costcenter      = p_cc.
      it_accountgl-wbs_element     = p_posid.
    ENDIF.
    it_accountgl-comp_code       = p_ccode.
    it_accountgl-tax_code = p_txcd.  "SQ
    it_accountgl-pstng_date      =  sy-datum.
    it_accountgl-fisc_year       =  sy-datum(4).
    APPEND it_accountgl.
    CLEAR it_currencyamount.
    *fill currency ammounts for lines 1 & 2
    it_currencyamount-currency    = p_waers.  "SQ
    it_currencyamount-itemno_acc  = 1.
    *it_currencyamount-amt_base =  -1.
    it_currencyamount-amt_doccur  = - 116. "p_totamt.
    it_currencyamount-CURRENCY_ISO = 'USD'.
    it_currencyamount-tax_amt  = - 16.
    APPEND it_currencyamount.
    CLEAR it_currencyamount.
    it_currencyamount-itemno_acc  = 2.
    it_currencyamount-currency    = p_waers.  "SQ
    it_currencyamount-amt_doccur  = 100.
    it_currencyamount-CURRENCY_ISO = 'USD'.
    *it_currencyamount-amt_base =  100.
    *it_currencyamount-TAX_AMT =  -10.
    APPEND it_currencyamount.
    *tax data
    it_accounttax-itemno_acc = 3.
    it_accounttax-tax_code = p_txcd.
    it_accounttax-gl_account = '0023110000'.
    *it_accounttax-gl_account = p_gl.
    it_accounttax-TAXJURCODE = x_com_jur-txjcd.
    it_accounttax-acct_key = 'NVV'.
    it_accounttax-cond_key = 'XP2I'.
    **it_accounttax-direct_tax = 'X'.
    APPEND it_accounttax.
    CLEAR it_currencyamount.
    it_currencyamount-itemno_acc  = 3.
    it_currencyamount-currency    = p_waers.  "SQ
    it_currencyamount-amt_doccur  = 16.
    it_currencyamount-CURRENCY_ISO = 'USD'.
    it_currencyamount-amt_base =  100.
    it_currencyamount-TAX_AMT =  - 16  .
    APPEND it_currencyamount.
       CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        documentheader          = gd_documentheader
    IMPORTING
       obj_key                 = wa_obj_key
      TABLES
       accountgl               = it_accountgl
    *   ACCOUNTRECEIVABLE       =
       accountpayable          = it_accountpayable
       accounttax              = it_accounttax
        currencyamount          = it_currencyamount
    *   CRITERIA                =
    *   VALUEFIELD              =
    *   EXTENSION1              =
        return                  =  it_return
    COMMIT WORK.
    Regards,
    Priyaranjan

    Hi,
    Reason 1:
    An revenue-recognition-relevant item has several active conditions whose values cancel themselves so that a net item value of 0 results. The conditions have both the same revenue account (SAKN1) and the same clearing account (SAKN2).
    For these conditions, the system writes a line with value 0 into the temporary FI/CO interface (internal tables: CACCIT, CACCCR). If table VBREVK does not contain control lines for this line, no further processing occurs and the line remains in the temporary FI/CO interface. Then the system reads this line for the creation of the next billing item which conatins a net value and generates a posting line with value 0. As a result, there is a balance in the FI/CO interface, and the billing document cannot be transferred.
    Reason 2:
    The billing document contains at least one item with an item category for which there is a setting stipulating that the values of this item should not be transferred to the header total of the document.
    That is, in the maintenance of the item categories, this item category has the characteristic 'X' or 'Y' in 'Statistical value' field.
    Reason 3:
    Case: Billing document contains items without pricing conditions.
    Then, on release to accounting, error RW022 occurs.
    regards,
    Saju.S

  • GL Account/BAPI_ACC_DOCUMENT_POST

    Hi all,
       I am using BAPI_ACC_DOCUMENT_POST to post a document.
    The document gets successfully posted and uploaded in SAP. My input flat file has posting key 06 40 11 50 depending on whether it is a debit or credit line item. But in the BAPI there is no provision to pass posting key.
    As of now for customer the posting key is automatically taken as 01 and for GL account the posting key is taken as 50. Could any one of you please tell how the posting key assignment is happening while calling this BAPI. Also can any one suggest how to assign posting keys mentioned above (06,40,11,50).
    Please help me...
    Thanks in advance
    Deepthi Gangadharan

    Hi deepti,
    Maintain the t030b table with the required posting keys.
    System determines the posting based on the transaction key whatever you pas it from BAPIACGL09-kTOSL.
    Function module FI_GET_POSTING_KEY is used to get the posting key which needs the KTOSL field as a import parameter.Try this out and let me know if that solved that issue.
    Thank you.
    Regards,
    karun.M

  • AWKEY field of the Document Header of BAPI_ACC_DOCUMENT_POST

    HI Experts,
    I am using BAPI_ACC_DOCUMENT_POST to create Finance Postings and have a requirement to populate the Reference key field externally while using this BAPI.
    I am aware of the fact that if I leave the fields OBJ_TYP(Reference Transaction), OBJ_KEY(Reference Key) and OBJ_SYS(current system name) of the DOCUMENTHEADER segment of the BAPI as blank while executing the BAPI, these fields will be automatically populated with values as under:
    OBJ_TYP = 'BKPFF'
    OBJ_KEY = '0100000021BE102011' (BELNRBUKRSGJAHR)
    OBJ_SYS = System name
    But the Reference transaction (OBJ_TYP) which we need to use is 'HRPAY' and the OBJ_KEY should have the value of BELNR (only), OBJ_SYS should be populated as usual.
    I tried get the next BELNR available, using the FM 'NUMBER_GET_NEXT' and then tried assigning it to the BAPI in the BELNR field of the DOCUMENTHEADER segment of the BAPI, but as we know that the BAPI_ACC_DOCUMENT_POST also determines the next BELNR internally, the number returned by the FM NUMBER_GET_NEXT becomes redundant and the BAPI_ACC_DOCUMENT_POST uses the number next to it.
    To understand it in detail consider the below example:
    Suppose the number BELNR available (number returned by NUMBER_GET_NEXT) is 0100000021 and I pass it to the BAPI, since I have already used this number (by executing NUMBER_GET_NEXT) the BAPI_ACC_DOCUMENT_POST will create a Posting with 0100000022 as the BELNR.
    I am looking for a way to reserve the BELNR, so that the resultant BELNR should be the same as the one which I pass to the BAPI_ACC_DOCUMENT_POST.
    I would avoid trying to get the previous BELNR used (NUMBER_GET_INFO), increment it by 1, and then pass it to the BAPI_ACC_DOCUMENT_POST.
    Please suggest.

    Hi Amit,
    To swap the OBJ_TYP of the AWKEY from BKPFF to HRPAY sounds strange to me and I am unclear about the purpose. There are many other fields available to indicate the source of the document. (BKPF-XBLNR).
    Another approach would be to check if any exit exists for this BAPI thru which you can manipulate the OBJ_TYP:
    [User exit for BAPI_ACC_DOCUMENT_POST..? |User exit for BAPI_ACC_DOCUMENT_POST..?;
    Regards,
    Robert

  • Error in BAPI_ACC_DOCUMENT_POST

    Hello,
    I am trying to use the bapi in the subject following other post on the sdn, but I get this error message:
    Error in document:  200111 AC_DOC_NO
    E
    Required field OBJ_TYPE was not transferred in parameter DOCUMENTHEADER
    E
    Required field OBJ_KEY was not transferred in parameter DOCUMENTHEADER
    E
    Required field OBJ_SYS was not transferred in parameter DOCUMENTHEADER
    I think I have to initialize some fields, but I don't know how.
    Can anybody pleas help me or explain me what is missing and how can I fix it?
    thanks in advance
    Gabriele

    data:
    obj_type like bapiache02-obj_type,
    obj_key like bapiache02-obj_key,
    obj_sys like bapiache02-obj_sys,
    documentheader like bapiache08,
    accountgl like bapiacgl08
    occurs 0 with header line,
    currencyamount like bapiaccr08
    occurs 0 with header line,
    return like bapiret2
    occurs 0 with header line,
    extension1 like bapiextc
    occurs 0 with header line,
    t_edidd like edidd occurs 0 with header line,
    bapi_retn_info like bapiret2 occurs 0 with header line.
    data: error_flag.
    documentheader-username = sy-uname.
    documentheader-header_txt = 'Test using BAPI'.
    documentheader-comp_code = '1000'.
    documentheader-doc_date = sy-datum.
    documentheader-pstng_date = sy-datum.
    documentheader-doc_type = 'SA'.
    accountgl-itemno_acc = '1'.
    accountgl-gl_account = '0000160100'.
    accountgl-comp_code = '1000'.
    accountgl-pstng_date = sy-datum.
    accountgl-doc_type = 'SA'.
    accountgl-profit_ctr = '0000010000'.
    append accountgl.
    accountgl-itemno_acc = '2'.
    accountgl-gl_account = '0000160100'.
    accountgl-comp_code = '1000'.
    accountgl-pstng_date = sy-datum.
    accountgl-doc_type = 'SA'.
    accountgl-profit_ctr = '0000010000'.
    append accountgl.
    currencyamount-itemno_acc = '1'.
    currencyamount-currency = 'GBP'.
    currencyamount-amt_doccur = '100.00'.
    append currencyamount.
    currencyamount-itemno_acc = '2'.
    currencyamount-currency = 'GBP'.
    currencyamount-amt_doccur = '-100.00'.
    append currencyamount.
    * call BAPI-function in this system *
    call function 'BAPI_ACC_GL_POSTING_POST'
    exporting
    documentheader = documentheader
    * importing
    * obj_type = obj_type
    * obj_key = obj_key
    * obj_sys = obj_sys
    tables
    accountgl = accountgl
    currencyamount = currencyamount
    return = return
    extension1 = extension1
    exceptions
    others = 1.
    if sy-subrc <> 0.
    message e999(re) with 'Problem occured'.
    else.
    loop at return.
    if not return is initial.
    clear bapi_retn_info.
    move-corresponding return to bapi_retn_info.
    if return-type = 'A' or return-type = 'E'.
    error_flag = 'X'.
    endif.
    append bapi_retn_info.
    endif.
    endloop.
    if error_flag = 'X'.
    message e999(re) with 'Problem occured'.
    rollback work.
    else.
    commit work.
    endif.
    endif.
    source: http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bapi_acc_document_post-622561

Maybe you are looking for

  • Print Booklet suddenly not working properly

    I am working with InDesign CS3 in OS X 10.5. Up until this week, the Print Booklet function always worked fine for me (I only use it for generating PDFs with printer spreads). Now, however, files that printed properly in the past are generating PDFs

  • Select-options on Dynpro?

    Hi colleagues, I am just asking me if there is a chance to get select-options on my Dynpro like we use it in the report programming. Sure I can develop it manually, but it would be much easier to have a "select-options" statement on the dynpro side w

  • Why i have to go only for sap

    hi, experts why only sap? what is the difference between other? what are the main advantages in sap? i am very in need of these questions, could you please explain me. kindly thanks to all for spending yours valuable time.

  • How do i delet alout of music

    hey am new to havinf a ipod or mp3 player of any kind. i got the ipod form my brother wen he got somthing newer. i dount care for all his music  so i wanted to  dlelet alout of his old  music form it i know how to do it one song at  time but is a rea

  • What is the magic behind "recent files"?

    Hello, Usually file managers have implemented the feature to list and show recent files for quick navigation and finding. But what does "recent" exactly mean? Recently used, modified or created? I am asking because from my experience it only shows re