Creating Invoice from a Delivery Note using SDK

Hi,
I am working on SAP 2005 A Patch 4 with SQL 2000 SP 4. I am using VB.NET (VS2005). I am trying to create a Invoice from a Delivery note which is created based on a Sales order.
I am getting the following error
Error occured while saving Invoice: 0 - '15' is not a valid value for field 'BaseType'. The valid values are: '-1' - '',  '0' - '',  '23' - 'Sales Quotation',  '17' - 'Sales Order',  '16' - 'A/R Returns'
The Code that i used to create the invoice is as follows
Dim oInvoice As SAPbobsCOM.Documents
        oInvoice = pcompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
        oDelivery = pcompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes)
        Try
            If oDelivery.GetByKey(iDlvNo) = True Then
                sTaxCodes = sTaxCode
                oInvoice = pcompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
                oInvoice.CardCode = oDelivery.CardCode
                oInvoice.SalesPersonCode = oDelivery.SalesPersonCode
                oInvoice.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items
                oInvoice.DocumentSubType = SAPbobsCOM.BoDocumentSubType.bod_None
                oInvoice.Address = oDelivery.Address
                oInvoice.ShipToCode = oDelivery.ShipToCode
                oInvoice.Address2 = oDelivery.Address2
                oInvoice.JournalMemo = "Invoice - " & oDelivery.CardCode
                oInvoice.Comments = "Based on Delivery  " & oDelivery.DocNum
                oInvoice.PaymentGroupCode = oDelivery.PaymentGroupCode
                oInvoice.DocDueDate = Now.Month & "/" & Now.Day & "/" & Now.Year
                For iRowNo = 0 To oDelivery.Lines.Count - 1
                    If iRowNo > 0 Then
                        oInvoice.Lines.Add()
                    End If
                    oDelivery.Lines.SetCurrentLine(iRowNo)
                    oInvoice.Lines.ItemCode = oDelivery.Lines.ItemCode
                    oInvoice.Lines.Quantity = oDelivery.Lines.Quantity
                    oInvoice.Lines.Rate = oDelivery.Lines.Rate
                    oInvoice.Lines.BaseType = SAPbobsCOM.BoAPARDocumentTypes.bodt_DeliveryNote
                    oInvoice.Lines.BaseEntry = iDlvNo 'DocEntry of Delivery Note
                    oInvoice.Lines.BaseLine = iRowNo
                    oInvoice.Lines.TaxCode = sTaxCodes
                Next
                iReturnValue = oInvoice.Add()
                If iReturnValue <> 0 Then
                    pcompany.GetLastError(iReturnValue, sErrorDescription)
                    Throw New Exception("Error occured while saving Invoice: " + _
                                       iErrorNo.ToString() + " - " + sErrorDescription)
                Else
                    MessageBox.Show("Invoice created succesfully")
                End If
            End If
Since in the error message it has specified that i have given the BaseType as Delivery which has a value of 15 i changed that from bodt_DeliveryNote to bodt_Order which has a value as 17.
When i tried creating the invoice again it gave the error
Error occured while saving Invoice: 0 - Target item number does not match base item number.  [RDR1.TargetType][line: 2]
I am not able to proceed further ... can any one help me
thanks in advance
Ganesh

Greetings,
I am having a similar problem, only I'm doing it as suggested in Louis' reply.  In fact I copied that code and tried it.  It's giving me a 2028 error with no description.
I had been doing it slightly differently and the error I was getting was 5002 "Item no. is missing [INV1.ItemCode][line 2]"  I don't have 2 lines and I'm certain I have an item code.  The numbers I'm putting in for baseentry & baseline are absolutely in the table and the order is open.
Here is that code:
        oDNUpd = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
        oDNUpd.CardCode = CardCode.Text
        oDNUpd.Lines.BaseEntry = CInt(SalesOrder.Text)
        oDNUpd.Lines.BaseLine = CInt(baseline.Text)
        oDNUpd.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
        oDNUpd.Lines.Add()
        lretcode = oDNUpd.Add
I'm using SBO 2005 patch 7 (and the new dll).  I have similar code doing a stock transfer and it's working fine.
Thanks for any suggestions you can offer
John

Similar Messages

  • Function module to create Invoice from the Delivery no ?

    Hi All,
    Is there any way (function module) to create an Invoice from the Delivery no and the Billing Type ? We do not want to go with BDC for transaction VF01.
    Details:
    We want to generate a pro-forma invoice while saving the delivery. We will have 'Special Function' (NAST-NACHA = 8) in the output determination and a routine would be called from there. That routine would contain the code to generate the Invoice. We will have only the 'Delivery no and the Billing Type'  in that routine. So trying to find any function module which can create an Invoice from the Delivery no and the Billing Type.
    Any suggestion / hint  is welcome.
    Thanks,
    Ashok

    Hello Ashok Satapathy ,
                                        The only option  for you is to call the FM "GN_INVOICE_CREATE" .
    There is no special FM availaible to pass only the delivery number at this point.
    You need to retrieve all the delivery information details and need to pass it to the FM "GN_INVOICE_CREATE".
    Thanks,
    Greetson

  • Pro forma invoice from a Delivery Output using "8 - Special Function"

    SAP Gurus
    I am interested to create a proforma invoice for a delivery that is created in the system using VL01N. I am using an option to use the Delivery output to be allow creation  of the pro forma invoice. I created a new output type and assigned 8 - Special function as the medium of the output.
    I managed to find a BAPI that serves this purpose perfectly. Please look at BAPI_BILLINGDOC_CREATEFROMDATA. Enter the following Parameters.
    In table BILLINGDATAIN insert one line with the following data:
    ORDBILLTYP = ZFDP
    REF_DOC = Delivery number
    REF_DOC_CA = 'J'
    The BAPI when it runs on own, creates the required pro forma invoice. But when it is attached to the output type to be triggered as a special function, does not work. What kind of routine should I enter in the processing routine.
    Program on output screen is ZFDP_BAPI
    Form Routine is ENTRY
    there is a routine maintained inside the program ZFDP_BAPI called "ENTRY"
    Inside the subroutine ENTRY, the BAPI_BILLINGDOC_CREATEFROMDATA is invoked.
    Please advice.
    Thank you.

    Hello
    Thanks for the reply. Earlier when I was using the BAPI BAPI_BILLINGDOC_CREATEFROMDATA, The BAPI used for the output type did not work as it uses u2018Commit Worku2019 statement and it interferes with the u2018commitu2019 of standard program. Due to this reason the transaction dumps every time.
    Are you performing the output with dispatch time '4' ? - the answer is yes, I am.
    Just double -checking with you that if you decide to use Use BAPI BAPI_BILLINGDOC_CREATEMULTIPLE and call it in background task, do you think that the we can get past this issue short dump issue? 
    Thanks

  • Can't create invoice from the delivery

    Hello.
    Ship out the trade order then i created the delivery and PGI successfully.
    But when i went to VF01 to invoice the delivery i can´t create it.
    I take a look to the LOG and this is what i found:
    Error Log
                 6910517662 000010 The item is blocked for billing
    I double click the item and in the configuration of Financial processing there is a field called "Block" but there is nothing selected over there. Do you have any suggestion?
    I appreciate your help

    The item is blocked for billing
    Apart from the suggestions, if that particular material is kept open in some other system, then also, system will throw this error.  Also ensure that in material master Sales Org.1 view, this material is not blocked against the field "X-distr.chain status"
    thanks
    G. Lakshmipathi

  • Creating Excise Invoice from Sales Delivery using DI API.

    Hi Experts,
    I have been searching a lot for any Business Object for creating Excise Invoice base on Sales Delivery using DI API.. But have not yet found any one.
    I want to create Invoice for excisable items from Sales Delivery using DI API.,for Excisable items we cannot create standalone A/R Invoice . We need to create Excise Invoice also . But How to create Excise Invoice based on Sales Delivery using DI API. Is there any Business Object for that.
    Please suggest me.
    Thanks and Regards,
    Pooja Singh.

    Hi all,
    I have not received any reply for this thread. Does this mean that there is no provision for creating Excise Invoice from Sales Delivery ? Actually I was asked to create sales delivery and then Outgoing Excise Invoice and then Sales Invoice using DI API.
    But I don't find any Business Object for this in SDK ? Is it really not possible to create Outgoing Excise Invoice from Sales Delivery using DI API.? If possible then how?
    Please reply me if anyone has got any idea in this regard.
    Thanks and Regards,
    Pooja Singh.

  • WebI:Creating a minus query from data providers not using the same universe

    Hi there. A client of ours wishes to use Combined Query on multiple universes in the same WebI report. So far, I have heard it is not feasible in WebI. I know it is possible in DeskI. Even the sub-query option is limited to just one universe in WebI. So, I am stuck.
    Is there a workaround to creating a minus query from data providers not using the same universe in WebI?

    Hello Amit,
    what are the Datasources ? Usually when you create a Sub Query you can choose a seperate Universe.
    Maybe if you only see one Universe you only have the rights for this Universe ?!.
    Regards
    -Seb.

  • How to print Warranty (Duration) on Delivery Note using PLD

    Hi,
    How can I print Warranty (No. of Months) on Delivery Note using PLD. Warranty is already defined in a service template which is assigned to Item Master record.
    when i try to print "duration" from OCTT is shows all the duration values set in all service templates with the combination of all the items in the delivery note. Please help me. I am working on SAP B1 2007 A PL47.

    Hi
    Its Very Easy just Follow the Steps:
    Create One DB field in Repetative area0 - Table -octt(contract Temp) Column- Duration(Duration of Coverage)
    Check the Item code Field or Item description field for EX( F_123), then in Duration DB field - Go to Properties -Field in that - General - Lint to - connect the  ( F_123), code Field or Item description field for EX( F_123),
    So it will show automatically Duration of the Item which was connected in master data.
    It works perfectly in 2007B PL 10.
    If issue Resolved pls close the thread
    Giri

  • Problems creating invoice from order (DI API and SBO)

    Hello all!
    I´m getting various tax problems using the following code to automatically create invoices from existing orders.
    For Each currentKey In arrABEntrys
      objInv = objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
      objAB.GetByKey(currentKey)
      objInv.CardCode = objAB.CardCode
      With objInv.Lines
        .BaseType = SAPbobsCOM.BoObjectTypes.oOrders
        .BaseEntry = currentKey
        .BaseLine = 0
        For i = 1 To objAB.Lines.Count - 1
          objInv.Lines.Add()
          BaseType = SAPbobsCOM.BoObjectTypes.oOrders
          .BaseEntry = currentKey
          .BaseLine = i
        Next
      End With
    If objInv.Add() = 0 Then
    Else
    End if
    The result of objInv.add() was first "5002 - 'Tax Definition (1)' (a very informative message to me).
    Then I checked my admin tax settings and put a check on "EU".
    The next time the result was "10 - Customer´s tax ID not defined OINV.LicTradNum"
    Actually, I don´t want to pre-set any fields in the invoice, because the order looks complete to me.
    By the way: The error occurs in SBO, too.
    Thanks for help in advance!
    Best regards
    Marian

    Hi Marian,
    Your Error "10 - Customer´s tax ID not defined OINV.LicTradNum" is not working (through DI and in SBO)
    occurs because your "Federal Tax ID" is not set up against the Business Partner. (This is on the main page of the Business Master Data Screen).
    Set this up and it will work in SBO and the DI API!

  • Unable to Create Invoice from iSupplier

    I am unable to create invoice from isupplier module,
    the moment i click on create invoice "with a PO" or "without a PO" under finance Tab,
    i get this error "You cannot complete this task because you accessed this page using the browser's navigation button(the browser Back button, for example).
    But I have not accessed the pages with any browser navigation buttons at all.
    please advise what may be preventing me from creating invoice?

    This is caused by the incorrect setup of the browser.
    The browser's "Temporary Internet Files" setting for "Check for newer versions of stored pages" was set to "Never". This caused the browser to pull up the old data instead of querying the server.
    Please make sure the browser's "Temporary Internet Files" setting for "Check for newer versions of stored pages" is set to "Automatic".
    You Used Your Browser's Navigation Buttons To Get Here (Doc ID 1214138.1)

  • Single performa invoice from multiple delivery

    Dear sir,
    my client requirement is they are doing one delivery and creating one performa invoice in export scnario while selling from plant and while doing export issue they have to take refrence performaa invoive .
    so they want to create as ingle performa invoice from multiple delivery for which already respective performa invoices have been created.so i want a single performa invoice from multiple delivery so tell me how to do it?
    thanks
    Debesh

    Go to VTFL and maintain as follows:-
    At Header
    Copying requirements:::::::::009
    At Item
    Copying requirements:::::::010
    Data VBRK/VBRP::::::::::::003
    thanks
    G. Lakshmipathi

  • Creating pdf from clipboard does not import images or formatting

    Creating PDF from clipboard works perfect in acrobat X however in acrobat XI no images are imported and the text just defaults to times roman font. My wife uses acrobat for her craft patterns and copies from the web all the time with no issues in Acrobat X. She tried it on Acrobat XI and it just looks like garbage. The text is there but the images that were copied along with the text are not. I have examples that she did using the exact same clipboard in both X and XI.

    Bill@VT wrote:
    I guess I must not understand how you are transferring the items to the clipboard. Is the browser the same one you used with AA X?
    Yes, I used the same browser (Chrome) with AA X and AA XI.
    Bill@VT wrote:
    When I did it with AA XI, I used the mouse (on a PC) to select the text and figures in my browser and copied that info to the clipboard (ctrl-C on the PC and I assume similar on the MAC).
    Yes, the procedure for copying info to the clipboard is similar for a Mac and a PC. I select the info (in this case, text and graphics) with the mouse, and can copy it to the clipboard with either Command-C (Mac equivalent of ctrl-C), or by right-clicking on the highlighted info and choosing "copy" from the pop-up window.  I do not have to use Print Screen in conjunction with this procedure. If I use Print Screen, it copies everything that my monitor displays and the results of a paste are an image.
    Is there something I am missing about getting the web page parts wanted to the clipboard? If you clip the items into a graphics packages, does the graphics show up as desired?
    No, you are not missing anything. All of the web page parts are in the clipboard. The problem is that only the text is showing up when I use the create PDF from clipboard option in AA XI. I do not have a graphics package installed; however, if I paste the clipboard contents into Word, both the text and graphics show up.
    I checked the PDF created with my AA XI and found the text as text and the the graphic as graphic, not simply a graphic as you suggested. Is it possible the graphic is shown with a place holder or just space for the graphic. If that is the case, check the preferences that you have "view large images" turned on.
    As I explained ad nauseum, the PDF I try to create with AA XI using create PDF from clipboard does not include the graphics; it only has the text. I just checked the preferences and "view large images" is turned on. I could not find any other preference settings that would seem to help with the problem I am having.
    I can paste the clipboard contents directly into Word and print the document to a PDF. When I do that, though, I usually have to spend a lot of time editing the Word document, because the contents are not in the same format. The paragraphs are usually squashed together, or the photos are too large and I have to change the size. This just takes up more time than I have to spend.
    The bottom line is that it seems to me Adobe must have changed something in the Mac version of AA XI that causes it to not work the same way it does in AA X. The PC version is obviously okay, because you are able to get the feature to work.
    I guess I am going to have to give up on this problem and stick with using AA X.
    Thanks again for all your help.

  • Order types, why do we need to create our order types and not use the stand

    HI
    Order types, why do we need to create our order types and not use the standard ones during implementation.

    Hi Raj,
    Well there is no hard and fast rule that you have to copy nad create a new order type. Its just to meet our own requirements that we copy the standard and make the changes if required to meet our business needs.
    And by this way we keep unchanged the standard order type for further use.
    If you are sure that the standard order type satisfies your need you can directly use that only.
    I hope this clarifies the issue.
    Do reward if find useful
    Regards,
    Abhi

  • How to Create PDF from Illustrator CS3 by using applescript?

    Hi Guys,
    Do some one knows how to create PDF from Illustrator CS3 by using apple script. If know, please give me the scripting.
    HARI

    Have you tried File>Scripts>SaveDocsAsPDF? There should be a folder of sample scripts installed in your AICS3 folder and a folder of documentation which contains an Illustrator AppleScript Reference which has examples.

  • Can we create invoice from po instead of receipt in P2P

    Hi,
    how to create invoice from po in p2p instead from receipts.
    Thanks and Regards,
    Srikanth

    Hi Srikanth,
    You don't need a receipt to create an Invoice.
    All depends on your matching preferences.
    2-way. 3-way, 4-way - Please go through the documentation.
    Thanks
    Vinod

  • SD delivery notes using adobe forms

    Dear Gurus,
    I need to pring SD delivery notes using adobe forms
    I tried to assign:
    Program: RVADDN01                               
    Routine: ENTRY
    Form: RVDELNOTE
    But it is not working....Do you have any idea?
    Regards,
    MaX

    Solved...use ENTRY_PDF

Maybe you are looking for