Biblioteca SAPBOBSCOM

Estou iniciando em programação B1, estou desenvolvendo em C#, tenho mais de vinte anos de experiência em programação, porém necessito de algum documento detalhando a biblioteca SAPBOBSCOM, para poder trabalhar com todos os formulários.
Nas tabelas já consigo navegar com facilidade, mas quanto a sua biblioteca estou tendo dificuldade, já consegui determinar, por exemplo, que SAPBobscom.Documents trabalha, entre outras, com Sales e Purchase Order, SAPBobscom.BusinessPartners trabalha com os parceiros de negócios, porém e outras como A BOM (Bill of Materials), Financial, etc.
Alguém tem alguma dica de onde posso achar um material (pode ser em inglês) para estas possibilidades da biblioteca?
Estou procurando no google exaustivamente, ams não obtive muito sucesso até agora.
Desde já agradeço a ajuda.

Boa noite Alexandre, é provável que você tenha instalado o pacote SDK que acompanha o instalador do SAP Business One, certo?
A instalação disponibiliza em: [ArquivosDeProgramas]\SAP\SAP Business One SDK\Help
um conjunto de helps que detalham a UI e DI, bem como há um tutorial.
Há também um conjunto de exemplos de código em:
[ArquivosDeProgramas]\SAP\SAP Business One SDK\Samples
Chegaste a verificar este material?
Atuo em consultoria e sou formado em Análise de Sistemas, mas não trabalho como desenvolvedor e com este material consegui desenvolver recursos bem legais.
Att,
Rodrigo da Costa Feula

Similar Messages

  • SAPbobsCOM.Documents.Lines.Text ReadOnly

    I'm trying to do something like this
    oSapInvoice.Lines.Text = oDocDett.Text
    where oSapInvoice is a SAPbobsCOM.Documents, but the Text property is readonly.
    How can I do to copy the column "Item Details" (Text property) in a document line using the SDK?

    Dear Gianluca D'Alessandro,
    Please try following code to add Item Details:
    oSapInvoice.Lines.ItemDetails = oDocDett.Text
    Best Regards
    Jane Jing
    SAP Business One Forums team

  • Interop.sapbobscom.dll compatibility

    I'm having a compatibility issue, I think, with the patch-level of my interop.sapbobscom.dll that is installed with my addon compared to the patch level that is installed at my customer's location.  I'm developing on SP00 PL49, but the customer is at 48.  (They are getting a "server threw an exception" error at random places in the code that seem to be related to recordset.doquery.)
    I want to create an installer for my addon that will contain the appropriate interop dlls but I want to make sure that I'm giving them the right ones.  How do I tell what patch level the interops were created for?  The SAPBOBSCOM.DLL object in C:\Program Files\SAP\SAP Business One\DI API\2007  has a special build description property in the version tab that lists the PL, but the interop file does not contain that property.  I have different addons created for different customers all at different levels, so finding the right version of the interop files is quite challenging without any real identifying numbers.
    Thanks!

    Hello John
    Basically the interop dlls are just containg the functions, as library but the business logic is coded in observer.dll which is downloaded to %TEMP%SM_OBS_DLL. By this logic the SAP B1 DI API can support the compatibilty between patch levels.
    You cannot determine the interop versions, because only the major version number is stored there.
    So in your case the Business Logic of PL 48 not knows the logic of PL49 if i understand you problem well.
    When i had problems with recordset queries i was able to dicover 2 reasons
    - cleaning up the %TEMP%SM_OBS_DLL was solving the problems
    - on huge databases the transactions was generated this kind of errors.
    I hope i has able to help you.
    Regards
    János

  • Bug in SAPbobsCOM.Recordset.GetAsXML()?

    I am using the following code:
    string query =
            "SELECT BoxCode as stBoxcode, (CASE WHEN TaxCode = 'B' THEN BaseAmount ELSE Debit + Credit END) AS Amountx " +
            "FROM (SELECT VatTaxBox.BoxCode, VatTaxBox.TaxCode, SUM(dbo.JDT1.Basesum * VatTaxBox.FSign) as BaseAmount, SUM(dbo.JDT1.Debit * VatTaxBox.FSign) AS Debit, SUM(dbo.JDT1.Credit * VatTaxBox.FSign) AS Credit " +
            "FROM  dbo.JDT1 INNER JOIN dbo.OJDT ON dbo.JDT1.TransId = dbo.OJDT.TransId " +
            "INNER JOIN dbo.OVTG ON dbo.JDT1.VatGroup = dbo.OVTG.Code " +
            "inner join (SELECT  (CASE WHEN BOXx IS NULL THEN VatBoxes.Boxcode ELSE BOXx END) AS BoxCode, VATMember, FormulSignx * FormulSign as FSign, OBOX.summayfld AS TaxCode " +
            "FROM (SELECT TOP 100 PERCENT B11.BoxCode AS BOXx, B0.boxcode, B0.BoxMember, B0.VATMember, isnull((select (case when formulSign='M' then -1 else +1 END) as FSignX from box1 b1 " +
            "where b1.boxcode=B0.boxcode and b1.SeqNum = B0.Seqnum-1), +1) AS FormulSignx, isnull((select (case when formulSign='M' then -1 else +1 END) as FSignX from box1 b1 " +
            "where b1.boxcode=B11.boxcode and b1.SeqNum = B11.Seqnum-1), +1) AS FormulSign " +
            "FROM BOX1 B0 LEFT OUTER JOIN BOX1 B11 ON B0.BoxCode = B11.BoxMember " +
            "WHERE (NOT (B0.VATMember IS NULL)) ORDER BY B11.BoxCode, B0.BoxCode, B0.SeqNum) AS VatBoxes " +
            "INNER JOIN OBOX ON VatBoxes.boxcode = obox.boxcode) as VatTaxBox ON JDT1.VatGroup = VatTaxBox.VATMember " +
            "WHERE (dbo.OJDT.RefDate >= '2005/01/01') AND (dbo.OJDT.RefDate <= '2005/07/01') AND OJDT.Series = 4 GROUP BY VatTaxBox.BoxCode, VatTaxBox.TaxCode ) as ResultSet ";
          SAPbobsCOM.Recordset rs = (SAPbobsCOM.Recordset)_sapCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
          try
            rs.DoQuery(query);
            int i = rs.RecordCount;
            int j = i++;
            string s = rs.GetAsXML(); //-> throws an error: "External component has thrown an exception."
          catch (Exception ex)
            System.Windows.Forms.MessageBox.Show(ex.ToString());
    The statement rs.GetAsXML() throws an exception. However when I use a simpler query everything works fine.
    What am I doing wrong?
    Jurgen

    I don't specifically, but one trick I've learned of is to "hide" complex SQL queries in functions or stored procedures.  SBO sometimes has problems with complex SQL queries.  They're aware of this, but until it's fixed, try putting that "monster" in a function or a view. 
    Hope that helps.

  • Problem in SAPbobscom OBJECTS

    Good Day Experts,
    We've created an AddOn that automatically creates an JE on Incoming Payment. It works just fine in client side.
    But a problem occured if we're to do a direct transaction ON the SERVER side.
    Upon checking the application in debug mode the cause of the error is when the program tries to call for any SAPbobscom Object such as the oJournalEntries that we used for the AddOn,
    The exception throws the following error:
    Unable to Cast Com Object of type "SAPBobsCom.CompanyClass"to interface type "SAPBobsCom.ICompany". This operation failed because the QueryInterface call on the COM component for the interface with IID u2018{3BA8DAED-5B33-4CE4-A4B8-B4308D86E524}u2019 failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
    The clients we've tested using our AddOn has the following setup:
    (NO ERROR ENCOUNTERED)
    OS: Windows XP / Vista
    MS SQL Server 2005
    MS .Net  Framework 2.0
    SBO 2007 PL 41
    And for the server's setup
    (HAS ERROR ENCOUNTERED)
    OS: Windows Server 2008
    MS SQL Server 2005
    MS .Net  Framework 2.0
    SBO 2007 PL 41
    Thanks & Regards,
    Tyron
    Edited by: Tyron Gono on Feb 26, 2010 9:25 AM

    Hi
    This problem mainly occurs if your system is of 64 bit....As petr said first of all compile your application as well as your Add-on both for x86....in your projects properties-->compile>Advanced Compile options->Change your target CPU from Any to x86 and then rebuild the project and make a new ard from this rebuilded project and change here also the target CPU to x86....
    It may solve the problem....
    If not then you have to register your SAPBobs.Com again on the Server and then make the ard again....for registering the SAPBobs.Com,  C:--->Program Files ->SAP>SAP B1 DI API->Select the SAPBobs.Com dll from the folder---> select Open with option and Select Browse-->Windows->Select System 32 folder---->type regsvr32
    It will register your dll...
    And in the end you have to again recompile your project and then again make the new ard from this project
    Hope it helps..
    Regards

  • Version incompatibility issue with Interop.SAPbobsCOM.dll in SBO 2004

    Hi,
    I have encountered an incompatibility issue in DI API 2004 across different patch level-versions. Originally, I developed an application in SBO 2004 pl4 environment. Now, some of the customers who were installing the application, notified me that the application has a login problem. It turned out that the CompanyClass.connect() method returns an error message "object reference not set to an instance of an object", when the DI API version installed in the production environment is higher (in this case, pl7) than the DI API version which was used in the development environment.
    I figured out that the problem can be fixed by replacing the Interop.SAPbobsCOM.dll file in the application directory by a newer version that reflects the DI API that is installed in the system. However, it seems a rather lousy workaround, if the customer needs to manually replace the dll. Maybe the installer could be customized to "sniff" the correct DI API level, but this too would be a pretty kludgy solution.
    Does anyone know a better solution to this problem ?
    Regards,
    Henry

    normally this is not a problem as long as they don't change the signatures on the DI-API (which they said they wouldn't) but it appears in P5 they changed that signature... we noticed some enums that got added and a few minor changes.

  • Dynamic creating SAPBobsCOM objects using reflection

    Hi All,
    I'm writing a tool (C#) for SBO for exporting object (oItems, oBanks etc.) to XML files. And I have a problem how to dynamically create object by it's string description. I'm trying to create it using System.Reflection, but cant't find right way to create it.
    It must be like that, but it doesn't work:
               Type  sboObject = System.Type.GetType("SAPbobsCOM.Items, Interop.SAPbobsCOM", true, true);
               object ibaseObject = Activator.CreateInstance(sboObject);
    Any ideas?)

    Hi
    I've writen this code for instantiating DI API objects using .NET reflection
            private object getObjectBo(int tipo) //tipo: integer representing the object type
                object o = null;
                try
                    Type tipoComp = kernel.Company.GetType(); //Type SAPbobsCOM.Company
                    MethodInfo info = tipoComp.GetMethod("GetBusinessObject");
                    object[] parametros = new object[1]; //Parameters of GetBusinessObject
                    object tipoObj = Enum.ToObject(typeof(SAPbobsCOM.BoObjectTypes), tipo);
                    parametros[0] = tipoObj;
                    o = info.Invoke(kernel.Company, parametros);  //Calling GetBusinessObject           
                catch (Exception ex)
                    kernel.Application.MessageBox(ex.Message, 0, "", "", "");
                return o;
    The object returned is COM object (not managed code) then we can't use .NET reflection directly for exploring its methods and attributes .. I think we should use C++ and IDispatch interface, but i don't know how do this yet.
    Hope it helps.
    Regards

  • Exception: Method not found: 'SAPbobsCOM.Document_SpecialLines...........

    I am getting this exception when I'm adding a Sales Order with the DI API:
    Method not found: 'SAPbobsCOM.Document_SpecialLines SAPbobsCOM.IDocuments.get_SpecialLines()'
    I am not using this interface in any of my code so I'm not understanding from where this error is coming, the same code works well with other companies, I have this problem only with 1 of my clients.
    Any Idea??/

    Dear Yuval,
    Please do remember to check the DI version and check if it matches the B1 version.
    Also try removing the folder "SM_OBD_DLL" which stores the temporary DI files.
    If it does not help, please let us know the exact B1 version and the DI version and also the code with which you are able to reproduce the issue.
    Regards
    ARshdeep

  • Error when accessing SAPbobsCOM.Documents Object (ErrorCode: -2147417851)

    Hello!
    I have a problem when running this code:
    private SAPbobsCOM.Documents comObject;
    comObject = (SAPbobsCOM.Documents)c.Connection.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
    comObject.Address = "Address";
    Then I get the exception:
    'comObject.Address' threw an exception of type 'System.Runtime.InteropServices.COMException'
    ErrorCode: -2147417851
    I have read the Help and I thinkt that this statements are correct.
    Has anyone an idea to solve this problem?
    Thank you very much.

    Hi Martin,
    The error you get is a COM "Server threw an error"-error. As far as I understand it (which is not very far at all), you've got an invalid underlying handle somewhere.
    You might google for it and find some answers. Mind you the error code is commonly written in hex, so that'll be 80010105.
    IMHO there are two possibilities. Either your code is bogus or your OS is bogus. The problem may have been unveiled by the last patch/upgrade of whatever.
    Firstly, the code. I'm not sure I quite understand what kind of "pooling" you speak of. You said:
    > If there is no Object in the pool a new one will be created, otherwise it will be taken from
    > the pool.
    But that's not really a pool, that's an initialisation-on-demand. Why would you need a collection structure for that?
    You could need a pool if you had connections to multiple databases/companies simultaneously. But why would you need a LIFO ("Stack") for that? Or maybe you multi-thread?
    Anyway, I'd address this possibility first, if I were you. Instead of obtaining a Company Object from witherever you got it until now, create one just before the critical portion of the code. That's just for debugging, of course.
    The other possibility is that your OS is bogus, not in the general kind of way of being Win32, but in the sense that there may be a trouble with your COM service. Try updating it, apply a MS "Service Pack" or however it is called -- maybe you'll find something in in the "Knowledge Base", too.
    But the latter might be kind of tedious, so I'd try to rule out the former, as far as possible, first.
    BTW, have you been able to reproduce this error on different machines?

  • SAPbobsCOM.Contacts attatchment.Count always 0

    Hi,
    im Working with sboContacts (Activities in SBo)
    I intend to handle with attachments in Activities.
    Before i add a new Attatchment i have to check, if there ist already one.
    The attachments.count returns 0, even though there are attachments existing.
    Snippet----
         SAPbobsCOM.Contacts sboContacts;
         sboContacts = (SAPbobsCOM.Contacts) company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oContacts);
         SAPbobsCOM.Recordset aktRecs = sboEntry.getSBOCompany().getRecsetBySelect(
            "select ClgCode from oclg where cardcode = 'C1050' and docnum = 174 and doctype = 17");
         if ( aktRecs.RecordCount > 0 )
            sboContacts.Browser.Recordset = aktRecs;
              log.Debug("CardCode: " + sboContacts.CardCode + " ContactCode: " + sboContacts.ContactCode +
               " Docnum: " + sboContacts.DocNum + " DocTypeEx: " + sboContacts.DocTypeEx);
            SAPbobsCOM.Attachments aktAttachments = sboContacts.Attachments;
            log.Info("anzahl Attachments: " + aktAttachments.Count);
    Snippet----
    Version: Business One 2004A 6.70.189 SP:00 PL:29
    As a workaround it´s possible to check the attachments wich DB-Selects...
    regards Matthias Lakämper

    Hi,
    now i solved it on this way but....
    "select Attachment from oclg where cardcode = 'C1050' and docnum = 174 and doctype = 17")
    this returns a list of attachments delimited by ';'
    --- always add a new Attachment and add all old and new items
    string [] dbAttAr = dbAttachments.Split(new Char [] {';'});
    for ( int iLauf = 0; iLauf < dbAttAr.Length; iLauf++)
         aktAttachments.Add();
         aktAttachments.Item(iLauf).FileName = dbAttAr[iLauf];
    if ( inNewAttachment != null )
         aktAttachments.Add();
         aktAttachments.Item(dbAttAr.Length).FileName = inNewAttachment;
    A curious behavior is the following:
    When i add an attachment using the GUI (Button "Durchsuchen"),
    e.g. from a Path: c:/temp/file.txt this file is copied to
    '.../SAP Manage/SAP Business One/Attachments/file.txt
    When i add an attachment with the API the path keeps the value
    "C:/temp/file.txt" and the "Anzeigen"-Button works. This effect is exactly what i need.
    Is this different behavior a bug or a feature ?
    regards

  • SAPbobsCOM.BoObjectTypes.BoRecordset

    Hi Experts,
    I am new to SAP Business One SDK, I created a this code :
    Dim oRecordSet As SAPbobsCOM.Recordset
    Dim oItem1 As SAPbouiCOM.EditText = oForm.Items.Item("Item_1").Specific
    oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
    oRecordSet.DoQuery("SELECT TOP 1 T0.[DocID] FROM [dbo].[@Testtable]  T0 ORDER BY T0.[DocID] DESC")
    If oRecordSet.RecordCount > 0 Then
          oItem1.Value = oRecordSet.Fields.Item(0).Value
    Else
          oItem1.Value = 1
    End If
    I have a clean database and it has no record at all. It gives me a correct value in my first testing but when I try to truncate my table it give me other record number. please help me about what does SAPbobsCOM.BoObjectTypes.BoRecordset do.

    this is the script in my sql
    CREATE TABLE [dbo].[@Testtable](
       [ID] [int] NOT NULL,
        [DocEntry] [int] NOT NULL,
        [DocNum] [int] NULL,
    CONSTRAINT [Testtable] PRIMARY KEY CLUSTERED
        [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    Im still trying to figuring it out.

  • GetAsXML hangs on SAPbobsCOM.Documents invoiceObject

    Hi there. We have recently moved a customer to a new server, and upgraded from SBO 2005 to SP01.
    We have an addon that has worked smoothly before, that loops through invoices for a given date, and generates XML that is then sent to a third party which uses this for electronic invoicing instead of getting them on paper. The addon we use is written in C#, and the code is basically this:
    String sql = "SELECT T0.DocEntry, T0.DocNum, T0.Comments, T0.PaymentRef FROM OINV T0 INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode INNER JOIN NNM1 T2 ON T0.Series = T2.Series  WHERE T0.DocDate = '" + date + "' AND T2.SeriesName = 'XML-UF'";
    rs.DoQuery(sql);
    int total = rs.RecordCount;
    String[] xml = new String[total];
    while(rs.EoF == false)
         int docEntry = (int)rs.Fields.Item(0).Value;
         int docNum = (int)rs.Fields.Item(1).Value;
         SAPbobsCOM.Documents invoiceObject = (SAPbobsCOM.Documents)MainClass.SBOCompanyObject.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);
         invoiceObject.GetByKey(docEntry);
            xml[t] = invoiceObject.GetAsXML();
         //... more happens here
         rs.MoveNext();
    The problem is this: After moving to a new, improved server, the application hangs after xml[t] = invoiceObject.GetAsXML(); The cpu goes 100%, and it just hangs. After some 5-10 minutes it seems like it continues to the next row. This used to take no time at all on the previous PC where it ran. What might be the problem? Is there some XML-library that is missing on the new computer? Everything else seems to work fine, including other addons, but the GetAsXML() doesn't work as it should anymore.

    I managed to reduce the 15-minutes of fame for the getAsXml() to 2.5 minutes by adjusting SBOCompanyObject.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode;
    However, that is still waaay too slow. As I said, it took max 7-8 seconds in PL:06, and as there is a lot of invoices, I simply don't have the time to wait even 2 minutes for each.
    Well, as time was running out, I have finally managed to implement a workaround for the problem, sort of. Since getAsXml() did not work as it should in pl45, I had to manually loop through Documents and Document_Lines and make the Xml myself, gladly omitting fields that I don't need. Luckily it seems to work fine. And I'm down to a couple of seconds again. Hopefully the getAsXml() will be fixed so that others don't have to stumble into the same problem as I, but maybe the function will work more smoothly for others, who don't have complex invoices with 200-300 lines based on several different orders.

  • Using the SAPbobsCOM.Recordset & DataTables

    I'm trying to find the best way to tie the SAPbobsCOM.Recordset object (based, for example, on a query to return all Employees) to a more .NET compatible data object such as a datatable or dataset.
    In other words, for things such as combo boxes, datagrids etc in .NET how are you guys usually binding data from SBO?
    I can just write a call directly to the DB, but wanted to go through the SDK if possible.
    Thanks!

    I actually ended up putting this into a utility .dll, but here's the function...
    Public Function ConvertRecordset(ByVal SAPRecordset As SAPbobsCOM.Recordset) As DataTable
            '\ This function will take an SAP recordset from the SAPbobsCOM library and convert it to a more
            '\ easily used ADO.NET datatable which can be used for data binding much easier.
            Dim dtTable As New DataTable
            Dim NewCol As DataColumn
            Dim NewRow As DataRow
            Dim ColCount As Integer
            Try
                For ColCount = 0 To SAPRecordset.Fields.Count - 1
                    NewCol = New DataColumn(SAPRecordset.Fields.Item(ColCount).Name)
                    dtTable.Columns.Add(NewCol)
                Next
                Do Until SAPRecordset.EoF
                    NewRow = dtTable.NewRow
                    'populate each column in the row we're creating
                    For ColCount = 0 To SAPRecordset.Fields.Count - 1
                        NewRow.Item(SAPRecordset.Fields.Item(ColCount).Name) = SAPRecordset.Fields.Item(ColCount).Value
                    Next
                    'Add the row to the datatable
                    dtTable.Rows.Add(NewRow)
                    SAPRecordset.MoveNext()
                Loop
                Return dtTable
            Catch ex As Exception
                MsgBox(ex.ToString & Chr(10) & "Error converting SAP Recordset to DataTable", MsgBoxStyle.Exclamation)
                Exit Function
            End Try
        End Function

  • Where i will get SAPbobsCOM.dll

    Hi every body
        Iam very new to ERP. Recently i have started working on Making Add-On for SBO using .net. I got a bit good femiliery with UI, But iam stucked at DI.
       I have instaled SDK.  With that i got only SAPbouiCOM.exe. In many samples which i downloaded from net is reffering the SAPbobsCOM.dll.
       Please some body let me know. wether the SDK what i have is older version or what?. Please let me know where i will get SAPbobsCOM.dll
    Thanks in Advance
    regards

    I guess you have more code between
    Public oCompany As SAPbobsCOM.Company
    and
    oRecordSet = oCompany.GetCompanyList
    because it can't work like this. It has to be something like
    Dim oCompany As SAPbobsCOM.Company
    oCompany = New SAPbobsCOM.Company
    oCompany.Server = "(local)"
    oCompany.language = SAPbobsCOM.BoSuppLangs.ln_English
    oCompany.UseTrusted = True
    Dim oRecordSet As SAPbobsCOM.Recordset
    oRecordSet = oCompany.GetCompanyList

  • Register Interop.SAPbobsCOM

    Hi,
    I want to connect to SBO via DIAPI and there comes following error:"Object reference not set to an instance of an object"
    I guess, that the issue is, that I had diff version of DI API install on my system and the SBO is using. So I installed the same DI_API.exe on my machine, as on SBO.
    After that I added under object reference the now SAPbobsCOM version in Visual Studio.
    But when I compile my project, Visual Studio is linked against the old Interop.SAPbobsCOM version.
    I guess, that perhaps the old Interop.SAPbobsCOM Version is registered.
    But I m not able to register the now one in regsvr32. There comes a message: cannot load library
    Is there anyone help me for register the new dll or how I can find the issue?
    thanks
    Katja

    Hi all,
    the problem is solved by registering the Interop.SAPbobsCOM in the project workspace. I have no idea why I have to register directly in the workspace and not in the object reference, but so it works...

Maybe you are looking for