Trying to create a Invoice based on Order need help Error -5002

the dreaded -5002 error is haunting me too! and I could not find a matching solution for this in the forum....
I need help quickly on this. I am trying to create invoices for some orders so the Base - Target relationship is retained. The orders I pick are all Open (DocStatus   = O and the lines are all Open LineStatus = O)
here is my code
oInvoice.Lines.BaseEntry = 48
oInvoice.Lines.BaseLine = 0
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.ItemCode = "A00001"
oInvoice.Lines.ItemDescription = "IBM Infoprint 1312"
'adding Line
oInvoice.Lines.Add
oInvoice.Lines.BaseEntry = 48
oInvoice.Lines.BaseLine = 1
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.ItemCode = "A00002"
oInvoice.Lines.ItemDescription = "IBM Inforprint 1222"
'adding Line
oInvoice.Lines.Add
lRetCode = oInvoice.Add
If lRetCode <> 0 Then
    gObjCompany.GetLastError lErrCode, sErrMsg
    MsgBox (lErrCode & " " & sErrMsg)
End If

Indika,
Only set your base types...
(not items & description)
oInvoice.Lines.BaseEntry = 48
oInvoice.Lines.BaseLine = 0
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.ItemCode = "A00001"
oInvoice.Lines.ItemDescription = "IBM Infoprint 1312"
'adding Line (to fill the second item line)
' the 1st line item is there by default
oInvoice.Lines.Add
oInvoice.Lines.BaseEntry = 48
oInvoice.Lines.BaseLine = 1
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.ItemCode = "A00002"
oInvoice.Lines.ItemDescription = "IBM Inforprint 1222"
'DO NOT Add THIS line
' (only if you want to add a 3rd line item)
'''oInvoice.Lines.Add -> Don't add this
lRetCode = oInvoice.Add
If lRetCode <> 0 Then
    gObjCompany.GetLastError lErrCode, sErrMsg
    MsgBox (lErrCode & " " & sErrMsg)
End If
remember to add :
oInvoice.CardCode = "your BP"
oInvoice.DocDueDate = Now
oInvoiceDoc.CardCode = txtDOCBPCode.Text

Similar Messages

  • Trying to create a Field Validation Expression and need help

    I have a picklist field and another field that are in question. I want to set some sort of rule that forces the second field to be populated only If specific values are selected from the picklist field.
    I was going the route of a field validation Rule, but everything i've tried so far does not produce the results i am trying to achieve.
    The first type of expression i tried was:
    ([<plProduction_Print_Account_Category_ITAG>] <> LookupValue("OCC_CUST_LOV_ACCOUNT_1", "No Production Print") AND ([<stSIC_Code_ITAG>] IS NULL))
    This is generating the field validation error message when i select any of the correct values from the picklist. the problem is still the second field, which will generate the error if a value is entered into the second field, regardless of the picklist value selected. Switching the "IS NULL" to "IS NOT NULL" only reverses the problem on the second field, causing the error to generate when the second field is updated to a NULL or blank value.
    I also tried :
    = 'No Production Print' AND [<stSIC_Code_ITAG>] IS NOT NULL
    and got similar results.
    ([<plProduction_Print_Account_Category_ITAG>] = LookupValue("OCC_CUST_LOV_ACCOUNT_1", "No Production Print"))
    Similar results as well.
    Does this need to be an IIF statement? Do I need to make this a workflow expression instead? i could really use some help as I have tried everything i can think of and admit, i'm not the expression guru!!!. Any assistance would be appreciated.
    TeknoMan

    Yes we have the same request and we used the following expression. Example we have a field "Método de pago" ( [<plMtodo_de_pago_ITAG<]), it's values are "CHEQUE and DEPOSITO" if we select DEPOSITO three more fields were requiered Route, Sucursal de banco and Clabe so we have to put this validation in the four fields including Metodo de pago.
    [<plMtodo_de_pago_ITAG>] <> "DEPOSITO" OR ([<Route>] IS NOT NULL AND [<nSucursal_de_banco_ITAG>] IS NOT NULL AND [<stCLABE_ITAG>] IS NOT NULL)
    well in the field CLABE we put the following [<plMtodo_de_pago_ITAG>] <> "DEPOSITO" OR ([<Route>] IS NOT NULL AND [<nSucursal_de_banco_ITAG>] IS NOT NULL AND [<stCLABE_ITAG>] IS NOT NULL AND Len([<stCLABE_ITAG>])=18) this was because the len of the value must be 18 characters.
    I hope this works for you
    Regards Catalina Valadez
    Edited by: CatalinaV on 12/03/2009 10:54 AM
    Edited by: CatalinaV on 12/03/2009 10:55 AM

  • Error message when trying to create a new account (was: Hi, need help)

    Hi, I need your help, I have come across a problem, I want to create a new account, but the problem is with the server Developer Toolbox concern, but we are not in memory

    How come Leopard let me use the WGM in standard mode?
    While SA complains that it won't work in Standard Configuration, WGM does not. There is some fault in the logic of this for which I don't have an explanation.
    If I want to get control on Dock, selection of Home folder, config of Proxy... which I think are basic things, do I really need the advanced mode?
    If you wish to have complete control of all client settings, yes. There really is no disadvantage of using an Advanced configuration other than the learning curve.
    So if I switch to advanced mode, there is good chance I won't get this error message anymore, right?
    Yes.

  • 8.8 Invoice based on Order

    Hi all,
    I am trying to create an invoice based on a sales order.
    I have this code which worked fine in SBO 2007 but now in 8.8 I get -2010 : Internal error
    oDoc = (SAPbobsCOM.Documents) oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);
    oDoc.CardCode = sCardcode;
    oDoc.Lines.BaseType = 17;
    oDoc.Lines.BaseEntry = int.Parse(docentry);
    oDoc.Lines.BaseLine = 0;
    Can anyone help me with this?
    Thanks

    Hi Gordon,
    It is a variable, but that is not the issue I think.
    But just in case: here is the complete code
    oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
    try
         SAPbobsCOM.Documents oDoc = (SAPbobsCOM.Documents) oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);
         Matrix matrix = Matrix.GetFromUID(pVal.Form, "10");
         int rowcount = matrix.Rows.Count;
         string prev_docnum = "";
         string docnum = "";
         string docentry = "";
         string cardcode = "";
         int retval = 0;
         for(int i = 0;i <= rowcount-1;i++)
              docnum = matrix.GetValue("11", i);
              cardcode = matrix.GetValue("10", i);
              string regel = matrix.GetValue("12", i);
              string itemcode = matrix.GetValue("8", i);
              if(prev_docnum != docnum)
                   if(prev_docnum != "")
                        retval = oDoc.Add();
                        if(retval != 0)
                             int errcode;
                             string errmsg;
                             oCompany.GetLastError(out errcode, out errmsg);
                             StatusBar.WriteError(String.Format("Fout bij verkooporder {0} - {1}: [{2}] {3}",
                                  docnum,
                                  cardcode,
                                  errcode.ToString(),
                                  errmsg));
                        else
                             string newdoc;
                             oCompany.GetNewObjectCode(out newdoc);
                             SAPbobsCOM.Recordset oRs = (SAPbobsCOM.Recordset) oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                             try
                                  oRs.DoQuery(String.Format("SELECT DocNum, convert(varchar(8),DocDate,112), CardName FROM OINV WHERE DocEntry = '{0}'", newdoc));
                                  StatusBar.WriteSucess(String.Format("Nieuwe factuur aangemaakt: {0} - {1}",
                                       oRs.Fields.Item(0).Value.ToString(),
                                       oRs.Fields.Item(2).Value.ToString()));
                             finally
                                  System.Runtime.InteropServices.Marshal.ReleaseComObject(oRs);
                                  oRs = null;
                                  GC.Collect();
                        oDoc = null;
                        oDoc = (SAPbobsCOM.Documents) oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);
                   // GET DOCENTRY
                   SAPbobsCOM.Recordset oRsDoc = (SAPbobsCOM.Recordset) oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                   try
                        oRsDoc.DoQuery(String.Format("SELECT DocEntry FROM ORDR WHERE DocNum = '{0}'", docnum));
                        docentry = oRsDoc.Fields.Item(0).Value.ToString();
                   finally
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(oRsDoc);
                        oRsDoc = null;
                        GC.Collect();
                   oDoc.CardCode = cardcode;
                   oDoc.DocDate = DateTime.Now;
              oDoc.Lines.BaseType = 17;
              oDoc.Lines.BaseEntry = int.Parse(docentry);
              oDoc.Lines.BaseLine = int.Parse(regel) - 1;
              oDoc.Lines.Add();
              oDoc.Lines.SetCurrentLine(int.Parse(regel) - 1);
              prev_docnum = docnum;
         // ADD LAST INVOICE
         retval = oDoc.Add();
         if(retval != 0)
              int errcode;
              string errmsg;
              oCompany.GetLastError(out errcode, out errmsg);
              StatusBar.WriteError(String.Format("Fout bij verkooporder {0} - {1}: [{2}] {3}",
                   docnum,
                   cardcode,
                   errcode.ToString(),
                   errmsg));
         else
              string newdoc;
              oCompany.GetNewObjectCode(out newdoc);
              SAPbobsCOM.Recordset oRs = (SAPbobsCOM.Recordset) oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
              try
                   oRs.DoQuery(String.Format("SELECT DocNum, convert(varchar(8),DocDate,112), CardName FROM OINV WHERE DocEntry = '{0}'", newdoc));
                   StatusBar.WriteSucess(String.Format("Nieuwe factuur aangemaakt: {0} - {1}",
                        oRs.Fields.Item(0).Value.ToString(),
                        oRs.Fields.Item(2).Value.ToString()));
              finally
                   System.Runtime.InteropServices.Marshal.ReleaseComObject(oRs);
                   oRs = null;
                   GC.Collect();
         oDoc = null;
    catch(Exception ex)
         StatusBar.WriteError(ex.Message);

  • Creating an invoice based on a delivery via DI API

    Hi,
    Each time a user creates a delivery (not always based on a sales order), the add on I have developed creates an invoice based on it. This happens without any issue in most cases but I am receiving the following two errors on the client site and have not been able to recreate the issue here...
    One of the base documents has already been closed  [INV1.BaseEntry][line: 1]
    Number of items drawn is greater than open quantity  , 'Item A'
    Does anyone have any idea what could be causing this?
    Thans for any help,
    Robin

    Hi Thomas,
    Thanks for teh reply but unfortunately this is not the case - for example...
    A delivery which is returning this error for Item A, has a quantity of 20 but has 7400 in stock, so it is not going into a negative quantity.
    The only way I could get this error ("Number of items drawn is greater than open quantity"), not using the add on but working within B1, was to create a delivery note, then create an invoice based on it, increase the quantity of the item on the invoice, and the error displays in B1 on the info bar at the bottom.
    I cannot see how the user can affect this, as when they are creating the Delivery, the Invoice creation is automatic (triggers on the add button after the Delivery has been successfully added), and they don't even see the Invoice form.
    Robin

  • How to Create Excise Invoice (J1IIN) with order related billing document

    Dear Experts,
    Is it possible  to Create Excise Invoice (J1IIN) with order related billing document? How? please guide
    Regards
    BK GAIKWAD

    Sir,
    We have make the supplementary Invoice (Debit Note) as per below process
    1) Create sales order_VA01
    2) Create billing document_VF01_with reference to sales order
    3) Create Excise Invoice With J1IS (Other Movement) It is manually job & due to heavy work load (create 200 invoice  per day) it is not possible to do manually.
    Hence we want to create excise Invoice with J1IIN instead of J1IS, any alternative solution for that?
    Regards
    BK GAIKWAD

  • I am trying to create a community addition, but just keep getting *Error occurred while saving your data.

    I am trying to create a community addition, but just keep getting   *Error occurred while saving your data.
    Trying to add the following community addtion for:     http://technet.microsoft.com/en-us/library/cc755631(v=ws.10).aspx
    In the above website do NOT copy the command, you have to type it in.  Webpage Error.
    You can use both    dsquery server –hasfsmo schema    and    dsquery server -forest –hasfsmo schema
    The problem is, I believe, a hidden character in the command on this webpage which follows the Paste function and results in the error Unknown Parameter error.

    Hi John,
    You might have better luck posting this in the library feedback forum here:
    http://social.msdn.microsoft.com/Forums/en-us/home?forum=libraryfeedback&filter=alltypes&sort=lastpostdesc
    It seems odd to me that the TechNet library feedback forum lives under the MSDN branding, but that seems to be the case.
    Don't retire TechNet! -
    (Don't give up yet - 12,575+ strong and growing)

  • I am getting a 42404 error message when opening itunes and itunes will not let me connect my iphone to it trying to get me to restore. I need help?

    I am getting a 42404 error message when opening itunes and itunes will not let me connect my iphone to it trying to get me to restore. I need help? I am not that technically inclined and really simple terms  are appreciated.

    Try downloading the songs from a different device. If you are doing it from your iOS device, try form your computer.

  • Create a Invoice based in a Order

    How can I create a Invoice using the object Documents?.
    If I have a Document of a Order and i want copy these Order in a Invoice.
    I don't want copy field to field.

    Hi Santiago,
    You should set the values for the fields BaseEntry BaseLine and BaseType for the invoice lines.
    Here you have an example:
    Public Sub baseDocument()
        Dim oinv As SAPbobsCOM.Documents
        Set oinv = sbocompany.GetBusinessObject(oInvoices)
        oinv.CardCode = "CardCode001"
        oinv.DocDueDate = Now
        oinv.Lines.BaseEntry = 105
        oinv.Lines.BaseLine = 0
        oinv.Lines.BaseType = 17
        oinv.Lines.Add
        oinv.Lines.BaseEntry = 105
        oinv.Lines.BaseLine = 1
        oinv.Lines.BaseType = 17
        ret = oinv.Add
        If ret <> 0 Then
            sbocompany.GetLastError ret, errStr
            sboappl.MessageBox ("Error creating the invoice " & ret & " " & errStr)
        Else
            sboappl.MessageBox ("Invoice created")
        End If
    End Sub
    Hope helps,
    Ibai Peñ

  • Error while creating AR Invoice from Sales order

    Hi All,
    I have created a sales order ,when i try to create AR Invoice through Copy To option i am getting an error
    Business partner of copied down payment document must be the same as business partner of target document
    Please help me to solve this issue
    Thanks in Advance
    Regards
    Arun

    Hi Arun,
    Check if you have Down payment AR Invoice created from this Sales order.
    Thanks,
    Gordon

  • Creation of invoices based on orders

    Hi All,
    Can anybody explain me about below point:
    <b>The System's orders listed are in OPEN status and ready to Invoice.
    Please create Invoice against these orders</b>
    Can anybody tell me steps in creating the <b>Invoice from the given Sales Order's</b>.
    The way i am doing is:
    <b>1. Goto VA02 given Open Sales Order and then Hit Enter.
    2. Then from Menu Path Sales Document -> Billing hit on Billing
    3. It will then take us to VF01 screen with all the data filled in.
    4. Then i am hitting on the SAVE Button then an Invoice Number is getting created.</b>
    <b>Is it the way to create Invoice from Order.</b>
    Can anybody give your sujjestions!
    Thanks in advance.
    Thanks,
    Deep.

    Hi!
    To create an invoice for an SD order, is reuiring the correct customizing for that order type.
    Invoices can be made from orders, or deliveries.
    The standard way to create an invoice, is to call the transaction VF01, then enter the reference document number in the table (order or delivery).
    The way, you wrote is correct also.
    Regards
    Tamá

  • Error : Add Delivery/Invoice based on order

    Hello
    I try to add deliveries (or invoices) based on a range of orders (via SDK). Everything works fine, except for one order, where I get the error message:
    "-5002 Quantity falls below minimum stock [DLN1.ItemCode][Line:2]"
    If I try to add a delivery (or an invoice) based on the same order in SBO itself (so not via SDK), I also get a message concerning the minimum stock, but I have the option to continue and ignore the message.
    Is it possible via the SDK to work around this message and to let SBO know that it doesn't bother me that we fall below minimum stock?
    Thank you very much
    Iris Spenninck

    Hello Iris,
    When sth. works in the application - showing a warning or not - it should also work through DI API.
    Anything else is a bug that you should report to SAP Support via SAP Service Marketplace!
    Regards,
    Frank

  • DIAPI : How to create a purchaseOrder based on orders ?

    Hi,
    How can I create a PurchaseOrder based on a orders.
    When I execute this code
    Dim OPOR As Documents = DirectCast(oCompany.GetBusinessObject(BoObjectTypes.oPurchaseOrders), Documents)
            OPOR.CardCode = "F0001" ' My Supplier
            OPOR.DocDate = Date.Now
            OPOR.Lines.Quantity = 2
            OPOR.Lines.BaseEntry = 16
            OPOR.Lines.BaseLine = 1
            OPOR.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
            OPOR.Add
    i have this error
    Base document card and target document card do not match.
    Bruno

    Hello Bruno,
    In 2005 you can do a workarround. Maybe this still works for 88.
    First: add a PO with the Supplier and the first row (first itemrow of your SO), save the PO.
    Second: Get the PO. Add all rows from your SO with baseentry, baseref, basetype and including the first row (the first and second are the some, only the second has a baseref/entry etc), save the PO.
    Third: Get the PO and delete the first row, save the PO.
    This is not exactly the behaviour of SBO-GUI. But you can use the baseentry etc for the relation between the PO and SO.
    HTH.
    Regards Teun
    Edited by: T. Aben on Feb 7, 2012 9:36 AM

  • Trying to create object of a class within servlet - help!!

    I have created and compiled the following classes within
    C:\bea\wlserver6.1\config\mydomain\applications\DefaultWebApp\WEB-INF\classes
    1)LoginServlet
    2)LoginManager
    3)I have LoginServlet trying to create an object of type LoginManager, very simple,
    but I get the following errors:
    Cannot resolve symbol: LoginManager lm = new LoginManager();
    ^
    Cannot resolve symbol: LoginManager lm = new LoginManager();
    ^
    4)I have the .java and .class files located within the same directory, so I don't
    see what's wrong here??? HELP!
    LoginManager looks like:
    public class LoginManager {
    public boolean authenticateUser(String username, String password){
              boolean status = false;
    //simple code for string matching
              return status;
    LoginServlet looks like:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class LoginServlet extends HttpServlet {
         // Constructors
         // Variables
         public static final String CONTENT_TYPE = "text/html";
         public boolean LOGIN_STATUS;
         // Methods
         public void service (HttpServletRequest req, HttpServletResponse res)
              throws IOException {
              String username = "";
              String password = "";
              LoginManager lm = new LoginManager();
              username = req.getParameter("username");
              password = req.getParameter("password");
              LOGIN_STATUS = lm.authenticateUser(username, password);
              res.setContentType(CONTENT_TYPE);
              PrintWriter out = res.getWriter();
              out.println("<html><head><title>Hello World</title></head>" +
                             "<body>Hello! Your login status is " + LOGIN_STATUS +
                             "</body>" +
                             "</html>");
         public void init (ServletConfig config) throws ServletException {
              super.init(config);

    Do you have . in the CLASSPATH when compiling your servlet?
    ron <[email protected]> wrote:
    I have created and compiled the following classes within
    C:\bea\wlserver6.1\config\mydomain\applications\DefaultWebApp\WEB-INF\classes
    1)LoginServlet
    2)LoginManager
    3)I have LoginServlet trying to create an object of type LoginManager, very simple,
    but I get the following errors:
    Cannot resolve symbol: LoginManager lm = new LoginManager();
    ^
    Cannot resolve symbol: LoginManager lm = new LoginManager();
    ^
    4)I have the .java and .class files located within the same directory, so I don't
    see what's wrong here??? HELP!
    LoginManager looks like:
    public class LoginManager {
    public boolean authenticateUser(String username, String password){
              boolean status = false;
    //simple code for string matching
              return status;
    LoginServlet looks like:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class LoginServlet extends HttpServlet {
         // Constructors
         // Variables
         public static final String CONTENT_TYPE = "text/html";
         public boolean LOGIN_STATUS;
         // Methods
         public void service (HttpServletRequest req, HttpServletResponse res)
              throws IOException {
              String username = "";
              String password = "";
              LoginManager lm = new LoginManager();
              username = req.getParameter("username");
              password = req.getParameter("password");
              LOGIN_STATUS = lm.authenticateUser(username, password);
              res.setContentType(CONTENT_TYPE);
              PrintWriter out = res.getWriter();
              out.println("<html><head><title>Hello World</title></head>" +
                             "<body>Hello! Your login status is " + LOGIN_STATUS +
                             "</body>" +
                             "</html>");
         public void init (ServletConfig config) throws ServletException {
              super.init(config);
    Dimitri

  • Trying to create new user and getting remote procedure call error

    I'm trying to create a new user on my windows 8.1 machine but it's not letting me.
    If i open control panel and go to user accounts there's not even an option to add a new user. It's like it's missing, there si a blank space where the link should be. I can change my current account type, and manage another account (though that takes me
    to the list of accoutns which shows mine and the guest, but no option to add a new one) or change user account control settings.
    If i open the run menu and type "users" there is a program that shows up labeled "add, delete and manage other user accoutns" but if I click that a dialog pops up with the following message
    I've run sfc /scannow and it says there are corrupt files but that it couldnt repair them and logged them in the CBS.log

    OK I tried to run sfc /scannow again, and it said files needed to be fixed on a reboot. I rebooted and I can now create user accounts. So never mind, folks!
    Kyle

Maybe you are looking for

  • Javascritpt to check if data exists before entering

    I have a form that users fill out.. I want the first (user_ID)field to kick off a javascript that: 1. makes it upper case while typeing (this I have working): onKeyUp="javascript:this.value=this.value.toUpperCase();" 2. runs a select statement to see

  • Installation Error: ImportABAP Phase

    Hello, I am installing Nerweaver 2004s SR2 in my Desktop, I got following error in middle. OS:windows 2003 server DB: Oracle 10g SAP: Netweaver 2004s SR2 When Installation is going on ( Phase No: 19, ImportABAP) unexpected power got shutdown my syste

  • [SOLVED] pacman error: database not found (during an install)

    i am trying to install an app when installing # pacman -S /path/to/dir/app.tar.gz error: database not found when i look inside the tar, theres only one file, app.bin im sure its some fundamental that im missing.  so i have to makepkg first , or am i

  • PREMIERE 2014 CC - BAD HEADPHONE AUDIO MAPPING

    Hey guys -- the new upgrades to Premiere have for the most part been great, but I'm running into a really peculiar issue that just suddenly started. I can play back my timeline just fine through the computer's internal speakers, but when I try to lis

  • FLVPlayback on iOS: METADATA_RECEIVED never fires

    Hey All, I'm experiencing an issue with FLVPlayback 2.5 on iOS on a Flash CS5.5 app compiled under Air 2.7. It appears as though the METADATA_RECEIVED event never fires when testing directly on the device. It works fine in the IDE debugger, it works