沧海笑的艺术人生

沧海一声笑, 滔滔两岸潮,浮沉随浪只记今朝
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

sbo sdk 开发(一)

Posted on 2005-07-06 16:26  沧海笑  阅读(2022)  评论(5编辑  收藏  举报

Preface
    
SDK 是需要单独申请,和SBO不在一张CD上。主要包括两部分:UI API、DI API。
    UI API:  is a collection of DCOM objects that provide access to forms, controls within these forms, and menus. DCOM (distributed component object model) is a standard interface for object communication in distributed applications.
You can use the User Interface API to integrate customer specific programming or third-party products into SAP Business One.                
    DI API: is a collection of COM objects called business objects. These objects describe various methods for updating, retrieving, and manipulating data in the SAP Business One database.
For example, you can use the Data Interface API to connect an external data warehouse management system to SAP Business One;
    在开发前,一定要想SAP申请namespace,这样很有好处,数据表,字段,工程名,类,模块,自定义字段可以使用同意的命名前缀;
 开发平台:vb,delphi,vc++,sdk默认使用sqlserver数据库;

Company Object
    开始使用SBO时,我们要创建公司信息,系统同时创建了一个数据库,这个对象是类SAPbobsCOM.company实例,SAPbobsCOM 是sdk的一个基类。如我们设置数据访问的代码为:
'建立数据连结 
Public vCmp is SAPboboCOM.Company
set vCmp =   new SAPbobsCOM.Company
vCmp.Server = "my_db_server"
vCmp.CompanyDB = "My_company"
vCMP.User  Name ="sa"
vCmp.passward = "1234"
vCmp.language = SAPbobsCom.in_english
'建立连接
Dim conn as string 
conn = vCmp.Connect()
'关闭连接
vCmp.Disconnect

Accessing The Business Data
    Accessing the business data have two methods:
       one: GetBusinessObject(Object as SAPbobsCOM.BoObjectType)
       two:GetBusinessObjectFromXML(Filename as string, index as long)
              GetBusinessObject always creates a new, emply business object,you have to set parameter objtype to the type of to be created
               In consrast,GetBusinessObjectFromXML creates a new business object with prefine from xml file contents.The document struct have to be same as GetBusinessObjectSaveXML.
               For example:
                     Dim vBP  as SAPbobsCOM.BusinessPartners
                     set vBP = vCmp.GetBusinessObject(oBusinessPartners)