Add A/P Invoice directly using DIAPI

HI Experts, I am developing an application for SAP B! 2007 B , In the application i need to create a Button on Purchase Order Screen, when that button is clicked the data from the purchase form should split and copied in to number of invoices these invoices shud be be added automatically with out opening the Invoice Screen. For this i am able to create a button on Purchase screen and now i need to write the functionality of adding invoice I have developed a code which is not executing properly plz go through the code any suggest me the mistake i have done.
oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
oInvoice.CardCode = fform.Items.Item("4").Specific.value
ovInvoice.HandWritten = tNO
oInvoice.PaymentGroupCode = "-1"
oInvoice.DocDate = System.DateTime.Today.Date
oInvoice.DocTotal = 275.0
Dim sNewObjCode As String
Dim i As Integer
Dim k As Integer
k = fform.Items.Item("8").Specific.value
' Get last added document number (the order that was added)
sNewObjCode = "3" _
oCompany.GetNewObjectCode(sNewObjCode)_
oItem = fform.Items.Item("38")
oMatrix = oItem.Specific
' this loop adds the different items to the invoice object
i = 1
While i < oMatrix.RowCount
oInvoice.Lines.BaseEntry = sNewObjCode
oInvoice.Lines.BaseLine = i
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.ItemCode = oMatrix.Columns.Item("1").Cells.Item(i).Specific.Value
oInvoice.Lines.ItemDescription = oMatrix.Columns.Item("3").Cells.Item(i).Specific.Value
oInvoice.Lines.TaxCode = oMatrix.Columns.Item("160").Cells.Item(i).Specific.Value
oInvoice.Lines.PriceAfterVAT = 118 oInvoice.Lines.Quantity = 1
i = i + 1
oInvoice.Lines.Add()
End While
' Try to add the invoice object to the database
lRetCode = oInvoice.Add()
If lRetCode <> 0 Then ' If the addition failed
oCompany.GetLastError(ErrCode, ErrMsg)
MsgBox(ErrCode & " " & ErrMsg) ' Display error message
Else 'cmdInvoice.Enabled = True MsgBox("inv Added to DataBase", MsgBoxStyle.Information, "Order Added")
End If
I am receiving an Error that No matching records found. Plz get me the solution as soon as possible
Regards, mahii

Hi,
The method
oCompany.GetNewObjectCode(sNewObjCode)
can only be used to obtain the latest object that you added from the same DI API connection. You cannot obtain the docEntry of the PurchaseOrder created by the B1 user in your code. You will need to get the information from the screen after the Purchase Order is added (I suppose your button is chosen after the PO has been created in the database).
Hope it helps
Trinidad.

Similar Messages

  • Can I add iOS directly using my ipad?

    Can I add iOS directly using my ipad?

    Not if you are running iOS 4.3.3 as your tagline indicates. You must update with the latest version of iTunes on a computer. This explains how to do it, if you don't already know how.
    http://support.apple.com/kb/HT4623

  • Hello and HELP! Over the years I have saved Invoices in my Documents. I have just tried to open them and all I am getting is " cannot be opened, Invoice**** is used by another user, do you want to make a copy?" That's on all my invoices.

    Can someone help please.
    I have just "lost" ( cannot open) all my saved Invoices in the Document folder.  All I am getting is " cannot open, Invoice ** is used bey another user, do you want to make copy? " That doesn't work either. I can't get anything on the time capsule either. How can I reset to an earlier time? Or what can I do?
    Thank you

    Did you recently reinstall the OS then copy all your files back over? Do a Get info on one of the documents and see if your current UserName is listed and has Read & Write permissions. If not select the Documents folder and check that for Read & Write permissions for your UserName. If it doesn't have R & W permissions Add it so it does.

  • Non-po invoice posting using IDOC into LIV module

    Hi,
    does anyone know if idoc interface is available for posting non-po invoice as an LIV invoice into MM module. what  I found that I can post the idoc to FI module directly using message code - FI.
    Thanks.

    Hi
      I Got your name from this site.I would be very thankful if you can help me here.I am designing a EDI based invoice LIV.Is it possible to post some charges which are without PO reference but are coming in Vendor Invoices.Is it possible to post these kind of charges with EDI message INOIC01 or we have to post through FI posting.If possible through EDI in which segment of IDOC we will enter these charges with amt.Also is it possible to post credit memo also with EDI
    Thanks
    Sanjeev

  • HT1277 I have quickbooks software. I am traveling. I tried to send an invoice out, using the mac email (version 5.3) I can't send the mail out. I get a pop up asking for my password, I put the password in and it does not accept it.

    I have quickbooks software. I am traveling. I tried to send an invoice out, using the mac email (version 5.3) I can't send the mail out. I get a pop up asking for my password, I put the password in and it does not accept it. This is the 1st time I've had this problem.
    slpmtns

    Whilst it may not be your fault I am afraid it appears that your post is on a forum which is not the best for your OS. It will save the time of the unpaid volunteers here, and may resolve your issue faster, if you could examine the list below and see if there is a more appropriate forum to which you could direct your question.
    OS X 10.9 Mavericks
    OS X 10.8 Mountain Lion
    OS X 10.7 Lion
    OS X 10.6 Snow Leopard
    OS X 10.5 Leopard
    OS X 10.4 Tiger
    OS X 10.3 and earlier
    OS 9, OS 8 & System 7
    OS X Technologies
    OS X Server
    iPad
    iPhone
    iPod
    Other

  • Removing attachments from Purchase Order using DIAPI

    Dear all,
    I have added attachment to PO using DIAPI. I have given below the code.
               Dim oAtt As SAPbobsCOM.Attachments2 = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oAttachments2)
                Dim FileName As String = ""
                Dim SourceFile As String = ""
                Dim DestinationFile As String = ""
                For i As Integer = 0 To PurchaseOrderInfo.Attachments.Length - 1
                    FileName = PurchaseOrderInfo.Attachments(i).FileName
                    SourceFile = PurchaseOrderInfo.Attachments(i).SourcePath & "\" & FileName
                    DestinationFile = PurchaseOrderInfo.Attachments(i).TargetPath & "\" & FileName
                    If i > 0 Then oAtt.Lines.Add()
                    oAtt.Lines.SetCurrentLine(i)
                    oAtt.Lines.FileName = System.IO.Path.GetFileNameWithoutExtension(FileName)
                    oAtt.Lines.FileExtension = Replace(System.IO.Path.GetExtension(FileName), ".", "")
                    oAtt.Lines.SourcePath = PurchaseOrderInfo.Attachments(i).SourcePath
                    If System.IO.File.Exists(DestinationFile) Then
                        System.IO.File.Delete(DestinationFile)
                    End If
                    If PurchaseOrderInfo.Attachments(i).Override = True Then
                        oAtt.Lines.Override = SAPbobsCOM.BoYesNoEnum.tYES
                    Else
                        oAtt.Lines.Override = SAPbobsCOM.BoYesNoEnum.tNO
                    End If
                Next
                Dim iAttEntry As Integer = -1
                Dim lResult As Long
                Dim lErrCode As Long, sErrMsg As String = ""
                lResult = oAtt.Add()
             It works fine. But, I am not  able to remove an attachment via diapi.
             Could you please help me how to solve this.
    Thanks in advance.
    Manikandan

    I am pretty sure you are looking for SAP Business One SDK Topic Space. To ensure you are posting in the correct SCN Space, always check the description for the Space under the Overview tab.
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada

  • Link Invoice Document using Easy Document Management

    Hi All, is there any way to use Easy Document Management System to attach a scanned document like a PDF to an invoice document.
    If it is there, is it easy to customize?
    We are trying to evaluate different scanning solutions and trying to see if we can make DMS work without purchasing any other software.
    Thanks

    Wrong module. DMS is not designed for invoices. DMS is designed for documents that change and need versioning.
    ArchiveLink is the correct solution/module. This allows you to link incoming invoices directly to the object in SAP in MIRO and FB60.
    If its outgoing invoices, you can link them to sales orders. The document is stored in the GOS (generic object services) area of SAP and will appear in the attachment list. If you go to GOS you will see an option called "Store Business Document" which will be made available when you have configured this properly.
    There is no easy way to customise. You have to install a content server (See SAP HTTP content server) and then configure the document type and which object it will be linked to. You also have to configure the method of processing. I.e. early archiving, late archiving.
    It is possible to set this up using no external software except the SAP HTTP content server which is free with your SAP licensing.

  • How to print customer Sales Invoice directly from FI module?

    Hi,
    How to print customer Sales Invoice directly from FI module without using SD's t-code VF02 and VF03?

    hi,
    only way in FI is Correspondence functionality usage. Please config it and use F.61 or F.64 to print it.
    regds,
    raman

  • AR Invoices directly from Legacy Sources

    We have legacy sources provide the billing information. The data provided by legacy is pretty complete and we can create the AR invoices with the data provided. Is it a good idea to create customer invoices directly in AR instead of processing the data through Order Management.
    Is there a white paper which suggests this? Does anyone have any idea about this?

    Hi,
    In order to do so, you can use AR open interface tables:
    ra_interface_lines_all: record invoice lines, freight and tax information
    ra_interface_salescredits_all: sales credit information
    ra_interface_distributions_all: record accounting information, if you do not want use receivables autoaccounting.
    You must set up imported batch sources, grouping rules and new interface transaction flexfield contexts. The first one, besides giving your transaction numbering, will define if you are going to send ids or descriptions in interface fields. The second one defines if lines are going to be grouped into one invoice or going to be divided in two or more invoices. The transaction flexfield context is commonly used to link receivables transactions to your legacy system.
    You may want read metalink note 220251.1, it is very useful.
    Regards,
    Ketter Ohnes

  • Unable to add Incoming Excise Invoice

    Hi All,
    While trying to add Incoming Excise Invoice, I'm gettin an error message,"Tax Definition, Message 173". I have checked the tax code and type, all the accounts are mapped here . What is causing this error and how to correctly add this document??
    Thanks in advance,
    Joseph

    Hi,
    Refer this note:559660  on Error message "Tax Definition (No.)" appears
    Symptom
    When attempting to add a document the message -"Tax Definition (No.)" appears
    Other terms
    Tax Definition, Error, Invoice, Credit Memo, AP Invoice, Message, Red, Add, Document, Invoice, Payment
    Reason and Prerequisites
    No General Ledger (G/L) account has been defined for tax groups used in the document
    Solution
    When you add a document that creates an automatic Journal Entry (e.g. Invoice, AP Invoice and Credit Memo), a relevant posting must be placed in accounting for the tax amounts in the document.
    If you select tax groups with a tax % of more than zero, then this must be recorded in the accounting system to the appropriate G/L Account defined for the tax group in "Administration" -> "Definitions" -> "Define Tax Groups" -> "VAT Account" / "Acquisition Tax" columns
    If no G/L Account has been selected for this kind of group, the system will display an error message, indicating the row number that contains a tax group with no G/L Account e.g.(1) and the document will not be added
    To remedy the described problem please perform the following steps:
       1. Select "Administration"
       2. Select "Definitions"
       3. Select "Define Tax Groups"
       4. Locate the tax group you used in the document
       5. Locate the VAT Account column and select an appropriate G/L account
       6. In case this tax group is of Input Tax type and the Acquisition Tax column is flagged you need to also select a G/L account in the Acquisition Tax column
    Hope this is helpful !

  • When I add a quicktime asset directly to my DVD SP project it does not automatically encode to be DVD cmpliant. Says incompatible asset. Any ideas?

    When I add a quicktime asset directly to my DVD SP project it does not automatically encode to be DVD cmpliant. Says incompatible asset. Any ideas?

    You use the term "QuickTime Asset" like it means something.  QuickTime is just a container ... a QuickTime file could be made from any number of codecs, many of which are not compatible with DVD Studio Pro.
    What codec is the file you're trying to import?  Have you considered using Compressor to encode it to the proper format?
    -DH

  • Error when adding document lines using DIAPI

    Error: "Item no. is missing  [ORDR.ObjType]"
    Hi
    I m getting [mentioned above] error when i try to add more line in rdr1 that is same as existing row, and try to update document object.
    <b>Problem:</b>There is already one row in rdr1 and i have to add a new row using DIAPI.
    Thx

    Hi Pankaj,
    Can you please post your code? If you've got oDoc.Lines.Add in there try to remove it and see if it has the desired effect. If you look at the document in the SBO GUI you'll see that there is already an empty line in the order. I haven't tested it, but try it out.
    Hope it helps,
    Adele

  • SRM PO failed: Indicator for GR-based invoice verification used not allowed

    Hi Friends,
        I have an issue with a specific PO failed to transfer from SRM to ECC. We are in ECS scenario, SRM 5.0 Service level 7.0. We are in process of SP upgrade but this issue occured in Production system which is still in old SP level(SP 7.0).
    when I check the App Monitor, I am see the following errors:  but the status shows Auto_Completed
    1. PO: Indicator for GR-based invoice verification used not allowed
    2. PO: Instance XXXXXXXXXX of object type PurchaseOrder could not be changed
    3.  PurchOrder XXXXXXXXXX: Purchase order still contains faulty items
    4.  PO XXXXXXXX: Indicator for GR-based invoice verification used not allowed
    I can see the PO copied over to ECC. but status in SRM PO shows 'Error in Process'.
      BBP_PD for object PO shows:  Created, complete, ordered, In Transfer to Execute, Change was Transmitted  as Inactive status.    Transfer Failed shows Active, Document completed, created.
    I checked BP Maintain  for the vendor and PO and its no different than other POs and Vendors except Vendor had 'Goods Receipt based Invoice Verification' indicator checked in SRM.
    I tried to simulate the same Material, Vendor with GR-IV indicator both on and off, it works fine. Ofcourse this is in Quality box with SP 15 level.
    So, I am not sure if SP level upgrade might help it or not? If there are any other means to test, please advise.
    thanks
    Rao

    I was wondering how I could liquidate the PO by either creating a new PO or ??.
    What you could do to revive the PO in question is that after the upgrade, and after a round of background jobs run for CLEAN_REQREQ_UP and BBP_GET_STATUS_2, ask the buyer to make a dummy change to the PO (for example, change the description of the PO) and order again. This would trigger the transfer to the backend again. And hopefully this time, no error would occur.

  • How do I install 10.9.1 directly using an Air with 10.6.8 Snow Leopard?

    How do I install 10.9.1 directly using an Air with 10.6.8 Snow Leopard? My friend shared a copy of the 10.9.1. installer but i can't seem to make it work. Help please!

    Your friend's installer is tied to his computer, and will require his Apple login id to insall, as well as any future updates.  Since you have Snow Leopard, 10.6.8, use the App Store app and create your own Apple login to download Mavericks from the App Store.  It is free.
    Have a nice day.

  • My HD is almost full. I need to add space. Can I use an external HD to continue using my startup disc as it is?

    My HD is almost full. I need to add space. Can I use an external HD to continue using my startup disc as it is?
    I create music and have run out of space. the message says 'your startup disc is almost full', and i just thought maybe buying an external hard drive and using it as the startup disc or whatever would do the trick. Does anyone know? Thanks!

    External hard drives are relatively inexpensive...see some of those on OWC, www.macsales.com
    You can use a large external drive to provide additional space by simply saving material to that volume instead of the startup disk.  You can also partition the external drive to use part for Time Machine backups, and another partition for extended space.  Or a third partition for a clone of the boot system made by Carbon Copy Cloner or SuperDuper, both free downloads, so should the internal drive have problems you could always boot from the external partition.
    All of that can be done from Disk Utility.
    Keep in mind that Mac OS X gets very unhappy when there is less than 15% of the startup disk space free.

Maybe you are looking for

  • Multipe swf try out with adobe air 3.6 on ipad - black screen

    Hello Everyone, I am trying to build our app with the new adobe air 3.6, i read that i should build in aot mode to achieve it to work properly. In Flash Builder simulator the app works well, i see the assets in position(whitch is loaded from another

  • Transfering photos from ipod to computer?

    Hello! i used to sync my photos in ipod with my computer. But my computer crashed and i had to change a new computer. Then, i realised that i can't transfer the photos that are already in my ipod to my new computer. The photos in ipod are in a file f

  • Dreamweaver silently detects syntax problem

    I have a .cfm file which I've been maintaining for a few years. Recently while editing the file in DW6, DW began to fail to recognize that the file is a Cold Fusion file.  Common keyboard shortcuts, both general and CF-specific just won't function. 

  • Accessing the content of the MediaPlayer for filtering purposes

    Am I correct in assuming that you can access the content of an element in the MediaPlayer so that you can apply a filter directly to it? If this is possible how can this be done? So far all my attempts to access the media content directly have failed

  • Sharing music between two users

    I share a Macbook with my wife. I have a great music library on my account and would like to share it with her on her account. Where should I put the files so we both have access without doubling our hard drive space? Thanks to all who reply!!