Problem in BAPI_ACC_DOCUMENT_POST

Hai,
   I am trying to post the documents using this BAPI(bapi_acc_document_post). it is throwing error
  FI/CO interface: Inconsistent FI/CO line item data for updating  
  Error in document: BKPFF $ RD2520LS
this error is coming only after applying the patch sp13.
what could be the problem...
pls suggest with any ideas...

Hi,
dont pass any values to obj_key,obj_sys,obj_type fields,if u r doing it.
the error may be because u r passing more than required lines to glaccount and accountrecivable or accountpayable tables whatever u r using.
i suppose u r entering a vendor details,
then give item_no 1 in accountpayable and 2,3,4 etc in glaccount tables.
mention all in currencyamount table as 1,2,3,4 etc..and give negative values in 'amount' for credit entries.
post in detail about more doubts.
regards
Arjun

Similar Messages

  • The typical problem with BAPI_ACC_DOCUMENT_POST

    Hi all!
    Just my first post in the forum.
    I'm using the BAPI_ACC_DOCUMENT_POST to generate an accountable document. As I've seen with a lot of people, the bapi is succesfully executed, but no doc. is created.
    Can anyone have a look on my code and try to guide me through the right way to have my doc?
    --- doc_head TYPE BAPIACHE09 ---
    doc_head-obj_type   = 'BKPFF'.
    CONCATENATE SY-SYSID 'CLNT' SY-MANDT INTO
                          DOC_HEAD-OBJ_SYS.
    doc_head-obj_key    =  '$'.
    doc_head-COMP_CODE  = P_BUKRS.
    doc_head-DOC_TYPE   = 'SA'.
    doc_head-PSTNG_DATE = P_BUDAT.
    doc_head-FISC_YEAR  = sy-datum(4). "Periodo liquidación
    doc_head-FIS_PERIOD = sy-datum+4(2).
    doc_head-USERNAME   = SY-UNAME.
    doc_head-DOC_DATE   = sy-datum.
    doc_head-BUS_ACT    = 'RFBU'.
    --- w_bseg TYPE TABLE OF BAPIACGL09 ---
    --- t_cur_am TYPE TABLE OF BAPIACCR09 ---
    w_bseg-ITEMNO_ACC = '0001'.
    w_bseg-GL_ACCOUNT = '0006230000'.
    w_bseg-ALLOC_NMBR = P_REF.
    w_bseg-stat_con   = 'S'.
    w_bseg-COSTCENTER = P_COST_CENTER.
    w_bseg-TAX_CODE = 'S0'.
    APPEND w_bseg.
    CLEAR w_bseg-COSTCENTER.
    t_cur_am-ITEMNO_ACC = '0001'.
    t_cur_am-CURRENCY   = 'EUR'.
    t_cur_am-AMT_DOCCUR = '100'.
    APPEND t_cur_am.
    w_bseg-ITEMNO_ACC = '0002'.
    w_bseg-ITEM_TEXT  = TEXT-001.
    w_bseg-GL_ACCOUNT = '0004000900'.
    w_bseg-ALLOC_NMBR = P_TEXT.
    w_bseg-stat_con   = 'H'.
    APPEND w_bseg.
    Llenar importes
    t_cur_am-ITEMNO_ACC = '0002'.
    t_cur_am-CURRENCY   = 'EUR'.
    t_cur_am-AMT_DOCCUR = '100'.
    APPEND t_cur_am.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        DOCUMENTHEADER          = doc_head
      CUSTOMERCPD             =
      CONTRACTHEADER          =
      IMPORTING
        OBJ_TYPE                = obj_type
        OBJ_KEY                 = obj_key
        OBJ_SYS                 = obj_sys
      TABLES
        ACCOUNTGL               = w_bseg
       ACCOUNTRECEIVABLE       =
      ACCOUNTPAYABLE           =
       ACCOUNTTAX              =
        CURRENCYAMOUNT          = t_cur_am
      CRITERIA                 =
      VALUEFIELD               =
      EXTENSION1               =
        RETURN                  = t_ret
      PAYMENTCARD              =
      CONTRACTITEM             =
      EXTENSION2               =
      REALESTATE               =
    b_wait = 'X'.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        WAIT          = b_wait
      IMPORTING
        RETURN        = b_ret.
    I get my "Document XXXXXXXXXX was Successfully created" but no BKPF record is created on the database. Any ideas?
    Thank you very much!
    Message was edited by: Angel Garcia

    Hi Angel,
    1. U code must be absolutely right.
    2. The problem is with this general bapi.
    3. I also faced the same problem,
       but there is no solution for this
        on SDN.
    4. After posting the bapi, (also using commit)
       the message says, Docuement xXX created,
      but actually there is no document
       in tables.
    5. Even the Number Range is incremented,
       but no document.
    6. Its really a mystery for me.
    regards,
    amit m.

  • Question/Problem with BAPI_ACC_DOCUMENT_POST in TAXACCOUNT with TAX_CODE

    Hi all:
    I've got a problem when I use bapi BAPI_ACC_DOCUMENT_POST.
    The vendor accounts with general leader accounts associated are implemented in the position of table ACCOUNTPAYABLE and the general leader accounts go to table GLACCOUNT.
    Refering to positions with vendor number I introduce the Special G/L Indicator and after this i execute bapi.
    It is said I have to put the TAX_CODE in tabla TAXACCOUNT and the field AMT_BASE in table CURRENCYAMOUNT.
    But when I use transaction FB01  to cread fi documents in vendor positions I don't
    have obligation to introduce the TAX_CODE and afterwards I look for the document in table bseg. I can watch the field MWSKZ is blank.
    Another question : I think I can find the amt_base in currency amount with the function: CALCULATE_TAX_FROM_NET_AMOUNT
    Thanks a lot. Points in advance.

    I've resolved the question.
    It depends of the special gl indicator. If it is 8 or H it doesn't need to be introduced the table taxaccount.

  • Posting period problem in BAPI_ACC_DOCUMENT_POST

    I am using BAPI_ACC_DOCUMENT_POST to post documents for AR.It works fine in all the scenarios except when 2 posting periods are open.The previous posting period is open till 1st week of next month.I want to post in the 1st week for the previous posting period.I get the error
    period 05 is not allowed.Is there any value i need to pass
    to the function module.Please help.The normal fb01 does post to the previous period.

    Hi,
    BAPI will return if period is not open like this.
    'perios 04 2006 is not open for posting'.
    but your error message is period 05 is not allowed. please check the date that you are passing and check the year that you are passing to it.
    If not get period and year using the FM 'FI_PERIOD_DETERMINE' and pass this year and period to it.
    Thanks.

  • BAPI_ACC_DOCUMENT_POST Profit Center Auto-Populated.

    Hi Experts,
    I need to create fi documents trought BAI_ACC_DOCUMENT_POST, the documents contains FM relations on RES_DOC and The position, the functional consultor tolls me that the respective profit center is populated automatically, but i receiving an error telling me that i need to inclue the profit center, so, this is telling me that is not pupulated by the bapi. Any Suggestions?.
    Thanks in advance,
    Steve.

    Hi Steve,
    You can check the Function module documentation.
    Please check the below links for sample code of this BAPI.
    BAPI_ACC_DOCUMENT_POST having error message RW 609
    Re: Error in BAPI_ACC_DOCUMENT_POST to post Special GL transactions
    Re: BAPI  BAPI_ACC_DOCUMENT_POST
    BAPI_ACC_DOCUMENT_POST not generating accounting document
    Re: Tax problem in BAPI_ACC_DOCUMENT_POST >Help
    Thanks.

  • Problem in Coding Block during the Acc Doc posting BAPI_ACC_DOCUMENT_POST

    Hi,
    I have a problem in the Coding Block of a FI invoice Document posting. In our project, we have implemented substitutions to derive SBL;SEGMENT field in the line item of a GL Account.
    I have created a program and in that i'm using BAPI_ACC_DOCUMENT_POST for posting the Accounting Document. During this BAPI call, it is not deriving the values of SBL and SEGMENT.
    But, when i'm posting through transaction FB01; the substitutions are getting triggered and finally values are being derived.
    Can anyone help on this as to why these values were not derived when it is being called through BAPI_ACC_DOCUMENT_POST. For COBL; is it really possible to post through this BAPI or something more has to be done.
    Very urjunt !!! Please
    Awaiting your valuable answers.
    Thanks
    Rohith

    Hi Rohith,
    to populate correctly the profit. Segment you should fill in the information used in derivation inside the BAPI CRITERIA table structure.
    In the below example the profit. Segment is derived from Sales Org. (VKORG) and Distribution Channel (VTWEG).
      Fill CRITERIA for CO-PA (Profitability Segment)
        REFRESH lt_criteria.
        wa_criteria-itemno_acc = lv_itemno_acc.
        wa_criteria-fieldname  = 'VKORG'.
        wa_criteria-character  = '1080'.
        APPEND wa_criteria TO lt_criteria.
        wa_criteria-itemno_acc = lv_itemno_acc.
        wa_criteria-fieldname  = 'VTWEG'.
        wa_criteria-character  = '01'.
        APPEND wa_criteria TO lt_criteria.
    If you need further information, please post your doubts here.
    Regards,
    Antonio
    Edited by: indetony on Sep 9, 2011 12:46 AM

  • BAPI_ACC_DOCUMENT_POST problem in header text(bktxt)

    Hi experts,
               Am using bapi  BAPI_ACC_DOCUMENT_POST for gl upload for t-code f-02. the problem is header text(bktxt) is not uploading in fb03. how to solve this problem??
    Regards,
    Sunita.

    Because BAPI: BAPI_ACC_DOCUMENT_POST will Check BADI with Posting
    1.BADI Information:
    (1)Object Type Name(Interface) is IF_EX_AC_DOCUMENT (T-code: SE24)
    (2)Method: CHANGE_INITIAL & CHANGE_AFTER_CHECK
    2.Reason:
    (1)Once This BADI has been created for any reason,
        BAPI:BAPI_ACC_DOCUMENT_CHECK & BAPI_ACC_DOCUMENT_POST
        will check it for Document Header Text
    (2)If Method: CHANGE_INITIAL & CHANGE_AFTER_CHECK has been created for any reason,
        but Creator return an null Document Header Text, then BAPI will clear Document Header Text
    3.Solution:
    (1)Add source code into Method: CHANGE_INITIAL & CHANGE_AFTER_CHECK,
        please refer to (2) for detail source code below
    (2)
      DATA: wa_header TYPE acchd.
      IF sy-xprog EQ 'SAPLBPFC'.
    *---<SAPLBPFC> is for Posting     with BAPI: BAPI_ACC_DOCUMENT_CHECK
    *---<SAPMSSY1> is for Test(Check) with BAPI: BAPI_ACC_DOCUMENT_POST
        CLEAR wa_header.
        wa_header = im_document-header.
        ex_document-header-bktxt = wa_header-bktxt.
        CLEAR wa_header.
      ENDIF.

  • Unsolved  BAPI_ACC_DOCUMENT_POST...problem!!!!

    Hi gurus,
    I am posting this problem of mine for the third time, but I have got any reply to my previous postings, I don't know wheter the my problem is too difficult or its not an appropriate one to ask. Can someone pleaase reply this time to my problem so that I can proceed into my development, I will really appreciate your efforts.
    I am working on an interface where I need to post an accounting document using
    f-43 and for this I have identified this bapi 'BAPI_ACC_DOCUMENT_POST', and I have written the following code. everything is working properly but the only problem is, the posting keys I am using are 31 and 40 but when I run my program and look into the document created, it shows me the posting keys as 40 and 50 instead of 31 and 40, can you please tell me how to get rid of this thing .
    v_semfile = p_ifname.
    refresh it_input_file.
    call function 'WS_UPLOAD'
    EXPORTING
    filename = v_semfile
    filetype = 'DAT'
    TABLES
    data_tab = it_input
    EXCEPTIONS
    conversion_error = 1
    file_open_error = 2
    file_read_error = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    others = 10.
    move:
    'RFBU' to documentheader-bus_act,
    it_input-doc_date2 to documentheader-doc_date,
    it_input-pos_date2 to documentheader-pstng_date,
    it_inputdoc_type to documentheader-doc_type,
    it_inputbukrs to documentheader-comp_code,
    it_input-pos_per to documentheader-fis_period,
    it_input-fis_year to documentheader-fisc_year,
    it_input-reference to documentheader-ref_doc_no,
    it_input-h_text to documentheader-header_txt,
    syst-uname to documentheader-username.
    if it_input_file-pos_key eq 31.
    move:
    v_count to glaccount-ITEMNO_ACC,
    it_input-glaccount to glaccount-gl_account,
    it_input-kostl to glaccount-COSTCENTER,
    it_input-prctr to glaccount-PROFIT_CTR,
    it_input-bus_area to glaccount-bus_area,
    it_input-item_text to glaccount-ITEM_TEXT,
    it_input-assignment to glaccount-ALLOC_NMBR.
    append glaccount.
    move:
    v_count to currencyamount-ITEMNO_ACC,
    it_input-currency to currencyamount-CURRENCY,
    it_input-amount to currencyamount-AMT_DOCCUR .
    append currencyamount.
    clear: glaccount, currencyamount.
    else.
    move: v_count to glaccount-ITEMNO_ACC,
    it_input-glaccount to glaccount-gl_account,
    it_input-kostl to glaccount-COSTCENTER,
    it_input-prctr to glaccount-PROFIT_CTR,
    it_input-bus_area to glaccount-bus_area,
    it_input-item_text to glaccount-ITEM_TEXT,
    it_input-assignment to glaccount-ALLOC_NMBR.
    append glaccount.
    move:
    v_count to currencyamount-ITEMNO_ACC,
    it_input-currency to currencyamount-CURRENCY.
    currencyamount-AMT_DOCCUR = it_input-amount * -1.
    append currencyamount.
    clear: glaccount, currencyamount.
    endif.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
    EXPORTING
    DOCUMENTHEADER = documentheader
    IMPORTING
    OBJ_TYPE = obj_type
    OBJ_KEY = obj_key
    OBJ_SYS = obj_sys
    TABLES
    ACCOUNTGL = glaccount
    ACCOUNTPAYABLE = ap
    CURRENCYAMOUNT = currencyamount
    RETURN = return.
    read table return with key type = 'S'.
    if syst-subrc eq 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT =
    IMPORTING
    RETURN = return2.
    Thanks
    Rajeev....

    Rajeev,
    for the vendor line you have to add a vendor number and not a G/L account number (SAP will know the G/L behind the vendor and will take care about that). If posting key 31 was specified that is a vendor posting and you need a vendor number for that, so you should go back to functional guys and ask them what kind of posting they want in fact.
    Some info about posting keys:
    01-09 and 11-19 : customer
    21-29 and 31-39 : vendor
    40 and 50 : G/L
    Come back if you still have questions!
    ec

  • Problem in creating an account document using BAPI_ACC_DOCUMENT_POST

    Hi Experts,
    I have a porblem while creating an account document from BAPI_ACC_DOCUMENT_POST.
    The problem is acc document is geeting posted and I am getting an document number for that bapi, but its not getting saved to data base and I am getting the following error message
    "Document 1900004327 3000 does not exist in fiscal year 2005
    Message no. F5A397
    System Response
    The required document either does not exist in the fiscal year or is still being posted.
    When the document is read, archived documents are also considered."
    Please sugggest...
    We are using ECC 6.0
    Thanks,
    Suma.

    Hi,
    this means that the posting is not open...
    try with 2008...
    or else ask ur financial consultatto check, whether the 2005 is open or not.
    u also try posting manually using FB01 with same entries u r using for this BAPI...so that u can track the error.
    Also use BAPI_TRAACTION_COMMIT after bapi post.
    check ur subsystem which u r passing for the BAPI..
    wa_general-assetsubno = '0000'. Is it 3000 or 0000
    Try using 0...
    Edited by: Sumi Vasu on May 14, 2008 8:13 AM

  • Problems in Posting an Accounting Document using BAPI_ACC_DOCUMENT_POST

    Hi All,
    I am facing a problem when I try to post an accounting document using the BAPI "BAPI_ACC_DOCUMENT_POST".
    While passing data to the structure "ACCOUNTTAX", I get the errors "Required field AMT_BASE was not transferred in parameter CURRENCYAMOUNT" and "Required field TAX_CODE was not transferred in parameter ACCOUNTTAX".
    Till now I was not passing the ACCOUNTTAX structure to the BAPI and posting was happening fine.
    Any pointers / solutions in this direction will be most helpful.
    Thanks in advance.
    Regards,
    Keerthi

    Hi
      As u told earlier it was fine , so it may there is some config. change done by func. so this error is coming.
      For minimum required fields fo BAPI , u can go to SE37 and click on Function Module Documentation on Application tool bar.
    here u will find good help.
    Regards
    Sachin

  • Problem in G/L posting using BAPI_ACC_DOCUMENT_POST

    Hi all,
    I have one requirement in interface, using BAPI. Uploading the flat file USING BAPI (BAPI_ACC_DOCUMENT_POST)
    my flat file is available given below.
    sl.no
    Document Date
    Document Type
    Company Code
    Posting date
    Period
    Currency
    Reference
    Doc Header Text
    Line Item 1
    Account
    Amount
    Cost Centre
    Profit Centre
    Text
    1
    08/21/2014
    SA
    1000
    08/21/2014
    09
    CUR
    TEST
    TEST
    1
    100
    500.00
    0001
    Test
    1
    CUR
    2
    200
    -500.00
    0001
    Test
    2
    08/21/2014
    SA
    1000
    08/21/2014
    09
    CUR
    TEST
    TEST
    1
    100
    500.00
    0002
    Test
    2
    CUR
    2
    200
    -100.00
    0002
    Test
    2
    CUR
    3
    200
    -100.00
    0002
    Test
    2
    CUR
    4
    200
    -100.00
    0002
    Test
    2
    CUR
    5
    200
    -100.00
    0002
    Test
    2
    CUR
    6
    200
    -100.00
    0002
    Test
    actually my requirement is , first time uploaded my data in ECC using BAPI (BAPI_ACC_DOCUMENT_POST). DOCUMENT no is created in BKPF table. again i've uploaded to same data using bapi.. again document no is created . but i don't need create document no in bkpf( when i'll upload 2nd time or more) in this case, i want to display error message 'this flat file already used'.
    please give the solution fo this requirement. it's very urgent.

    Hi
    The main parameters of BAPI BAPI_ACC_DOCUMENT_POST are:
    - DOCUMENTHEADER (BAPIACHE09) to transfer the header data
    - ACCOUNTGL (BAPIACGL09) to transfer the g/l item data
    - ACCOUNTRECEIVABLE (BAPIACAR09) to transfer the  customer item data
    - ACCOUNTPAYABLE (BAPIACAP09) to transfer the vendor item data
    So u need to use one of parameters above to transfer the header and item data, the amount data for every item have to be transfered by parameters CURRENCYAMOUNT
    U should also considere the posting key is automatically set by BAPI, and it depends on the item type and the sign of amount:
    - 40/50 for G/l
    - 01/11 for customer
    - 21/31 for vendor
    1 40 617300     Mileage              0000310148                            310148               27.20
    2 40 617900     Entertainment Exp.   0000310148                         V1 310148              177.26
    3 40 144000     Input-VAT            20090925                           V4                      34.74
    4 31 1019186    B.E.N. MR SAUVAT                                        V1                     239.20-
    Lines 1/2 data move to ACCOUNTGL and  CURRENCYAMOUNT
    Line   4   data move  to ACCOUNTPAYABLE and CURRENCYAMOUNT
    The line 3 seems to be a TAX line, in this case u need to use ACCOUNTTAX and CURRENCYAMOUNT
    The header data to be transfered to DOCUMENTHEADER
    Max

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

  • Problem in Posting a document using BAPI_ACC_DOCUMENT_POST

    Hi,,
    I am using the function module "BAPI_ACC_DOCUMENT_POST" to post a vendor Invoice (KR). i think the t-code to post this is FV60.when i post the document, the document number is getting generated but amount is missing  in t-code fbv3 but bseg table is getting updated properly. Can any one help the actual input to be given to create a document and tax
    Regards

    I have a suggestion:
    Try to post this kind of document (KR) with transaction code FB01. If you can see the document correctly with FBV3 transaction, then you can use BAPI you mention.
    The following function modules may be useful for calculating taxes:
    CALCULATE_TAX_FROM_NET_AMOUNT
    CALCULATE_TAX_FROM_GROSSAMOUNT
    Regards.
    Rafael Rojas.

  • Problem in Document parking through BAPI_ACC_DOCUMENT_POST

    Hi,
       I am trying to park the document using FM BAPI_ACC_DOCUMENT_POST or FM BAPI_ACC_GL_POSTING_POST.
    Here I am making use of the BADI ACC_DOCUMENT to pass the value '2' to C_ACCHD-STATUS_NEW ( C_ACCHD-STATUS_NEW = '2')  by which it should actually park the document.The process is successfull where i am getting the message like "document posted successfully "  and document number generated but I could not see the document through FBV1 or FB01. Can anyone please through some light on this. Thanks in Advance.

    Hi Sarath,
    I have done this let me tell you the approach.
    Step 1: you should implement the BTE RWBAPI01.
    Step 2: Pass value '2' to DOCUMENT_HEADER-STATUS_NEW of the changing parameter of BTE. Now the document will get parked successfully. Please find the sample code.
    TABLES: bsik.
      DATA: w_doc_header        TYPE bapiache09,
            t_accountreceivable TYPE TABLE OF  bapiacar09,
            w_accountreceivable TYPE   bapiacar09,
            t_accountpayable    TYPE TABLE OF   bapiacap09,
            w_accountpayable    TYPE    bapiacap09,
            t_accounttax        TYPE TABLE OF   bapiactx09,
            w_accounttax        TYPE  bapiactx09,
            t_currencyamount    TYPE TABLE OF bapiaccr09,
            w_currencyamount    TYPE  bapiaccr09,
            t_extension2        TYPE TABLE OF   bapiparex,
            w_extension2        TYPE  bapiparex,
            t_extension1        TYPE TABLE OF   bapiacextc,
            w_extension1        TYPE    bapiacextc,
            t_accountgl         TYPE TABLE OF bapiacgl09,
            w_accountgl         TYPE  bapiacgl09,
            w_accountgl_1       TYPE  bapiacgl09,
            t_return            TYPE TABLE OF bapiret2,
            w_lineitems         TYPE zst_vendor_items,
            w_return            TYPE bapiret2,
            l_amount            TYPE char18,
            t_bsik              TYPE TABLE OF bsik,
            w_bsik              TYPE  bsik,
            l_dmbtrp            TYPE bapidmbtr,
    *        l_result            TYPE bapidmbtr,
            l_dmbtrn            TYPE bapidmbtr,
            l_result            TYPE bapidmbtr,
            lv_type             TYPE bapiache09-obj_type,
            lv_key              TYPE bapiache09-obj_key,
            lv_sys              TYPE bapiache09-obj_sys,
            l_fiyrs             TYPE budat,
            l_fiyrt             TYPE allgstid,
            l_index             TYPE sy-index,
            l_belnr             TYPE belnr_d,
            l_datum             TYPE bapi3007-key_date,
            l_message           TYPE char20,
            l_postingdate       TYPE budat,
            l_docdate           TYPE budat,
            l_glacno            TYPE hkont,
            lv_pos              TYPE posnr_acc,
            l_lifnr             TYPE lifnr VALUE '10089',
            l_counter           TYPE posnr_acc VALUE '0000000001',
            l_costcenter        TYPE kostl,
            l_date              TYPE char2,
            l_month             TYPE char2,
            l_year              TYPE char4.
    *---Fill GL details-----*
      CLEAR: w_accountgl,w_doc_header,w_accountpayable,
      w_currencyamount, l_dmbtrp,l_dmbtrn,lv_type,lv_key,lv_sys,
      e_message,w_lineitems,l_year,l_month,l_date.
      REFRESH: t_accountgl[],t_accountpayable[],t_currencyamount[],
               t_extension1[],t_return[].
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = i_vendor
        IMPORTING
          output = l_lifnr.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = w_lineitems-glacno
        IMPORTING
          output = l_glacno.
      SPLIT i_postingdate AT '-' INTO l_year l_month l_date.
      CONCATENATE l_year l_month l_date INTO l_postingdate.
    *  l_postingdate = i_postingdate.
      CLEAR: l_year,l_month,l_date.
      SPLIT i_docdate AT '-' INTO l_year l_month l_date.
      CONCATENATE l_year l_month l_date INTO l_docdate.
    *  l_docdate     = i_docdate.
    *---Fill Header details-----*
      w_doc_header-bus_act    = 'RFBU'."'RMRP'.
      w_doc_header-obj_type   = 'BKPFF'."'REACI'."'VBRK'.
      w_doc_header-obj_key    = '$'.
      w_doc_header-obj_sys    = 'T90CLNT090'.
      w_doc_header-username   = sy-uname.
      w_doc_header-header_txt = i_hdrtext."'Vendor Invoice '.
      w_doc_header-comp_code  = i_compcode."'3000'."p_bukrs.
      w_doc_header-doc_date   = l_docdate.
      w_doc_header-pstng_date = l_postingdate." l_postingdate.
      w_doc_header-doc_type   = i_doctype."'KR'.
      w_doc_header-ref_doc_no = i_reference."'KR'.
    *---Fill Vendor details---------*
      w_accountpayable-itemno_acc  = '0000000001'.
      w_accountpayable-vendor_no   = l_lifnr.
      w_accountpayable-comp_code   = i_compcode."'3000'."p_bukrs.
      w_accountpayable-pymt_meth   = i_payment_method."'T'.
      w_accountpayable-pmnttrms    =  '0002'.
      APPEND w_accountpayable TO t_accountpayable.
    *------Segregating Positive and Negative Amounts---------------------*
      w_currencyamount-itemno_acc   = '0000000001'.  " gl accou +ve 40
      w_currencyamount-currency_iso = i_currency."'USD'.
      w_currencyamount-amt_doccur   = i_amount * -1."500.
      APPEND w_currencyamount TO t_currencyamount.
      w_extension1-field1       = '000000000131'.  "gl psokey
      APPEND w_extension1 TO t_extension1.
      LOOP AT t_lineitems INTO w_lineitems.
        CLEAR: w_accountgl,w_accountgl_1,l_costcenter.
        l_counter = l_counter + 1.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = w_lineitems-glacno
          IMPORTING
            output = l_glacno.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = w_lineitems-costcenter
          IMPORTING
            output = l_costcenter.
        w_accountgl-itemno_acc      = l_counter."'0000000001'.
        w_accountgl-gl_account      = l_glacno."'0000113100'.
        w_accountgl-item_text       = i_hdrtext."'Test'.
        w_accountgl-comp_code       = i_compcode."'3000'."p_bukrs.
        w_accountgl-value_date      = l_postingdate.
        w_accountgl-pstng_date      = l_postingdate.
        w_accountgl-doc_type        = i_doctype."'KR'.
        w_accountgl-segment         = w_lineitems-segment."'SERV'.
        w_accountgl-partner_segment = w_lineitems-partnerseg.
        w_accountgl-cs_trans_t      = w_lineitems-transtype.
        w_accountgl-costcenter      = l_costcenter."'0000000328'.
        w_accountgl-fis_period      = l_postingdate+4(2).
        w_accountgl-fisc_year       = l_postingdate+0(4).
        APPEND  w_accountgl TO t_accountgl.
        IF w_lineitems-credit   = 'H'.
          w_currencyamount-itemno_acc   = l_counter."'0000000002'.
          w_currencyamount-currency_iso = i_currency."'USD'.
          w_currencyamount-amt_doccur   =  -1 * w_lineitems-amount. "500.  " vendor -ve 31
          APPEND w_currencyamount TO t_currencyamount.
          CONCATENATE l_counter '50' INTO w_extension1-field1 .
          APPEND w_extension1 TO t_extension1.
        ELSE.
          w_currencyamount-itemno_acc   = l_counter."'0000000002'.
          w_currencyamount-currency_iso = i_currency."'USD'.
          w_currencyamount-amt_doccur   =  1 * w_lineitems-amount. "500.  " vendor -ve 31
          APPEND w_currencyamount TO t_currencyamount.
          CONCATENATE l_counter '40' INTO w_extension1-field1 .
          APPEND w_extension1 TO t_extension1.
        ENDIF.
        CLEAR :   w_currencyamount,w_lineitems,w_accountgl.
      ENDLOOP.
    *  w_extension1-field1 = 'PARK' .
    *  APPEND w_extension1 TO t_extension1.
      CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
        EXPORTING
          documentheader = w_doc_header
        TABLES
          accountgl      = t_accountgl
          accountpayable = t_accountpayable
          currencyamount = t_currencyamount
          extension1     = t_extension1
          return         = t_return.
      REFRESH: t_return[].
      CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
        EXPORTING
          documentheader = w_doc_header
        IMPORTING
          obj_type       = lv_type
          obj_key        = lv_key
          obj_sys        = lv_sys
        TABLES
          accountgl      = t_accountgl
          accountpayable = t_accountpayable
          currencyamount = t_currencyamount
          extension1     = t_extension1
          return         = t_return.
      READ TABLE t_return INTO w_return WITH KEY type = 'E'.
      IF sy-subrc <> 0.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        CLEAR: l_message.
        CONCATENATE 'Vendor Invoice'  lv_key+0(10) 'Created' INTO e_message
        SEPARATED BY ''.
      ELSE.
        READ TABLE t_return INTO w_return INDEX 2.
        e_message = w_return-message.
      ENDIF.

  • BAPI_ACC_DOCUMENT_POST- Cross Company-Code Posting problem

    Hi,
    I am using BAPI_ACC_DOCUMENT_POST in a program to post a GL document.
    The program works fine for single company code posting.
    For <b>cross company-code posting</b>, i.e. when my upload file contain more
    than 3 company code,
    The document gets posted and uploaded in SAP but the posting result i.e
    for clearing accounts is incorrect.(clearing accounts of post in company is not generated)
    FYI, There is <i>no error message returned from BAPI</i>.
    Am I possible to do this with bapi, so I have to split my doc and post
    it pro company code?
    Thanks in advance.
    Best Regards,
    Hikaruno

    Hi,
    It seems the G/L account is a reconcillation account..Try with another G/L account and see.
    Regards,
    Nagaraj

Maybe you are looking for

  • Query is too large

    Hi, Can any one give me the solution to develop this report. I have 12 columns under each vertical.Like that i have 12 verticals for my Gross margin Report. Then 12* 12=144 coloumns.total are 144. But in Bi-Bex it will allow only limited columns. Whe

  • BT Openzone showing from my Home Hub

    My PC is picking up 3 services apparently coming from my router: My BB service My BT Fon service - I undertand this A BT Openzone service - I don't understand this. I'm sure they're all from my router as the signal strength is precisely the same. Can

  • ? with a Vector of LinkedLists

    Hi, I would like to create a Vector. Each element will be a LinkedList. Each element in my LinkedList will be an Object, call it o. Obejcts like o have a member field called time, which is a BigDecimal. I am doing this because I want each LinkedList

  • Config to display web browser query result ?

    Hi all, I'm a newbie on BW, I'd like to know how can I get my query executed in the I.E. browser ? I use the "query designer" and after saving the query when I execute it using "display query on the Web" button, the browser appears with a blank page

  • Command Center Crashes When Launched

    MS-7738 /  Bios 3.7  / Windows 7 When I run the command center v1.0.0.65 the screen loads, I see the GUI, then windows error message appears "commandcenter has stopped working" Have tried uninstall, re-install of command center and also same for .Net