Vendor invoice creation using BAPI BAPI_ACC_DOCUMENT_POST

Hi,
I am trying to create vendor invoice(FB60) using BAPI_ACC_DOCUMENT_POST.
Could anyone please let me know what all mandatory fields we have to pass in vendor item and header to create this ?
Regards,
Anubhuti Pandey

Hi,
Please call the FM BAPI_ACC_DOCUMENT_POST and try with the following parameters:
Function module to post the accounting document
      CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'           
"      EXPORTING
          documentheader    = w_documentheader                                          
"      TABLES
          accountgl               = i_accountgl
          accountreceivable = i_accountreceivable
          accountpayable     = i_accountpayable
          currencyamount    = i_currencyamount
          return                     = i_return
          contractitem           = i_contractitem.
The required fields in the header document:
    w_documentheader-bus_act    
    w_documentheader-username    = sy-uname.                                             "Username
    w_documentheader-header_txt 
    w_documentheader-comp_code 
    w_documentheader-doc_date  
    w_documentheader-pstng_date  = sy-datum. 
    w_documentheader-trans_date                                 " Transaction date value as per document date
    w_documentheader-fisc_year   = sy-datum(4).      
    w_documentheader-doc_type      
Pass the necessary information in the account GL and accounts payable.
I hope this helps you in some way.

Similar Messages

  • Problem in  vendor invoice creation through BAPI

    I am trying to create vendor invoice using bapi_acc_document_post but what value have be passed to obj_key and obj_typ fields of header is not clear to me.
    regards,
    anu

    Hi,
    Don't pass any values to OBJ_TYPE,OBJ_KEY.  Many threads are available in SDN regarding this BAPI.
    Search SDN to get more details.
    Regards
    Vinod

  • Creating Vendor Credit Memo Using BAPI  BAPI_ACC_DOCUMENT_POST

    Hi,
    I want to create a vendor credit memo using the bapi BAPI_ACC_DOCUMENT_POST but with posting keys as 21 and 50.Is it possible to do so.I tested the bapi passing the data to the accountgl table.Do i have to pass data to another table ?

    hi Eric,
    I even tried passing the data to the accounts receivable and accounts payable tables passing the GL account no in these tables.Still teh document get posted with keys 40 and 50.Also the credit entries should be assigned to COPA segment of sales order/item.
    The vendor credit memo should look as follows look as follows:
    Dr Vendor (PK = 21) $ 35,000
    Cr Freight expense account (PK = 50) $ 10,000……….assigned to COPA segment of sales order/ item 20000397/10
    Cr Freight expense account (PK = 50) $ 5,000……….assigned to COPA segment of sales order/ item 20000397/20
    Cr Freight expense account (PK = 50) $ 20,000……….assigned to COPA segment of sales order/ item 20000398/10

  • Error in invoice creation using BAPI BAPI_INCOMINGINVOICE_CREATE

    Hi All,
    I am using BAPI_INCOMINGINVOICE_CREATE to create an invoice using below data,
    wa_header-invoice_ind = 'X'.
    wa_header-doc_date = sy-datum.   "Enter the document date
    wa_header-pstng_date = sy-datum. "Enter the posting date
    wa_header-ref_doc_no = 'Test'.
    wa_header-comp_code = 'L110'.
    wa_header-gross_amount = '528.2400'.  "Enter the gross amount(aft. tax) for the invoice
    wa_header-calc_tax_ind = 'X'.
    wa_header-currency = 'USD'.
    wa_item-invoice_doc_item = '000001'.
    wa_item-po_number = '4600013733'.    "Enter the PO number
    wa_item-po_item = '00010'.           "Enter the PO item number
    wa_item-tax_code = 'I1'.             "Enter the tax code applicable
    wa_item-item_amount = '528.2400'.     "Enter the item amount
    wa_item-quantity = '1'.           "Enter the invoice quantity
    wa_item-po_unit = 'PC'.              "Enter the UoM
    APPEND wa_item TO it_item.
    when i call the BAPI its giving me an error
    Enter a tax code in item 000001
    so  when i entered a data in  TAXDATA  table of BAPI again it throw an error,
    Enter value in either field HEADERDATA-CALC_TAX_IND or field TAX_AMOUNT (import parameter TAXDATA).
    As per my requirement we wanted to set CALC_TAX_IND .
    Kindly suggest me.
    Thanks and regards,

    Dear Reddy
    My excel contain date format 'YYYYMMDD'
    But the server in i am uploading data having date format 'DDMMYYYY'.
    bapi also having date format YYYYMMDD.
    BUT in TCODE AS91 HAVING DATE IN DDMMYYYY FORMAT.
    Due to this format it is giving error.

  • Can we use BAPI BAPI_ACC_DOCUMENT_POST to upload the vendor invoice?

    Hi,
    Can anybody tell me, can we use bapi BAPI_ACC_DOCUMENT_POST to upload the vender invoice?
    If yes, then which parameters we have to pass, and if no, then which is the other BAPI which is used for
    this purpose?
    Regards,
    Mrunal

    Hi Mrunal,
    Yes you can use BAPI_ACC_DOCUMENT_POST to upload vendor invoices.
    Parameters which are required to be passed are :
    Import tab :
    DOCUMENTHEADER: Mandatory fields for this specififed in documentation for this.
    Table tab:
    ACCOUNTGL: Enteries aganist GL account will be populated in this(check documentation for mandatory fields)
    ACCOUNTPAYABLE: Enteries aganist vendors will be populated in this(check documentation for mandatory fields)
    CURRENCYAMOUNT: in this currency amount aganist GL and vendor entries will specified.
    ITEMNO_ACC field will act as identifier as to amount belongs to which GL or vendor enteries.
    This much parameter are required to post vendor invoices.
    Regards,
    Brajvir

  • Posting Vendor invoice details using  BAPI_ACC_DOCUMENT_POST

    Hi Techies
    M uploading f-02 data using bapi: BAPI_ACC_DOCUMENT_POST.. But m facing a problem while uploading vendor invoice details.. here goes the vendor line item data ..
    doc type : KR
    posting key :40
    vendor account :410000
    Amount :100
    cost center: 1000
    Text: text.
    in  BAPIACAP09(bapi for vendor item) i cant find costcenter which i can see in GLdata... where should i pass this cost center value???
    Thanks...

    For vendor invoices GLaccount will have cost centre data.the first line is always of vendor when you create vendor invoice in which vendor number is passed.
    In GLaccount apss your cost centre data.
    Nabhheet

  • F-04 (Vendor Clearing using BAPI-BAPI_ACC_DOCUMENT_POST)

    Hello all,
    i am using a BAPI - BAPI_ACC_DOCUMENT_POST for posting and clearing vendor payments but problem is that i m getting error that 'Account 3252995 in company code 5219 cannot be directly posted to', can anyone please help me?
    Regards saurabh.

    Hi Saurabh,
    I´m looking for a BAPI to clear Accounts Payable open itens (as F-30, F-28 or FB05) and I saw in your previous message that it´s possible to do this using BAPI BAPI_ACC_DOCUMENT_POST, please, could you give a clue to sove this issue? Any additional information would be well accept.
    Best Regards,
    Ivan Spellmeier

  • How to post invoice parked using  BAPI-  BAPI_INCOMINGINVOICE_CREATE

    Hi all,
    Can anybody help me with the following scenario:
    I am parking Invoice document using BAPI:  <b>BAPI_INCOMINGINVOICE_PARK</b>. It gives me a document no. which I can see in frontend system also by committing the BAPI.
    But when I try to post the same using BAPI: <b>BAPI_INCOMINGINVOICE_CREATE</b> , It gives me a different document no.
    Means it is not posting the document which has been parked earlier but it is creating totally a new document. Can anybody  tell me using BAPIs how to post the same document that I had parked using  BAPI:  <b>BAPI_INCOMINGINVOICE_PARK</b>??
    Thanks
    Saurabh

    Hi Shraman,
    For a requirement for Intercompany GL posting, use BAPI_ACC_DOCUMENT_POST for standard posting with some advanced parameters
    In Header of the BAPI, pass the hardcoded values like
    DOCUMENTHEADER
           OBJ_TYPE            =            FKKSU
           OBJ_KEY             =          $
           OBJ_SYS              =          System name 
           BUS_ACT             =           RFBU
    Other parameters you can pass in Header is:
    USERNAME
    HEADER_TXT
    COMP_CODE
    DOC_DATE
    PSTNG_DATE
    TRANS_DATE
    FISC_YEAR
    FIS_PERIOD
    DOC_TYPE
    REF_DOC_NO
    If you are posting a document in cross-companies 1000 & 1001, you need to pass cost-center with the line item. That is the mandatory field.
    Thanks,
    Guru

  • Reena Prabhakar - Sales order creation Using BAPI

    Hi Reena,
    This is Dinesh,i also face problem in Sales order creation using BAPI if you can send me the code it would be great help to me.
    Regards,
    Dinesh

    Anyhow, here is the code that I am using currently which works perfectly well. Not sure if it will be of any help to you, since the values to the BAPI come from the Webdynpro application. I have values stored in my "Test data directory" which I use for testing from the backend.
    FUNCTION ztest.
    Call the BAPI to create Sales Order
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
        EXPORTING
          order_header_in     = l_order_header
        IMPORTING
          salesdocument       = l_salesdocument
        TABLES
          return              = it_return
          order_items_in      = it_order_items
          order_partners      = it_order_partners
          order_schedules_in  = it_order_schdl
          order_conditions_in = it_order_conditions
          order_text          = it_order_text.
      READ TABLE it_return WITH KEY type = 'E'.
      IF sy-subrc = 0.
    *-- error occured
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      ELSE.
    *-- no error
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ENDIF.
    ENDFUNCTION.

  • Need sales order creation using bapi in oops

    need code for sales order creation using bapi in oops

    hi rocky,
              could you pls give a bit explanation on what you are expecting.
    regards,
    Pavan

  • Mass sales order creation using BAPI

    Dear All,
    Can anyone help in  mass sales order creation using Bapi BAPI_SALESORDER_CREATEFROMDAT2.
    For example if i want to create 3 sales order with three item per order . i am populating
    HEADER = 3 Records
    Item   = 9 records
    schedule = 9 records
    partner  = 1 record.
    Then after populating the records I am calling Bapi BAPI_SALESORDER_CREATEFROMDAT2
    to create order. It should have created three order but unfortunately it creates
    only one sales order. I debugged and found that records are correct both in header,
    item, scheudle and partners.
    Could you please guide me what I am missing for creation of mass orders.
    I appreciate your time and many thanks in advance.
    cheers
    chandra

    Hi Chandra,
    Do like this.
    Loop at Header table into wa_header.
    *-- Move BAPI Header data
    Loop at item table into wa_item where condition.
    *--  in this move all Item and Schedule line item  to the BAPI.
      At end of item .
    Use the below function modules.
    BAPI_SALESORDER_CREATEFROMDAT2
    BAPI_TRANSACTION_COMMIT.
    Endloop.
    Endloop.
    Regards,
    Balavardhan.K

  • Vendor Invoice creation through EDI (Transaction MIRO)

    Dear All,
    We want to implement Vendor Invoice creation thro EDI .(Transaction
    MIRO)
    We are not finding any suitable EDI Function Module in SAP which
    would take care of more than 20 items and run a MIRO or any
    equivalent transaction .
    Can any one please advise if any Function module exists ? We need it for
    Invoice creation with GR reference as well as without GR reference .
    Thanks
    Sanjay.

    Thanks Naren,
    I will come back after checking the fn module.
    - Sanjay

  • 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

  • How to use Bapi -  'BAPI_ACC_DOCUMENT_POST'

    Hi Gurus,
    I want to use Bapi - 'BAPI_ACC_DOCUMENT_POST'.
    The below code gived message that - Document posted successfully: BKPFF 180000046710012010 DW1CLNT100
    but the document number gererated is not getting stored in any of BKPF or BSEG tables.
    The Bapi should work in the same way as FB01
    Please check and let me know your valuable suggestions on why document number is not getting saved.
    DATA: lwa_header  TYPE bapiache09,
          lt_ar       TYPE TABLE OF bapiacar09,
          lwa_ar      TYPE bapiacar09,
          lt_return   TYPE TABLE OF bapiret2,
          lwa_return  TYPE bapiret2,
          lt_curr     TYPE TABLE OF bapiaccr09,
          lwa_curr    TYPE bapiaccr09.
    *Start
    DATA : it_accountgl  TYPE STANDARD TABLE OF bapiacgl09 ,
           lwa_accountgl TYPE bapiacgl09.
    *End
    CLEAR: lwa_header, lt_ar, lwa_ar, lt_return, lwa_return, lt_curr, lwa_curr.
    lwa_header-bus_act      = 'BKPF'.
    lwa_header-username     = 'GOWDA'.
    lwa_header-comp_code    = '1001'.
    lwa_header-doc_date     = '20091102'.
    lwa_header-pstng_date   = '20091102'.
    lwa_header-trans_date   = '20091102'.
    lwa_header-fisc_year    = '2010'.
    lwa_header-fis_period   = '06'.
    lwa_header-doc_type     = 'DR'.
    lwa_accountgl-itemno_acc = '0000000001'.
    lwa_accountgl-gl_account = '0020000000'.
    lwa_accountgl-tax_code   = 'V1'.
    lwa_accountgl-item_text  = 'BAPI Test G/L line item'.
    APPEND lwa_accountgl TO it_accountgl.
    *lwa_ar-itemno_acc  = '0000000001'.
    *lwa_ar-customer    = '4000000006'.
    *lwa_ar-gl_account  = '0012110000'.
    **lwa_ar-gl_account  = '0020000000'.
    *lwa_ar-profit_ctr  = '0000000217'.
    *APPEND lwa_ar TO lt_ar.
    lwa_curr-itemno_acc = '0000000001'.
    lwa_curr-curr_type  = '00'.
    lwa_curr-currency   = 'USD'.
    lwa_curr-amt_base   = '100.00'.
    APPEND lwa_curr TO lt_curr.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        documentheader    = lwa_header
      TABLES
        accountgl         = it_accountgl
        accountreceivable = lt_ar
        currencyamount    = lt_curr
        return            = lt_return.
    COMMIT WORK.
    DATA: bt_return LIKE bapiret2.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait   = 'X'
      IMPORTING
        return = bt_return.
    LOOP AT lt_return INTO lwa_return.
      WRITE: / lwa_return-message.
    ENDLOOP.

    Hi Avi
    check this code  may you get some hint
    DATA gd_documentheader LIKE bapiache09.
    DATA l_type            LIKE gd_documentheader-obj_type.
    DATA l_key             LIKE gd_documentheader-obj_key.
    DATA l_sys             LIKE gd_documentheader-obj_sys.
    DATA it_accountgl      LIKE TABLE OF bapiacgl09 WITH HEADER LINE.
    DATA it_currencyamount LIKE TABLE OF bapiaccr09 WITH HEADER LINE.
    DATA it_return         LIKE TABLE OF bapiret2   WITH HEADER LINE.
    DATA it_return1        LIKE TABLE OF bapiret2   WITH HEADER LINE.
    gd_documentheader-username   = sy-uname.
    gd_documentheader-header_txt = 'BAPI Test'.
    gd_documentheader-comp_code  =  'RS01'.
    gd_documentheader-fisc_year  = '2008'.
    *gd_documentheader-doc_date   = '0'.
    *gd_documentheader-pstng_date = sy-datum.
    gd_documentheader-bus_act    = 'RMRP'.
    gd_documentheader-fis_period = '11'.
    gd_documentheader-doc_type = 'DW'.
    CLEAR it_accountgl.
    it_accountgl-itemno_acc     = 1.
    it_accountgl-gl_account     = '0011500000'.
    it_accountgl-tax_code       = 'V0'.
    it_accountgl-item_text      = 'BAPI Test G/L line item'.
    it_accountgl-customer       = 'AG0460'.
    *it_accountgl-profit_ctr     = '0000002002'.
    it_accountgl-de_cre_ind     = 'H'.
    it_accountgl-comp_code      = 'RS01'.
    it_accountgl-doc_type       = 'DR'.
    *it_accountgl-fis_period     = '06'.
    *it_accountgl-fisc_year      = '2009'.
    it_accountgl-pstng_date     = sy-datum.
    APPEND it_accountgl.
    CLEAR it_currencyamount.
    it_currencyamount-itemno_acc   = 1.
    it_currencyamount-curr_type    = '00'.
    it_currencyamount-currency     = 'INR'.
    it_currencyamount-amt_base     = '100'.
    APPEND it_currencyamount.
    CLEAR it_currencyamount.
    it_currencyamount-itemno_acc   = 2.
    it_currencyamount-curr_type    = '00'.
    it_currencyamount-currency     = 'INR'.
    it_currencyamount-amt_base     = '100'.
    APPEND it_currencyamount.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        documentheader = gd_documentheader
      IMPORTING
        obj_type       = l_type
        obj_key        = l_key
        obj_sys        = l_sys
      TABLES
        accountgl      = it_accountgl
        currencyamount = it_currencyamount
        return         = it_return.
    WAIT UP TO 10 SECONDS.
    IF sy-subrc IS INITIAL.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDIF.
    Regards
    Nilesh

  • Material Master Creation Using BAPI

    Hi,
    I m using BAPI_MATERIAL_SAVEDATA for Material creation using BAPI.
    Now the problem is , i have created a Screen exit long back in Purchasing view.. the corresponding Z field is created in table MARC..
    How can i pass value to this Z field using BAPI.
    i tried with BAPI_MARC.. my Z field is not coming in that structure.
    Can anyone guide me how can this be achieved.
    Thanks in Advance
    Aravindh Mani

    Hi,
    The Function Module BAPI_MATERIAL_SAVEDATA has the options to pass the Z fields. There exits a structure parameters
    EXTENSIONIN
    EXTENSIONINX
    in BPAI. In EXTENSIONIN pass the data and value part you can pass  in EXTENSIONINX. So this will update the Z fileds in material
    master .

Maybe you are looking for

  • Hard Drive Locked

    Hello, I restarted from an external Fire Wire HDD. When I went to switch back to the internal HDD, the internal HDD wasn't in the Startup Disk preferences and the internal HDD icon on the desktop has a lock on it. I did a Get Info. It shows that syst

  • Adobe Flash Player Quits Buffering Shortly After Starting to Play

    Hello, I am having trouble with Adobe Flash Player v. 16.0.0.305 not playing through videos.  It buffers and plays for a short bit then stops.  On Chrome it stops 1:09 into the video and then stops; and then it looks like it continues to buffer.  On

  • Project files creating dup assets (but not imported via scan)

    I've looked at these two threads: http://discussions.apple.com/thread.jspa?messageID=9147105#9147105 and http://discussions.apple.com/thread.jspa?messageID=9096958&#9096958 which sort of address my question. I do not import media via scan. I am attem

  • Capacity table showing more than 100 % load

    Hi, We are using SNP optimizer In one of the runs we have observed that the capacity of the resource is getting overloaded more than 100% but when we check in the optimizer log the log shows load of only 100% Can you please help me to understand why

  • Xperia z1 wont turn on or charge

    My xperia z1 ran out of battery and when i plugged it in to charge nothing happened, no LED no nothing, i tried it with 3 different chargers i know that work all in the wall, computer and my yv but still nothing, ive tried holding down the power and