BAPI_ACC_DOCUMENT_CHECK for Vendor Items

Hi friends,
I am using the BAPI BAPI_ACC_DOCUMENT_CHECK to check the data to be posted for Vendor lines
items. It is giving the error:
'For document type RE, an entry is required in field Reference'
I have written the code like this:
    Loop at t_final into wa_final.
*       Populate data for accounting doc. header to populate to BAPI
        IF v_count = '1'.
          wa_documentheader_ap1-username     = sy-uname.
          wa_documentheader_ap1-header_txt   = wa_final-bktxt.
          wa_documentheader_ap1-comp_code    = wa_final-bukrs.
          PERFORM convert_dates using wa_final-bldat CHANGING wa_documentheader_ap1-doc_date.
          PERFORM convert_dates using wa_final-budat CHANGING wa_documentheader_ap1-pstng_date.
          wa_documentheader_ap1-doc_type     = wa_final-blart.             "= 'RE'
          wa_documentheader_ap1-ref_doc_no   = wa_final-xblnr.             "Passing the 'Ref 1' as value
          APPEND wa_documentheader_ap1 TO t_documentheader_ap1.
*         Populate Vendor Line Item
          CLEAR wa_ACCOUNTPAYABLE_ap1.
          wa_ACCOUNTPAYABLE_ap1-ITEMNO_ACC = v_count.
          wa_ACCOUNTPAYABLE_ap1-VENDOR_NO = wa_final-lifnr.
          wa_ACCOUNTPAYABLE_ap1-GL_ACCOUNT = c_hkont_v.
          wa_ACCOUNTPAYABLE_ap1-COMP_CODE = wa_final-bukrs.
          wa_ACCOUNTPAYABLE_ap1-PMNTTRMS = wa_final-zterm.
          wa_ACCOUNTPAYABLE_ap1-BLINE_DATE = wa_final-zfbdt.
          wa_ACCOUNTPAYABLE_ap1-PYMT_METH = wa_final-zlsch.
          wa_ACCOUNTPAYABLE_ap1-TAX_CODE  = wa_final-mwskz.
          wa_ACCOUNTPAYABLE_ap1-REF_KEY_1 = wa_final-xblnr.                       "Ref 1 as value
          wa_ACCOUNTPAYABLE_ap1-REF_KEY_2 = wa_final-xblnr.                       "ref 1  as value
          wa_ACCOUNTPAYABLE_ap1-REF_KEY_3 = wa_final-xblnr.                       "Ref 1 as value
          APPEND wa_ACCOUNTPAYABLE_ap1 to t_ACCOUNTPAYABLE_ap1.
*       Amount and Currecy details
          wa_currencyamount_ap1-itemno_acc = v_count.
          wa_currencyamount_ap1-currency = wa_final-waers.
          v_wrbtr =  wa_final-wrbtr * -1.
          wa_currencyamount_ap1-amt_doccur = v_wrbtr.
          v_wrbtr_cr_ap1 = wa_final-wrbtr.
          APPEND wa_currencyamount_ap1 TO t_currencyamount_ap1.
          CLEAR wa_currencyamount_ap1.
          v_count = v_count + 1.
       ENDIF.
*       GL Line Item
        wa_accountgl_ap1-itemno_acc =  V_count.
        wa_accountgl_ap1-gl_account =  wa_final-hkont.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = wa_accountgl_ap1-gl_account
          IMPORTING
            output = wa_accountgl_ap1-gl_account.
        wa_accountgl_ap1-item_text  =  wa_final-sgtxt.
        wa_accountgl_ap1-profit_ctr =  wa_final-prctr.
        wa_accountgl_ap1-costcenter =  wa_final-kostl.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = wa_accountgl_ap1-costcenter
          IMPORTING
            output = wa_accountgl_ap1-costcenter.
        wa_accountgl_ap1-REF_KEY_1  = wa_final-xblnr.  "Ref 1 as a value
        wa_accountgl_ap1-REF_KEY_2 = wa_final-xblnr.  ""Ref 1 as a value
        wa_accountgl_ap1-REF_KEY_3 = wa_final-xblnr.  ""Ref 1 as a value
        wa_accountgl_ap1-costobject =  wa_final-kstrg.
        APPEND wa_accountgl_ap1 TO t_accountgl_ap1.
        CLEAR wa_accountgl_ap1.
*       Amount and Currecy details
        wa_currencyamount_ap1-itemno_acc = v_count.
        wa_currencyamount_ap1-currency = wa_final-waers.
         wa_currencyamount_ap1-amt_doccur = wa_final-wrbtr_it.
        APPEND wa_currencyamount_ap1 TO t_currencyamount_ap1.
        CLEAR wa_currencyamount_ap1.
        v_count = v_count + 1.
endloop.
* Validating against BAPI_ACC_DOCUMENT_CHECK
  CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
    EXPORTING
      documentheader = wa_documentheader_gl2
    TABLES
      accountgl      = t_accountgl_gl2
      currencyamount = t_currencyamount_gl2
      return         = t_return_gl1.
But it is giving the error: ' 'For document type RE, an entry is required in field Reference''
Is rthe value entered for Reference is valid document?
Do i need to pass any other table to this FM to populate vendor data?
What is the problem in my code?
Thanks,
Sreenivas reddy
Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 4:01 PM

Hi Srinivas,
The minimun field required to make a vendor posting are as follows,
        wa_vendoritem-itemno_acc  = gv_count.
        wa_vendoritem-vendor_no    =  wa_vendor-newko.
        wa_vendoritem-item_text     = wa_vendor-sgtxt.
        wa_vendoritem-comp_code  = wa_vendor-bukrs.
        wa_vendoritem-pmnttrms     = wa_vendor-zterm.
        wa_vendoritem-bline_date   = wa_vendor-zfbdt.
        wa_vendoritem-item_text    = wa_vendor-sgtxt.
        wa_vendoritem-tax_code    = wa_vendor-mwskz.
        wa_vendoritem-profit_ctr     = wa_vendor-prctr.
I think you missed the profir centre field which is mandatory for a vendor posting,or if is a new gl, it will derive the profit centre from the cost centre of the previous line(i.e. G/L line).  if it is not a new G/l , then you need to manually find the profit centre from cost centre and put the values. So double check passing these field , it should be working. Still have doubts please contact me.
regards,
Shobana.K
Edited by: Shobana k on Jan 8, 2009 8:05 AM
Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 4:01 PM

Similar Messages

  • WBS and NPLNR for Vendor Items in BSIK and BSAK  Table

    Hi  FI Experts,
    I created a PR for Network  . While creating PO for the PR  the network values are flowing into  PS_PSP_PNR and NPLNR of EKKN fields  .
    While doing a MIGO also the WBS and NPLNR are flowing to MSEG table  appropriate fields .
    While doing a MIRO transaction for PO   the vendor line item  posted in BSIK table populated with  neither WBS nor NPLNR (Network).
    When  payment is made for Invoice the clearing document(Payment Document)  from BSAK table should be populated with either WBS or NPLNR .
    Could you  please suggest if I need to manually run some transaction to get them Popluated .
    All the above helps me in writing a Vendor and Project wise outstanding balances report .
    Thanks in Advance ..
    Regards,
    Kishore.S

    Hi Srinivas,
    The minimun field required to make a vendor posting are as follows,
            wa_vendoritem-itemno_acc  = gv_count.
            wa_vendoritem-vendor_no    =  wa_vendor-newko.
            wa_vendoritem-item_text     = wa_vendor-sgtxt.
            wa_vendoritem-comp_code  = wa_vendor-bukrs.
            wa_vendoritem-pmnttrms     = wa_vendor-zterm.
            wa_vendoritem-bline_date   = wa_vendor-zfbdt.
            wa_vendoritem-item_text    = wa_vendor-sgtxt.
            wa_vendoritem-tax_code    = wa_vendor-mwskz.
            wa_vendoritem-profit_ctr     = wa_vendor-prctr.
    I think you missed the profir centre field which is mandatory for a vendor posting,or if is a new gl, it will derive the profit centre from the cost centre of the previous line(i.e. G/L line).  if it is not a new G/l , then you need to manually find the profit centre from cost centre and put the values. So double check passing these field , it should be working. Still have doubts please contact me.
    regards,
    Shobana.K
    Edited by: Shobana k on Jan 8, 2009 8:05 AM
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 4:01 PM

  • SAP QUERY report for vendor line items

    Hi
    I have created a SAP QUERY report for vendor line items with fields vendor no.,vendor name,amount,company code and period.But there is one line item i donot know from wher system is getting it picked with is not in that vedor account,when i compare with fbl1n.I checked the document number too...the same doc number is twice in my query report.One with correct amount and another with wrong one.How do i chk.Where did i go wrong in creating query.I used logical database KDF.
    Please advise.

    i chked...how do we get the amount displayed in query...it just displays amount no debit credit symbol... i have selected BSEG-DMBTR field but no -/+ sign,how is it done in query,please suggest.

  • Clearing problem for vendor open item

    while clearing open item of vendor through T-code F-44 i am facing the problem following problem
    Document splitting :-Item for clearing 1000/100020603/2006/005 not found,
    Daignosis as given in error:-document splittting cannot be performed clearing because it was not possible to find complete splitting information items to be cleared(company code 1000, doc. no.100020603, item 005). procedure as provided by the error massage is that the item  was not posted  with active document splitting. In this case this item or document would have to be migrated

    Dear Sweta,
    I think there is no such a table, as you expect, existing in SAP. As I know here are the
    most popular table about Accounting documents.
        Accounting documents
        BKPF                Accounting documents
        BSEG               item level
        BSID                 Accounting: Secondary index for customers         
        BSIK                 Accounting: Secondary index for vendors           
        BSIM                 Secondary Index, Documents for Material           
        BSIP                 Index for vendor validation of double documents   
        BSIS                 Accounting: Secondary index for G/L accounts
        BSAD               Accounting: Index for customers (cleared items) 
        BSAK                Accounting: Index for vendors (cleared items)   
        BSAS                Accounting: Index for G/L accounts (cleared items)
    If you need information about open line items of a certain day, you have to use ABAP.
    Regards.
    Maxielight.

  • Automatic open item clearing for vendor/customers

    Dear All,
    For My client they want Automatic clearing process for vendor & customer Open item. What are the configuration settings i have to do for this how it will be process.
    please guide me to do this process.
    girija

    Hello,
    For my understanding:
    1. You mean how you can post icoming payment in an efficient way when you have a lot of open items per customer? Right?
    What information do you get from customer? invoice number? If yes you can search per invoice number and post partial payment.
    2. PDC cheque? Do you mean a post dated cheque. Well I think that this customer is a late payer.
    The date when you get the mony on your bank account is relevant! In my opinion.
    I do not know your local GAAP rules. Normally you bring cheque to bank and the next day you have incoming payment on your bank account. Usually the bank account papers are posted with document date. As an instance: bank account papers from 18.11.2013 here document date and posting date ist 18.11.2013.
    BUT: In this case I would ask your local auditor how to handle this, and what are the issues you have to take care.
    3. I have sent the material. Sorry, forget email one this was German version, last email ist English version.
    all the best Erwin

  • Recurring Entry for Vendor Line Items

    Hi,
    We are using SAP ECC 5.0.
    There are recurring entries to be processed, which run into 90+ line items. These line items include GLs as well as Vendor items.
    Fast Entry and Account Assignment Model cannot be used as they accept only GL line items. Recurring entry also cannot be used as the amounts keep changing. Is there any other time saving way to make this entry? making the entry using F-02 is very time consuming and tedious.

    Hi,
    One option is to develop a BDC and calling up the FB01 or F-02 posting. An excel template needs to be designed and can be used for upload of line items. Make changes in the amounts in the excel sheet and use the upload program to post.
    Rgds.

  • Can we make use of Transaction code FKMT  for vendor line items

    Hi
    Please advise me whether we can make use of Transaction code FKMT (Account assignment model) for vendor line items as follows:
    For Example:
    Expenditure Account      Dr.       Rs.1000
             To Vendor A                                      Rs.100
             To Vendor B                                      Rs.100
             To Vendor C                                      Rs.100
              To Vendor D                                      Rs.700
    Also please advise me what to give parameters
    Thanks and Best Regards
    Shekhar
    Edited by: Shekhar Yecham on Sep 19, 2008 7:05 AM
    Edited by: Shekhar Yecham on Sep 19, 2008 7:10 AM

    Dear Kulakarni,
    I found few of my fields in 0FI_AP_4.I did n't find few fields can i enhance the Datasourse.
    What is the respective Cube for that  Datasourse.
    I check  0AP_30,but in Business Content that cube is not available.
    Could you please give me guidance.
    Thanks in Advance,
    Srinivasan.

  • Few queries about foreign revaluation for vendor/customer open items

    I am trying the transaction F.05 for the first time for vendor & customer open items in foreign currency. I have a few queries:-
    1. The ouput contains 2 exchange rates. One is picked from the transaction header. My query is from where is the other rate being picked up. In my current system, I could make out that exch rate in transaction header is being picked automatically from table OB08....however I am unable to deduce the source of the 2nd exch rate.
    2. What is the significance of "balance sheet preparation valuation". Earlier in test runs, only "new difference" was getting populated. However the user wanted to see "old diff" also. So while doing some trial run in test client, I checked the "bal sheet prep valu" and posted.....after this run, I am getting values in "old diffe" and "new diff" also. And the posted amount is the difference of the two. What is the significance and ideal way?
    3. Should the entry be reversed if I am revaluating at year end? Why I am asking is because in some threads I read that revaluation at year is not to be reversed....
    Thanks,
    SM

    1. To find out difference latest date(Key Date for OI Overview) will be taken by comparing with document posted dated. Based on that system shows diffrences
    2.   The items are valued using the exchange rate valid at the key date. The
          difference determined in local currency is output and posted. The
          valuation can also be done for parallel local currencies and according to
          different valuation approaches (HGB, GAAP).
          The result of the valuation is required for the creation of the financial
          statements. You should therefore carry out the valuation before the
          grouping of receivables and payables with program SAPF101. The valuation
          difference is then noted in the document. Use the valuation areas to
          calculate a different valuation method, or to save the result for further
          processing activities.
    3.   we need to reverse entries .

  • LSMW upload for Vendor and Customer Open items

    Hi Experts,
    1. I wanted to use to use LSMW to upload through FB60 for Vendor Invoices through recording, but the problem is Amount in Document Currency is 'USD' and Amount in Local Currency is 'INR'. While recording it is not allowing to input values in Amount in Local Currency while my upload file has values in both Amount in document currency as well as Amount in Local currency. Any help with this regards?
    2. Do i need to open the all fiscal years which are there in upload file?
    3. Any better option to upload the Balances with LSMW?
    Any useful information will be Highly appreciated.
    Thanks in Advance

    Hi Rajkumar,
    To upload Open items of Vendor and Customers, in LSMW, you will have two files header and line items with  a link linking both the files.
    Now, Suppose if you have to enter an amount in USD, then in the header file, enter USD in the currency field and give Exchange rate also in the header file and give the exact exchange rate which should be the value of your Amount in Local Currency INR.
    In such cases, you do not enter directly the amount in local currency field.. It is a calculated figure..
    Yes, depending on the posting date, all those fiscal years need to e open for which you are posting the data.
    LSMW is a tried and tested method for uploading open items.. Simple Go Ahead...
    Regards,
    SAPFICO

  • Stored procedure in purchase order for duplicate item for a vendor

    Hi all
    I have written a stored procedure for duplicate item for vendor the output i need from this SP is whenever for a vendor we will raise purchase order the system should check that their shouldn't be any po in the system for the same item by the selected vendor. Its working fine when only one item is selected but it is behaving wrongly when more than one item is selected.
    If (@object_type='22' and @transaction_type='A')
    BEGIN
    Declare @Vend as varchar(200)
    Declare @ItemCode as varchar(200)
    Select @Vend =CardCode From OPOR Where DocEntry = @list_of_cols_val_tab_del
    Select @ItemCode=ItemCode From POR1 Where DocEntry=@list_of_cols_val_tab_del
    IF 1 !=(Select Count(T0.DocEntry) From OPOR T0  Inner Join POR1 T1 On T0.DocEntry=T1.DocEntry  Where T0.CardCode=@Vend and T1.ItemCode=@ItemCode)
    Begin
    select @error =1
    select @error_message = 'Item Code Already Exists For This Vendor'
    end
    end
    Thanks
    Rashid.

    Hi Rashid,
    Try this,
    if @object_type = N'22' and @transaction_type in (N'A', N'U')
    begin
    declare @line1 int
    declare @lin1 int
    declare @out1 int
    Set @out1 = 0
    SET @lin1 = 0
    Declare @Vend as varchar(200)
    Declare @ItemCode as varchar(200)
    Select @Vend = CardCode From OPOR Where DocEntry = @list_of_cols_val_tab_del
    Select @line1 = Max (LineNum)FROM POR1 WHERE POR1.DocEntry = @list_of_cols_val_tab_del
    While @lin1 < @line1
    Begin
         Select @ItemCode=ItemCode From POR1 Where DocEntry=@list_of_cols_val_tab_del and LineNum = @lin1
          if (SELECT COUNT(T0.DocEntry) FROM POR1 T0 inner join OPOR T1 on T0.DocEntry = T1.DocEntry
          WHERE T0.ItemCode = @ItemCode and T1.CardCode = @Vend)> 1
          Begin
               Set @Out1 = 1
               Break;
          END
               Else
               Begin
               Set @lin1 = @lin1+1
               Continue
          END
    END
    Set @lin1 = @lin1 + 1
    if @out1 = 1
    begin
          Set @error = 1
          Set @error_message = 'Item Code in line ' + CONVERT(nvarchar(4), @lin1) + N'already Exists For This Vendor!'
    End
    END
    Regards,
    Bala

  • Logical database for vendor cleared items

    Hi,
    What is the logical database for vendor cleared items.  KDF is giving me only open items. 
    Actually I am preparing a report which uses vendor cleared items and trying to get the list from BSAK table.  Which would be the better way (faster process for better performance)
    a) directly fetching data from database table like BSAK or
    b) by using logical database
    any ideas please.
    regards,
    mallik

    If  just display of all cleared items in a report,  then i would suggest you to go for Query development instead of a z report and use BSAK. Being Index table and query, we can reduce several errors in logic/easy to develop/less time.
    If you need Z report only, then also, you can go for BSAK. Where as BASK is secondary index table which helps to fetch data fast.
    In one way, BSEG - BSIK = BSAK for your case!
    Regards
    Sridevi

  • How to create ABAP Query for vendor open items

    HI,
    My client has requested me to create ABAP Query for vendor open items . So that it will be usefull for the users . Could anyone help me with this. I will assign you points.Thanks in advance.

    Hello,
    Use Table BSIK <Open Items of AP > & BSAK <AP Cleared items>......
    For Query you can use SQ01.
    USE BSID & BSAD for AR open/clear items...
    LFA1, LFB1 are vendor master data tables
    This is FYI
    Hope this helps.
    Rgds
    Rajendra

  • Table for vendor open item at key date

    Hi
    Could you please tell me the table which shows me the vendor open item at the date i want. I know BSIK shows open item at current date, but i need the table which shows open item at date i want.
    Thanks
    Sweta

    Dear Sweta,
    I think there is no such a table, as you expect, existing in SAP. As I know here are the
    most popular table about Accounting documents.
        Accounting documents
        BKPF                Accounting documents
        BSEG               item level
        BSID                 Accounting: Secondary index for customers         
        BSIK                 Accounting: Secondary index for vendors           
        BSIM                 Secondary Index, Documents for Material           
        BSIP                 Index for vendor validation of double documents   
        BSIS                 Accounting: Secondary index for G/L accounts
        BSAD               Accounting: Index for customers (cleared items) 
        BSAK                Accounting: Index for vendors (cleared items)   
        BSAS                Accounting: Index for G/L accounts (cleared items)
    If you need information about open line items of a certain day, you have to use ABAP.
    Regards.
    Maxielight.

  • How to see open items for vendor.

    Hi,
    What condition I should put to select values from Bseg to select open item amount for vendor.
    Regards
    Mave

    Hi,
      to select open items for vendor you should read from table BSIK.
    After this you can read table BSEG with BSIK-BUKRS, BSIK-BELNR, BSIK-GJAHR.
    ( Bseg is a cluster table and selections for vendor are slower than bsik)
    for example:
      select * from bsik
      where bukrs = company_code
      and lifnr = vendor_no
      select * from bseg
      where bukrs = bsik-bukrs
      and belnr = bsik-belnr
      and gjahr = bsik-gjahr
    Regards, Manuel

  • How to Prepare Flat File for Vendor Open Items for RFBIBL00

    Hi Experts,
    I have to prepare a flat file structure for vendor open items to use in RFBIBL00.
    I tried to take structure from the structures BBKPF and BBSEG structures.
    I have 59 fields in my file and I need to map these fields with the structures BBKPF and BBSEG to prepare the structures for
    Header and Items for vendor open items.
    Can any body help me how to prepare the flat file structures.
    Thanks & Regards,
    Sudheer
    Edited by: sudheer kumar on Dec 4, 2009 11:09 AM

    RFBIBL00 has a documentation please check it

Maybe you are looking for