Creating Credit Note based on Invoice

HI there,
I am trying to create a Credit Note through the DIAPI using VB. This Credit Note must be linked to the Invoice 88 for example :
  Try *
            'Get the required business object *
            ''Dim oCreditDoc As SAPbobsCOM.Documents = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oCreditNotes)*
            Dim queryString As String*
            Dim oRecSet As SAPbobsCOM.Recordset*
            oRecSet = oCompany.GetBusinessObject(300)*
            queryString = "SELECT T0.CardCode from OINV T0 where T0.DocNum = 88 "*
            oRecSet.DoQuery(queryString)*
           Dim oCreditDoc As SAPbobsCOM.Documents = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oCreditNotes)*
            'Set the business partner code*
            oCreditDoc.CardCode = oRecSet.Fields.Item(0).Value*
            'set the documents due date -mandatory*
            oCreditDoc.DocDueDate = Now*
            'add first line on invoice*
            'use the SO order specified in the text box *
            'as a base document*
            oCreditDoc.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oInvoices*
            oCreditDoc.Lines.BaseEntry = CInt("88")*
            oCreditDoc.Lines.BaseLine = 0*
            'add the new invoice document*
            lRetCode = oCreditDoc.Add*
            'check return code*
            If lRetCode <> 0 Then*
                oCompany.GetLastError(lErrCode, sErrMsg)*
                MsgBox("Error : " & lErrCode & " : " & sErrMsg)*
            Else*
                'store newly created object code in a new string*
                '(could have stored it in OrdCodeStr)*
                Dim OrdCodeStr2 As String*
                OrdCodeStr2 = ""*
                oCompany.GetNewObjectCode(OrdCodeStr2)*
                MsgBox(" Created Credit Note : " & OrdCodeStr2)*
           End If*
        Catch ex As Exception*
            MsgBox("Exception. Connect: " & ex.Message)*
        End Try*
I am getting an "Item code missing" error. Does this mean i must set up each and every line to credit? What if there are millions of lines? Can we not just set a BaseEntry and BaseType for the document as a whole so it knows which Invoice needs to be credited completely?
Kind regards,
Greeshma
p.s. i tried to get this to display as code but seems this editor is either confusing me or it doesnt work! sorry. when i find the right person to complain about it to i will!
Edited by: Greeshma Gulab on Nov 18, 2009 11:13 AM
Edited by: Greeshma Gulab on Nov 18, 2009 11:15 AM

Hi,
I am not able to make out ur code because of the formating problem, but anyways check the below thread, it might be helpful to u..
Create Credit Memo based on A/R Invoice
Vasu Natari.

Similar Messages

  • DI API: Wrong PriceAfterVAT value in credit note based on A/R invoice

    Hi all,
    I have serious problem with creating Credit Note based on existing A/R Invoice in Sales module.
    I use SBO 2004A patch level 32. With SDK I've created A/R Invoice with 2 items. First item has discount percent 0% and price after VAT 1. Second item has 100% discount, this means, doctotal is 1. Document VAT is 7,6% and VAT is calculated correctly in invoice. Then I've created credit note only with 1 item and this row is bounded with 1 row in invoice. After calling oCreditNote.Add, in Business One this credit note has all prices (price, price after VAT, row total) with the same value -> there is no vat calculated although in invoice the vat calculated is.
    Is it bug in DI API or do I something wrong?
    I use the standard ways to create new invoice and credit note through DI API.
    Many thanks for your answers.
    Best regards
    Libor.

    Hi Libor,
    To create a Credit note for a Invoice you should use the Invoice as the base document for the Credit note. Here is an example of how I create a GRPO from a draft GRPO. Try this (for your Invoice - Credit Note) and see if it does not work for you (SAP suggests this way of doing it).
    (Draft will be your invoice - GRPO will be your credit note)
    Dim oDraft As SAPbobsCOM.Documents
    Dim oGRPO As SAPbobsCOM.Documents
    If oDraft.GetByKey(YourInvoiceNumber) Then
                            'Build the GRPO (new GRPO Obj for each GRPO Doc)
                            oGRPO = oComp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes)
                            oGRPO.DocDate = oDraft.DocDate
                            oGRPO.DocDueDate = oDraft.DocDueDate
                            oGRPO.DiscountPercent = oDraft.DiscountPercent
                            oGRPO.CardCode = oDraft.CardCode
                            For i = 0 To oDraft.Lines.Count - 1
                                oDraft.Lines.SetCurrentLine(i)
                                oGRPO.Lines.BaseType = oDraft.Lines.BaseType
                                oGRPO.Lines.BaseEntry = oDraft.Lines.BaseEntry
                                oGRPO.Lines.BaseLine = oDraft.Lines.BaseLine
                                If i < oDraft.Lines.Count - 1 Then
                                    oGRPO.Lines.Add()
                                End If
                            Next i
                            'Add the GRPO
                            iRetCode = oGRPO.Add
                            If iRetCode <> 0 Then
                                oComp.GetLastError(iRetCode, sErrMsg)
                                Log.WriteLog("Error Adding GRPO : " & sErrMsg, EventLogEntryType.Warning)
                                Return False
                            End If
                        End If

  • Issue in creating Credit Note for road carrier invoice from SAP TM system

    Dear All,
    I am facing issue in creating Credit Note for road carrier invoice from SAP TM system.
    The following steps I have performed:
    1)  
    1)    1) Create Freight order with Amount 20,100
    2)     2) Create Freight Settlement Doc and send it to ECC. Hence PO and SES will be created in ECC with Amount 20,100
    3)     3) Invoice verification (MIRO) done w.r.t. FO in ECC with Amount 20,100 and following entries posted :
    Carrier A/c - 20,100Cr
    GR/IR A/c – 20,100 Dr
    4)    4) Created Credit Note in SAP TM against freight order with Amount 1,010 and transfer it to SAP ECC.
    5)    5)  By this a new PO and SES was created with negative values (with amount 1,010) in SAP ECC
    6)    6)  In transaction MIRO, Credit Memo was created against the freight order.
    7)    7)  By this it is showing value 21,110 by adding the line items of Original Purchase Order and Credit Note Purchase Order as 20,100 and 1,010 respectively.
    8)    8)  By posting this following are the accounting entries which is not correct:
    Carrier A/c – 21,110 Dr
    GR/IR – 20,100 Cr
    GR/IR – 1,010 Cr
    9)    9)  In report FBL1N which is showing the remaining liability of value 1,010(21,100 – 20,100) instead of 19,090 (20,100-1,010=19,090) for the carrier.
    Please suggest how to resolve the issue and get the correct accounting for credit memo?
    Regards,
    Vibhu Gupta

    Hello,
    Like my reply in Linkedin group, I got the same issue and solved with BADI in TM side(REQREQ...).
    Regards, Marcelo Lauria

  • DRQ:Credit Note not based on invoice should transfer reference number to JE

    according to SAP business one system behavior, only those credit notes that based on invoices are able to transfer customer/vendor reference no. field value to reference 2 field in journal entry. I would like to propose to enable AP credit note that is not based on invoice to transfer reference number field to JE as well.

    Even if it is possible, you would be better split the amount to individual credit note.  I have no idea why you need to split line in one credit note.
    Thanks,
    Gordon

  • Deallocate a credit note from an invoice in 2005

    Client needs to be able to deallocate credit notes raised from invoices when posting a payment to help with later reconciliation.
    Example: The client has 3 invoices for £100 and a credit raised from the most recent invoice for £50.
    The client then pays 2 of the due invoices, less the value of the credit note (£150)
    The try to allocate the cash but cannot allocate £150 to the 2 oldest invoices plus the credit note as the credit note is already allocated against the later invoice.
    The client has allocated it in such a way in their system, and we should attempt to match it. Therefore, we cannot allocate the payment against one of the 2 earlier invoices and the balance of the last invoice.
    Apparently this is very common so adding this as a On Account Payment is messy for lots and lots of accounts.
    A much better solution for my client would be to disassociate the invoice and credit upon posting the payment.

    Dear Carlos Mario Cuartas
    You can think about below procedures for your question.
    A. Create Credit Note (by Invoicing procedure)
       1) Selection Type
        When you try to progress rent invoices by using SAP RE Std.Transaction
        (T-Code: RERAIV - Create Invoices ), you can consider about below two selection type :
           a) Selection using FI documents
            --> That is for actual invoice based on the billing(posted) documents.
                 & you can define the "Invoice Correspondence" (Include Detail)
           b) Selection using planned items of the cash flow
            --> That is for planned invoice as pro forma invoice (just first time)
                 & you can define the another "Correspondence" for this format. (Not Detail)
       2) Summarize Invoices
            a) Per recipient (can involve several contracts)
          --> If the selected business partner has multiple contracts, then the items of all contracts
               are grouped into one invoice.
          b) Per contract
          --> If the selected business partner has multiple contracts, then the items of each contract
               are grouped into separate invoices.
    B. Print-Out Format for the Credit Note
        You can define and design the "Correspondence of credit note" as below,
          - Go to RECACUST >> Correspondence > PDF-Based Forms (Mass Print and Single Print) >
                                             Forms > Define Forms
          - Go to RECACUST >> Correspondence > PDF-Based Forms (Mass Print and Single Print) >
                                             Correspondence Activities > Define Correspondence Activities
    Regards,
    Jeong, Yeong-Chul.

  • How is credit note to an invoice sap  real estate

    I need to make a credit note to an invoice of a leasein the form of real state of sap

    Dear Carlos Mario Cuartas
    You can think about below procedures for your question.
    A. Create Credit Note (by Invoicing procedure)
       1) Selection Type
        When you try to progress rent invoices by using SAP RE Std.Transaction
        (T-Code: RERAIV - Create Invoices ), you can consider about below two selection type :
           a) Selection using FI documents
            --> That is for actual invoice based on the billing(posted) documents.
                 & you can define the "Invoice Correspondence" (Include Detail)
           b) Selection using planned items of the cash flow
            --> That is for planned invoice as pro forma invoice (just first time)
                 & you can define the another "Correspondence" for this format. (Not Detail)
       2) Summarize Invoices
            a) Per recipient (can involve several contracts)
          --> If the selected business partner has multiple contracts, then the items of all contracts
               are grouped into one invoice.
          b) Per contract
          --> If the selected business partner has multiple contracts, then the items of each contract
               are grouped into separate invoices.
    B. Print-Out Format for the Credit Note
        You can define and design the "Correspondence of credit note" as below,
          - Go to RECACUST >> Correspondence > PDF-Based Forms (Mass Print and Single Print) >
                                             Forms > Define Forms
          - Go to RECACUST >> Correspondence > PDF-Based Forms (Mass Print and Single Print) >
                                             Correspondence Activities > Define Correspondence Activities
    Regards,
    Jeong, Yeong-Chul.

  • How to create credit note automatically after PGR?

    Hello SD Gurus,
    Client's Business Process: Return Order (ZRE, ZPOR, ZARE, and ZMTR) is created with reference to billing document number and item category used for this order type is REN or ZREN. After the order is created, they do PGR (Return Delivery Type is LR) and then credit memo is created "manually". So, the issue with this process is that it is very time consuming and a lot of manual intervention is required.
    To-be Process: The requirement is to create credit note "automatically" after the PGR is done to reduce the manual intervention and expedite the process. If item category is REN, then credit note will be created with invoice value. If item category is ZREN, then credit note will be created with Zero Value.
    How should I write code in the user exit MV50AFZ1?
    Regards,
    Mohammed Anwar

    Hi
    Apart from Lakshmipathi's suggestion you can share the below logic with your ABAPER. There are two BAPIs we use to create billing automatically. Check whether you can call these BAPIs in userexit you have mentioned in your post.
    CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
    * EXPORTING
    *   CREATORDATAIN         =
    *   TESTRUN               =
    *   POSTING               =
            TABLES
              billingdatain         = billingdatain
              conditiondatain       = conditiondatain
    *   CCARDDATAIN           =
    *   TEXTDATAIN            =
    *   ERRORS                =
              return                = return3
              success               = success
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.
          READ TABLE return3 WITH KEY type = 'E'.
          IF sy-subrc = 0.
            record-inv_rem = return3-message.
          ENDIF.
          WAIT UP TO 2 SECONDS.
    *      READ TABLE return3 WITH KEY type = 'E'.
    *      IF return3-type = 'E'.
    *        WRITE:/ return3-message.
    *      ENDIF.
          READ TABLE success INDEX 1.
          CLEAR: vbeln_vf.
          vbeln_vf = success-bill_doc.
        ENDIF.
    Thank$

  • Emitting credit notes to an invoice in the I modulate sd

    hello experts, 
    is there form that when emitting credit notes to an invoice in the I modulate sd, don't these overcome the value from the invoice to which you/they make reference?.
    Best regads
    Jorge Silva

    Hi,
    thanks for your answer!
    well, there is no link between the company B and the intermediate business partner..
    I thought of something like that:
    1. I create a sales order for the material : "licence" for 100000.-
    2. I create a rebate agreement (B003) of 10% for "initermediate business partner= M.Wagner"
    3.I create an invoice to company B of 100000.-
    4. Company B pays 100000.- but 10% is automatically "stocked" in the accounting of company A
    5 I create a credit note of 10000 (linked with the invoice) to pay M.Wagner.
    Is that possible? if not do you have other suggestion??
    thanks a lot!!!
    M.

  • Can i create credit note request with selling price,but without material no

    hi
    can i create credit note request with selling price, but without material no.? which item cat. i should choose?
    thanks

    Hi,
    The price is controlled for any item category with the help of the Item Category setting (VOV7 tcode) that is, the field Pricing under Business Data section.
    Select the option X in the Pricing field.
    Now for your case, the setting will be greyed out. as it is a text item....
    To make it for entering any option ....then change the option to A in the Item Type field.
    Reagrsd

  • Create Credit Memo based on A/R Invoice

    Hello Gurus,
    Is it possible to create a A/R Credit Memo based on A/R Invoices through DI API or DI Server?  Please help.

    Hi Gilbert Ngo
    Yes it is possible, here is an example of how i added a invoice based on a sales order, just change it as you require.
    Dim oInvoice As SAPbobsCOM.Documents
            oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
            oInvoice.CardCode = BPCode.Text
            oInvoice.DocDueDate = Now
            oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
            oInvoice.Lines.BaseEntry = CInt(OrderStr)
            oInvoice.Lines.BaseLine = 0
            oInvoice.Lines.Add()
            oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
            oInvoice.Lines.BaseEntry = CInt(OrderStr)
            oInvoice.Lines.BaseLine = 1
            lRetCode = oInvoice.Add
            oCompany.GetLastError(lErrCode, sErrMsg)
            If lRetCode <> 0 Then
                MessageBox.Show("Not Added" & lErrCode & " " & sErrMsg)
            ElseIf lRetCode = 0 Then
                'oCompany.GetNewObjectCode(OrderStr)
                MsgBox("Added Invoice")
            End If
    PLEASE NOTE THAT oInvoice.Lines.BaseEntry = CInt(OrderStr) is refereing TO THE DOCENETRY AND NOT THE DOCNUM of the base doc.
    Hope this helps

  • Credit note based on AR invoice but base unit changed to Yes

    Is there anyway to improve the current design which allow the users to change the base unit column to Yes if the credit note is copied from AR invoice?

    What is your reason to change unit?  It may not be logical to change it even if you wrongly created your invoice.  When you create Credit Memo, it has to be consistent with AR invoice even if it is wrong!
    Thansk,
    Gordon

  • Single Credit Note for Multiple Invoices

    Hi,
    For multiple invoice of a specific customer only one credit note to be issued.
    Pls guide.
    Regards
    Vijay.

    Create credit memo request with reference to first invoice (the pop-up screen will take only one).
    Once all the items are copied to the credit memo request use menu path Sales document -> create with Reference , enter the second reference invoice. This will copy all the line items in the second invoice.
    Repeat the second step to copy all the invoices of the customer to the credit memo request.
    Do invoicing to generate a single credit memo. The credit memo request may split at the time of invoicing (some times) but you can prevent it.

  • Credit Note Creation for Invoice of previous sytem

    Hi to everyone,
    An invoice was created on the previous system (Pastel) and now the client is returning the goods.
    How would I account for this return? A service credit Note? How to re integrate the stock (goods are coming back in stock)
    Thanks
    Kentish

    Kentish,
    If the items coming back are good and if you want them back into stock, then create a Return ..select you Customer and items and enter the price you want to issue the Credit for.
    Copy the Return to A/R Credit Memo and the value you have on the document is the value the credit will be issued for.
    Suda

  • Can anyone from SAP comment on this? Credit Note from AP Invoice

    Hi all!
    I'm creating a partial credit note from a Service AP invoice via DI.
    My invoice has 2 lines, the first for 10.000, the second from 5.000 (no VAT to keep things simple) Tot = 15.000.
    In the credit note I have the first line for 2.000 and the second for 1.000, Total = 3.000.
    I set for the first line
    CreditNote.Lines.BaseType = "18"
    CreditNote.Lines.BaseEntry = 28
    CreditNote.Lines.BaseLine = 0
    CreditNote.Lines.Line Total = 2.000
    and for the second
    CreditNote.Lines.BaseType = "18"
    CreditNote.Lines.BaseEntry = 28
    CreditNote.Lines.BaseLine = 1
    CreditNote.Lines.Line Total = 1.000
    and for the CreditNote
    CreditNote.DOcTotal = 3.000
    Saving, I obtain a CreditNote with the first line for 10.000, the second for 5.000 and a total discount of 12.000, Total = 3.000. (same invoice amounts on the lines
    and a discount to get the correct invoice total).
    My question is: isn't there a way to obtain a credit note linked to the invoice but with line amounts different from the ones of the invoice (in my example: first line 2.000, second 1.000) and without discount?
    in B1 you can do it!!!
    I know that from a fiscal point of view the result is the same, but seeing credit notes in B1 different from the vendor documents is pretty upsetting for some customers ...
    Thanks in advance,
    francesca

    Nevermind!
    I solved the problem: even with DI you can create a partial Credit Note.

  • How to create LOV not based on a View Object attribute?

    Hi,
    I am creating a handed-made search form and I want to create an af:inputListOfValues.
    I have :
    - a read-only-view-object to get the LOV values from BD.
    - af:inputListOfValues tag (droped from Component Palette).
    How can I create the listOfValuesModel in Bindings layer? (the inputListOfValues is not based on a View Object attribute).

    Sorry, I think I am not very clear in my posts.
    My requirement is to create a LOV but I have no ViewObject. I just want an input (not based on a view object attribute), alone, but with a LOV (where lov's datas are get from a view object).
    In a "normal" LOV I would have something like this :
    in jsff :
    <af:inputListOfValues id="departmentIdId"
                                popupTitle="Search and Select: #{bindings.DepartmentId.hints.label}"
                                value="#{bindings.DepartmentId.inputValue}"
                                label="#{bindings.DepartmentId.hints.label}"
                                model="#{bindings.DepartmentId.listOfValuesModel}"
                                required="#{bindings.DepartmentId.hints.mandatory}"
                                columns="#{bindings.DepartmentId.hints.displayWidth}"
                                shortDesc="#{bindings.DepartmentId.hints.tooltip}">
            <f:validator binding="#{bindings.DepartmentId.validator}"/>
            <af:convertNumber groupingUsed="false"
                              pattern="#{bindings.DepartmentId.format}"/>
          </af:inputListOfValues>in pageDef :
    <listOfValues StaticList="false" IterBinding="EmployeesView1Iterator"
                      Uses="LOV_DepartmentId" id="DepartmentId"/>in model layer : a view object (EmployeeView) with view accessor and LOV based attribute, and a read only view object (DepartmentRVO) to get datas for the LOV.
    But in my case I have no ViewObject, so I don't know how to create the listOfValuesModel in fragment pageDef.
    I have :
    <af:inputListOfValues label="Label 1"
                                    popupTitle="Search and Result Dialog"
                                    id="ilov1" model="here I want to point to a listOfValuesModel but I don't know how to create it"/>in pageDef : the listOfValuesModel but I don't know how to create it.
    in model layer : just a read only view object (like DepartmentRVO), to get the datas for the LOV.
    Edited by: h0s on 29 févr. 2012 00:31

Maybe you are looking for

  • Upgrade clusterware to 10.2.0.5

    Experts, Can we upgrade oracle clusterware from base version to 10.2.0.5 directly and similarly for RDBMS ? Where can we download the patchset ? Patchset number seems to be same for RDBMA and clusterware, is it so ? Need help. AIX 5.3 Oracle 10.2.0.5

  • BADI ME_PROCESS_PO_CUST

    hi experts, we are using me59n to create the stock transfer orders from stock transport requisitions. the requirement is during the creation of STO we need to stop the creation of STO for some of the STR based on custom logic. the logic needs the STR

  • [Solved]Adding a hard drive problem?!?

    OK folks, I feel stupid asking this question but each time I try to add a hard drive to my arch server, I get the following error at boot up any advice: attempting to create root device /dev/sda3 /bin/mknod "/dev/root" b 8 3 /init: 1: cannot open /de

  • Change SCSM 2012 Portal Size File Attachment

    Hi friends. Im looking a way to change the SCSM 2012 Portal Size File Attachment I've been looking the solution but i can´t find it. This questions & answers don't helped me. SCSM 2012 Portal Size File Attachment --> http://social.technet.microsoft.c

  • SSRS Report on Audit History in MS CRM 2011

    Hi, I need to create a report on audit history, i am able to get the old value from changeddata in audit table. How can i get the new value? Thanks, Arjun arjun