SDK Error -5002 when adding a sales order

I'm getting an error -5002 when adding a sales order.
Source code:
      IDocuments m_so2 = SBOCOMUtil.newDocuments(icmp, SBOCOMConstants.BoObjectTypes_Document_oOrders);
      line = m_so2.getLines();
      m_so2.setCardCode("2173231916");
      m_so2.setCardName("test Sales order");
      SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");
      Date today = Calendar.getInstance().getTime();
      m_so2.setDocDueDate(today);
      line.setItemCode("01005");
      line.setDiscountPercent(new Double(10));
      line.setItemDescription("description Testing");
      line.setQuantity(new Double(3));
      line.setTaxCode("0");
      line.add();
      long rc = m_so2.add();
Question:
Where can I find a list of error codes that can be easy to understand? PDF, word, etc.
Thanks.

Hi Diego,
Looking at your code I see that you are doing a
line.add();
You don’t need to have this here unless you are adding another line to your document.
Maybe this will help you.
Also just because java is a bit different from VB get the last error message using
SBOErrorMessage errMsg= comp.getLastError();
System.out.println(errMsg.getErrorMessage());
-Cormac

Similar Messages

  • Version conflict? Error -5002 when adding a sales order in SDK 2004.

    I get the -5002 error without any description when I reference the "SAP Business One Objects Bridge API version 6.2 SP3" and try to add an invoice in SBO 2004. The code is basically:
    Set vDOC = vCmp.GetBusinessObject(oInvoices)
    vDOC.CardCode = "K99999"
    vDOC.CardName = "Nils"
    vDOC.Lines.ItemCode = "A00001"
    VDOC.Add
    The routine works well if I reference the SBO 2004 DI API or if I run it on a 6.5 system.
    How can I be sure that my routine can work in both versions?
    /Nils.
    Message was edited by: Nils Jakob Heyerdahl

    I run Windows XP Proffessional with SP2.
    1) I had 6.5 SP1 installed. My POS-app works well. I have a procedure that adds an invoice from the POS-app. The VB-project (VB6 SP5) references "SAP Business One Objects Bridge API version 6.2 SP3" (because I want to support all versions of SBO).
    2) I uninstall SBO 6.5 and install SBO 2004 (III).
    3) I start the POS-app and receives an error when I try to add a document. The message is "-5002,". No text after the errorcode.
    4) I then deletes the reference to "SAP Business One Objects Bridge API version 6.2 SP3" and reference the "SAP Business One DI API Version 2004".
    5) I then start the POS-app again and no error occurs.
    The code I debuged with is as simple as this:
        Set vDOC = vCmp.GetBusinessObject(oInvoices)
        Set vOCRD = vCmp.GetBusinessObject(oBusinessPartners)
        vDOC.CardCode = "K99999"
        vDOC.CardName = "Nils"
        vDOC.Add
        vDOC.Lines.ItemCode = "A00001"
        vDOC.Lines.ProjectCode = "    "
        vDOC.Lines.ItemDescription = "Varetekst"
        vDOC.Lines.Quantity = 1
        vDOC.Lines.PriceAfterVAT = 100
        vDOC.Lines.DiscountPercent = 0
        If (0 <> vDOC.Add()) Then
           Call vDOC.SaveXML("SAP_ERR_" & Trim(Str(DocType)) & "_" & Trim(Str(Bong)) + ".xml")
           isCancelled = True
        End if
        Exit Function
    Strange?
    /Nils.

  • Error -1116 when creating a Sales Order via DI API

    Hi All,
    We have an developed EDI AddOn that creates Sales Orders in SBO 2007 PL13, in one of our clients.
    This AddOn is responsible for the creation up to 100 orders each day on SBO.
    However, sometimes (3 to 4%) during the Sales Order creation, the system return an error -1116 when the Sales Order is created - via oSalesOrder.Add() method.
    The problem is that the order is created anyway, although this error is raised.
    I've searched in the forums and it seems the solution is somehow related with SBO transactions.
    However, the AddOn only created the Sales Order, nothing more.
    Does any body know a solution for this problem?
    Regards,
    Manuel Dias

    Hi,
    see this links,
    Error -1116 when creating delivery note
    Could not commit transaction, ReturnCode:-1116
    Regards,
    siva

  • Error -5002 when adding a UDF, with B1 9.1

    Hello,
    in the past I wrote some addons for SAP B1 9.0 and worked well.
    Now I just upgraded our SAP B1 32-bit client from 9.0 to 9.1.
    If I try to run any of my addons and I get error code -5002, with description "Nessun record dati" ("No data records" in English).
    It occures in this piece of code that creates UDFs, when doing Add() the result is -5002 instead of 0:
    UserFieldsMD md = (UserFieldsMD)Global.oCompany.GetBusinessObject(BoObjectTypes.oUserFields);
    string realFieldName = "U_NS_MYFIELD";
    // Setting the Field's properties
    md.TableName = "RDR1";
    md.Name = "NS_MYFIELD";
    md.Description = "My field";
    md.Type = BoFieldTypes.db_Alpha;
    md.SubType = BoFldSubTypes.st_None;
    md.EditSize = 254;
    md.Mandatory = BoYesNoEnum.tNO;
    // Adding the Field to the Table
    int result = md.Add();
    Global.ReleaseComObject(md);
    This occures both keeping the old 9.0 version of SAPbobsCOM.dll and changing it to the new 9.1 version...
    Maybe the mechanism for creating UDFs has been changed? The reference (REFDI.chm) doesn't tell it.
    Kind regards

    This function is how I create UDF. I'm using it since SAP 8.8
    Function CreateUDF(ByVal TableName As String, ByVal FieldName As String, ByVal FieldDescription As String, Optional ByVal UDFLength As Integer = 10, Optional ByVal FieldType As SAPbobsCOM.BoFieldTypes = SAPbobsCOM.BoFieldTypes.db_Alpha, Optional ByVal DefaultValue As Object = "", Optional ByVal ShowMessage As Boolean = False, Optional ByVal dtValidValues As Data.DataTable = Nothing, Optional ByVal LinkedTable As String = "", Optional ByVal FieldSubType As SAPbobsCOM.BoFldSubTypes = Nothing, Optional ByVal isMandatory As SAPbobsCOM.BoYesNoEnum = SAPbobsCOM.BoYesNoEnum.tNO, Optional ByVal isUpdateExisting As Boolean = False) As Boolean
            Try
                Dim FieldID As Integer = GetUDFId(TableName, FieldName)
                oRecset = oDICompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                If Not IsNothing(oRecset) Then
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oRecset)
                    oRecset = Nothing
                    GC.Collect()
                End If
                Dim oUserFields As SAPbobsCOM.UserFieldsMD
                oUserFields = oDICompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
                Dim isExists As Boolean = False
                'LSC 10/20/2013
                If Not FieldID = -1 Then 'oUserFields.GetByKey(TableName, FieldID) Then
                    '  oUserFields.Remove()
                    ' If Not isUpdateExisting Then Return True
                    Return True
                    'oUserFields.Remove()
                End If
                With oUserFields
                    If Not isExists Then
                        .TableName = TableName
                        .Name = FieldName
                        .Description = FieldDescription
                        .Type = FieldType
                    End If
                    .EditSize = UDFLength
                    .Mandatory = isMandatory
                    Select Case oUserFields.Type
                        Case 4
                            .SubType = FieldSubType
                    End Select
                    If FieldType = SAPbobsCOM.BoFieldTypes.db_Alpha Or FieldType = SAPbobsCOM.BoFieldTypes.db_Float Or FieldType = SAPbobsCOM.BoFieldTypes.db_Numeric Or FieldType = SAPbobsCOM.BoFieldTypes.db_Date Then
                        If Not DefaultValue = "" Then .DefaultValue = DefaultValue
                    End If
                    If Not LinkedTable = "" Then .LinkedTable = LinkedTable
                    If Not IsNothing(dtValidValues) Then
                        For Loops As Integer = 0 To dtValidValues.Rows.Count - 1
                            .ValidValues.Value = dtValidValues.Rows(Loops).Item("Value")
                            .ValidValues.Description = dtValidValues.Rows(Loops).Item("Description")
                            If Loops <= dtValidValues.Rows.Count - 1 Then .ValidValues.Add()
                        Next
                    End If
                    If isExists Then
                        If Not .Update = 0 Then
                            If ShowMessage Then SetMessage(oDICompany.GetLastErrorDescription)
                            Return False
                        End If
                    Else
                        If Not .Add = 0 Then
                            If ShowMessage Then SetMessage(oDICompany.GetLastErrorDescription)
                            Return False
                        End If
                    End If
                End With
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserFields)
                oUserFields = Nothing
                GC.Collect()
                Return True
            Catch ex As Exception
                SetMessage(ex)
                Return False
            End Try
        End Function

  • Error -5002 when adding linked user defined field using DI API

    Hello,
    When I try to add a linked user defined field using DI API I get the error number -5002 with description:
    "The field 'Related Table' should consist of 8 alphanumeric characters with no valid or default values"
    I Get the error when I use the Add method.
    What is the solution for this problem? I use SBO 2005 A SP1 Patch 18
    The code I use is (.NET C# 2.0):
    SAPbobsCOM.IUserFieldsMD uf = (SAPbobsCOM.IUserFieldsMD)company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields);
    uf.Name = "S_BUCO";
    uf.TableName = "OPOR";
    uf.Type = SAPbobsCOM.BoFieldTypes.db_Memo;
    uf.SubType = SAPbobsCOM.BoFldSubTypes.st_Link;
    uf.LinkedTable = "S_BU";
    uf.Description = "Description";
    uf.Add()
    Regards,
    Jeffrey

    Hi Jeffrey,
    Your code above does not match the settings you are using in the UI. In particular, the type and subtype you are setting in code are not correct.
    To create the UDF via code, set the field types as follows:
    SAPbobsCOM.IUserFieldsMD uf = (SAPbobsCOM.IUserFieldsMD)company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields);
    uf.Name = "S_BUCO";
    uf.TableName = "OPOR";
    uf.Type = SAPbobsCOM.BoFieldTypes.db_Alpha;
    uf.EditSize = 8;
    uf.LinkedTable = "S_BU";
    uf.Description = "Description";
    uf.Add()
    There's no need to set the SubType property as you require a regular alphanumeric field.
    Kind Regards,
    Owen

  • Error Message when adding a Purchase Order

    Hi,
    When i enter a new Purchase Order and click on Add, it gives the message as "No Matching records found ‘G/L Accounts’ (OACT) (ODBC – 2028) [Message – 131-183]”

    Hi Manzoor,
    This is because in the purchase order there is one or more items that have no set G/L account. I suggest you allow to visualize the "G/L account" Column in the Form Settings/TableFormat in the purchase order, and then go to the G/L account and set a VALID G/L account.
    It is not very logical to put that information in an order, but however you must do that way.
    Hope it helps.

  • Error on ATP check when Creating a Sales Order

    Hello,
    I encounter error  on ATP check while creating a Sales Order.
    The error is when I create Sales Order using material A, with or with out indicating the Plant and Storage Location, the Purchase Order quantity is returned on ATP check, but when I create an SO with out indicating the Plant and Storage Location, no PO quantity was returned. Note that we applied SAP Note # 387482 to automatically determine the Storage Location. I have also checked material maintenance in MM03 of Materials A and Material B and nothing was different, they have the same Availabity check condition.
    Is it possible that the SAP note that I applied causes the error?
    By the way I have noticed that when I create Material B and manually populate the Plant and Storage Location there is a pricing error(but it returns the PO during ATP check).
    Thanks.
    Noreen

    Hello,
    I encounter error  on ATP check while creating a Sales Order.
    The error is when I create Sales Order using material A, with or with out indicating the Plant and Storage Location, the Purchase Order quantity is returned on ATP check, but when I create an SO with out indicating the Plant and Storage Location, no PO quantity was returned. Note that we applied SAP Note # 387482 to automatically determine the Storage Location. I have also checked material maintenance in MM03 of Materials A and Material B and nothing was different, they have the same Availabity check condition.
    Is it possible that the SAP note that I applied causes the error?
    By the way I have noticed that when I create Material B and manually populate the Plant and Storage Location there is a pricing error(but it returns the PO during ATP check).
    Thanks.
    Noreen

  • Error in GTS when creating a sales order

    Hello All:
    Let me first say that I have researched the forums and web for my answer to no avail...there is not a lot of information out there for GTS issues. 
    When creating a sales order in ECC 600; I am receiving errors...I have looked at SLG1 in order to get more information on these errors.  I have validated my config in GQ0 and it appears to be correct.  Here is my errors I am receiving:
    Legal Control: Item Type Mapping not Maintained
    Item Category: ZTAE
    Item Category: ZTAQ
    Legal Control: Partn. Function Mapping not Maintained
    Partner Function: AG
    Partner Function: AP
    Partner Function: CI
    Partner Function: EN
    Partner Function: RE
    Partner Function: RG
    Partner Function: SP
    Partner Function: WE
    Legal Control: Mapping of Org. Units not Maintained For Fore
    Company Code: 1000
    Legal Control: Mapping of Org. Units not Maintained For Lega
    Plant: 1000
    I have looked under the Org Structure for these errors and think my configuration is correct.  I have checked under the following:
    In SPRO I have done the following Config under Org Structure:
    Define Foreign Trade Organizations
    Assign Company Code At Feeder System
    Define Legal Units
    Assign Legal Unit to Foreigne Trade
    Assigned Plant at Feeder System
    In Spro I have done the following Config under Partner Structure:
    Define Partner Functions
    Define Groups of Partner Functions
    Assign Partner Functions at Feeder system
    In SpRO under Compliance Management I have done the following Config under document structure:
    Define Doc Types
    Assign Doc types at feeder system
    Define item categories
    Assign item categories at feeder system
    It is obvious I am missing something....Please help...it would be greatly appreciated....

    Hi Dave
    Thanks for replying. 
    For Business Partners the error I am getting in SLG1 is the follwoing:
    Sub Object text
    Mapping of API to Customs Shipment - Arrival
    Program
    /SAPSLL/SAPLCORE_APPLOG_SERV
    @5C\QError@     
    The system was unable to determine an FT organiz. for company code 1000
    The system was unable to determine a legal unit for plant 1000
    No mapping information exists for partner function AG
    Another error for Business Partner:
    sub object text
    Business Partner Distribution
    Program
    /SAPSLL/SAPLCORE_APPLOG_SERV
    @5C\QError@     
    Please use another function to maintain the SPACE version of the address
    For Item Categories
    SubObect TextMapping of API to Customs Shipment - Arrival
    Program
    /SAPSLL/SAPLCORE_APPLOG_SERV
    @5C\QError@     
    No mapping information exists for item type ZTAQ
    The system was unable to determine a legal unit for plant 1000
    No mapping information exists for partner function AG
    Also we are using GTS 7.2 but upgrading to GTS 10 and I am trying to create our testing client for a to test after upgrade
    Edited by: Kim Blair on Sep 9, 2011 4:57 PM
    Edited by: Kim Blair on Sep 9, 2011 4:58 PM

  • Configuration Validation error when booking an Sales Order.

    Hi,
    Getting an error when booking an sales order ie; "Configuration Validation error".
    We are upgrading from 11.5.8 to 12.1.1 and this issue is critical. Please provide your valuable suggestion and advice.
    Thanks in advance,
    Asif

    It seems you use configurator. Is this happening in production or in some test instance?
    If it is a test instance, when was it cloned from prod? Did you clone the configurator instance at the same time?
    1) You should publish the configurator model from the configurator developer to this new instance.
    2) Also, it is possible that the selections made during order entry earlier are not valid anymore due to ECO/BOM changes or due to configurator rule changes. Open the configuration, make any selections if necessary and then click ok.
    This will repopulate the order lines then you should be able to book the order.
    Hope this helps
    Sandeep Gandhi
    Independent Techno-functional Consultant

  • Error -5002, Update quantities in purchase order? (INV1.Quantity) Line[2]

    We are trying to create Invoices using the SDK tool for a clients interface. Everything goes ok, except at the point where we add the document, we get the following message:
    Error -5002, Update quantities in purchase order? (INV1.Quantity) Line[2]
    Any ideas? We have searched the SAP notes, but nothing is available. Are we missing anything?
    We are running on Version 6.50.098
    Thanks
    Marios

    Hello Marios,
    This error occurs because the last line you are trying to add to the Marketing Document is an empty line. It is a new functionality in Version 6.5 that the document object automatically comes with one document line so if you are adding just one line you do not need to use oDocument.Lines.Add,                                           
    It is only for the second and subsequent lines of marketing documents that you require the method oDocument.Lines.Add. Note 722693 describes the issue.                 
    Regards,
    Lisa

  • Automatic creation of intercompany PO when creating a Sales Order

    Hi Experts
    Is there a standard way of triggering an intercompany PO when creating a sales order to the final customer (or the other way around, triggering a sales order to the end customer upon creation of an intercompany PO)? Scenario: business has setup a logistics company (company code X), which its purpose is to deliver goods to the final customer (home customers). However, sales orders are created from seperate chain of stores which belong to another company code (company code Y). This chain of stores have one sales organisation (since there is over 1000 stores under a chain). I need a way to represent that a sale originated from a store/plant belonging to company Y to end customer A. Also, I need a billing document (intercompany) from company code X to store/plant beloning to company Y.
    Issues: in the intercompany config (assign intern customer numbers to sales org) - is there a way to assign a customer number at site/plant level so that when creating an intercompany billing it can be picked instead of the one assigned to the sales org and where can this be specified in the sales order (remember: in my scenario there are multiple stores/plants that belong to one sales organisation and it is not possible to use one customer number linked to the sales organisation.)
    Desired results:
    Sales order from store/plant YY belonging to company code Y to end customer A
    Intercompany billing from plant XX belonging to company code X to store/plant YY
    End customer billing from store/plant YY to end customer A
    Thank you in advance for your help.

    Hello Tsmash  
    I think you can acheive this with Regular Sales order + Inter Company STO combination.
    Maintain customer numbers for each of the Plants from Company Y for the sales area belonging to Company X.
    Then do the config for STO in MM using this menu path:
    SPRO/Materials Management/Purchasing/Purchase Order/Set up Stock Transport Order
    Here, in the activity 'Define Shipping Data for Plants',  enter each of the plant-customers and the Sales area belonging to Comany code Y. Carry out other activities in this area appropriately.
    Similarly set up Custom ( say Z1) Special Procurement type for Plant YY for stock transfer from XX using this menu path:
    SPRO/Production/Material Requirements Planning/Master Data/Define Special Procurement Type:
    Here maintain procurement type as F, Special procurement as U and plant as XX. You may need to repeat this config for each of the receiving plants (over 1000 stores under a chain)  from co code Y.
    In the material master MRP 2 for Plant YY,  maintain procurement type as F and Special Procurement as Z1.
    Sales order will be received under Co Code Y and sales area belonging to Y form customer A,
    Because of the MRP config, a PO (STO) requirement will be raised on Co code X and plant XX. XX will send the goods to YY via a STO delivery using the Shipping data from 'Set up STO' config,
    Plant YY will send the goods to A and bill that customer. Co Code X will raise an inter-comany bill on Co code Y.
    That's how it should work. Try it and revert with any issues.

  • Sale Order Item Quantity Not Populating When Create A Sale Order Using BAPI

    I am having a problem when creating a sale order using BAPI
    BAPI_SALESORDER_CREATEFROMDAT2
    Problem is that sale order item quantity field is not populating
    code is as follows
    ORDER_ITEMS_IN-ITM_NUMBER = '0010'.
    ORDER_ITEMS_IN-MATERIAL = '000000000010000262'.
    ORDER_ITEMS_IN-TARGET_QU = 'LB'.
    ORDER_ITEMS_IN-TARGET_QTY = 1.

    Hi,
    Try populating ORDER_SCHEDULES_IN table in the bapi field REQ_QTY.
    Regds,
    Rudra

  • Can't change quantity when copy from Sale order for Delivery

    Hi all!
    Can i use authorization for can't change quantity when copy from Sale order for Delivery.

    Tien,
    Approval will not work when you have mutiple rows of data.  You would have to work with SP Transaction Notification
    There has been threads before on the forum on the same topics.
    Block the Quantity in Sales Delivery
    Approval Procedure for chaning quantity in Delivery Document
    Suda

  • Inserting Pricing condition in Sales order when saving the sales order

    Dear ABAPers,
           My customers requirement is when saving the sales order new pricing condition has to be updated in the line item.for this i am using the User Exit 'USEREXIT_SAVE_DOCUMENT_PREPARE' ( MV45AFZZ).While saving the Sales order i am calculating the Price and updating in the Pricing conditions.
    In XKOMV internal table i am appending the pricing condition.But the problem is ,it is not calculating the taxes and it is Updating in VBAK and VBAP.
    How to do this.
    Thanks & Regards,
    Ashok.

    Dear ABAPers,
    I have Solved this Problem.
    Thanks & Regards,
    Ashok.

  • Unwanted printing of advanced payment when printing a sales order or pick

    It will be great to have an option of disabling the automatic printing of the advanced payment incoming payment when printing a sales order or invoice.
    The option is currently not available on the document printing options.

    No print sequence for sales order is setup.
    But even before on 2007 version, it was SAP default to print always the incoming payment of an advanced payment on every sales order or invoice.

Maybe you are looking for

  • IBook G4 cannot find system after update to 10.4.8 the first startup

    Hi, I recently updated the iBook G4 of my girlfriend from Mac OS X 10.4.6 to 10.4.8. After restart the iBook showed up the icon for not being able to find a system to startup from. I then turned the iBook off and turned it on again, now the iBook sta

  • Can't remove folders from Spotlight Privacy

    Hi there, I've never posted on here before so please bear with me I am running a 17" iMac with OSX10.9.5, 2.4 Ghz Intel Core 2 Duo, 4 GB 667 Mhz DDR2 SDRAM with over 100GB of free space. I am also using DropBox to sync my files with a co-worker. The

  • Firefox upgrade needs to indicate which extensions won't work!!!

    I would do a "suggestion for improvement" but I refuse to run 7.0.1 because "Fast Dial" doesn't work. I have had to go back to 3.6 twice now, and that is a PITA! Please FF team indicate which extensions don't/won't work prior to downloading. Also, Fa

  • Load balancing in Oracle RAC 11g (11.1.0.6.0)

    Hi! One of our customers use load balancing, now all users get connected against node 2. --The configuration of load balancing will be correct I think, have worked before --How do I verify the load on each node ? --What can be wrong? --Need help, wha

  • Import from Elements is not on my file menu

    I'm using a trial version of Lightroom 3.2 and I would like to be able to convert my actual catalog under Photoshop Elements 6 to Lightroom. The instructions are clear but this option is not available under my menu of Lightroom?!? Is it because I'm u