Jump to content

S59X

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by S59X

  1. Hello,

    this is cross post from NI forum...

    http://forums.ni.com/t5/LabVIEW/SAP-BAPI-ActiveX-Interface/td-p/1715732

    I'm trying to integrate our test stations to SAP ERP. SAP stores data in busines objects in busines object repository. The objects are exposed over BAPI interface. There is a lot of different busines objects in the repository. SAP developers can also build new objects if they want. The objective is to read inspection characeristics from quality management module of SAP. I haven't done much ActiveX stuff, neither know much about SAP, so I started with a simple example that I found searching for BAPI examples. The example works fine in Excel. The example just reads some data from a sales order object.

    
      Sub BAPI1()Dim
    
    	oBook As Workbook
    
    	Dim oSheet As Worksheet
    
    	Dim oBAPICtrl As Object
    
    	Dim oBAPILogon As Object
    
    	Dim oSalesOrder As Object
    
    	Dim oItem As Object
    
    	Dim iIndex As Integer
    
    	Set oBook = Application.ActiveWorkbook
    
    	Set oSheet = oBook.Worksheets(1)
    
    	'---------------------------------
    
    	' Initialize SAP ActiveX Control.
    
    	'---------------------------------
    
    	Set oBAPICtrl = CreateObject("sap.bapi.1")
    
    	'---------------------------------
    
    	' Initialize SAP ActiveX Logon.
    
    	'---------------------------------
    
    	Set oBAPILogon = CreateObject("sap.logoncontrol.1")
    
    	'-----------------------------------
    
    	' Initialize the connection object.
    
    	'-----------------------------------
    
    	Set oBAPICtrl.Connection = oBAPILogon.newconnection
    
    	'--------------------
    
    	' Logon with prompt.
    
    	'--------------------
    
    	oBAPICtrl.Connection.System = "Q02"
    
    	oBAPICtrl.Connection.Client = 101
    
    	oBAPICtrl.Connection.Logon
    
    	'---------------------------------
    
    	' Retrieve a sales order.
    
    	'---------------------------------
    
    	Set oSalesOrder = oBAPICtrl.GetSAPObject("SalesOrder","0010732181")
    
    	'-----------------------------------
    
    	' Display Sales Order header data.
    
    	'-----------------------------------
    
    	oSheet.Cells(2, 1).Value = oSalesOrder.salesdocument
    
    	oSheet.Cells(2, 2).Value = oSalesOrder.netvalue
    
    	oSheet.Cells(2, 3).Value = oSalesOrder.orderingparty.customerno
    
    	oSheet.Cells(2, 4).Value = oSalesOrder.documentdate
    
    	oSheet.Cells(2, 5).Value = oSalesOrder.items.Count
    
    	'-----------------------------------
    
    	' Logoff SAP and close the control.
    
    	'-----------------------------------
    
    	oBAPICtrl.Connection.logoff
    
    	Set oBAPILogon = Nothing
    
    	Set oBAPICtrl = Nothing
    
      End Sub
    
    [/CODE]

    I tried to implement that in LabVIEW. The logon and logout part works, I can also obtain SalesOrder object with GetSAPObject method. There is no error and probing the Object output from GetSAPObject methods gives an integer value - probably a reference to the SalesOrder object.

    post-1148-0-14125600-1316763291_thumb.pn

    Now I can't figure out how do I read the object properties. It's very simple in VBA. I also don't know how do I call object methods. I would appreciate any hints...

    Bye, Mirko

  2. Hi,

    I have a table control on the front panel. I want to let the user to change the table column headers. Is there a simple way to detect the change of a column header? Using Key Up or Mouse Down events don't intercept all possible changes like entering a new value and clicking outside of the control. I must have overlooked something.

    Thanks, Mirko

  3. QUOTE (Mike C @ Sep 26 2008, 10:11 PM)

    I can get the same error message even if I point to a non existent sdf file. This makes me think that the service is not even running. Is there anything else you needed to do? How did you solve your problem? I have a suspicion that I need to have IIS running for this to work, is IIS running on your machine?

    I haven't done anything special. IIS is not running on my machine. I tried this on WinXP SP3 using LV 8.6 and Database Connectivity Toolkit. It is strange that it only works when I specify Microsoft.SQLSERVER.MOBILE.OLEDB.3.0 as provider in the connection string and not with Microsoft.SQLSERVER.CE.OLEDB.3.5 as one would expect. Is there a way to check what providers do I have installed on my machine? I don't like the error messages since they don't tell us anything usefull to solve the problem. Here is the VI that works on my machine. It uses a simple table with two columns - a numeric and b nchar.

  4. I tried the same thing yesterday. I was able to connect to the database using the following connection string that I found googling the internet:

    Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=path\database.sdf

    You can create the database with Microsoft SQL Server Management Studio Express. I just tried a few SQL statemens and it seemed to work. I don't have a project in mind. It was just an attempt from my curiosity.

  5. In case somebody else has been bitten with non Windows-1252 code page bug, there has been LabVIEW 8.6f1 patch released. There was a problem when entering some charactes into string controls, caption, string constatns and free labels. Typing some language specific characters (like č in slovene) resulted in garbage and even chrased LabVIEW sometimes. After installing the patch, the problem has gone.

  6. Hi!

    I haven't used cFP yet, but I have succesfully connected PCs to Siemens S7/S5 PLCs. I use two methotds. First involvs calling functions from Prodave MPI DLL. Prodave MPI is an API product from Siemens. That of course won't run on cFP.

    The second method uses MPI/Ethernet converters. I that case you need to send commands to MPI/Ethernet converter over TCP/IP. I think this should work on cFP also. I use the MPI/Ehternet converter from IBHsoftec (http://www.s5w.business.t-online.de/english/Selection_Hardware_S7.htm), for which I can send you the VIs I use.

    This is all MPI protocol, not ProfibusDP.

    Mirko

  7. Is there a way to change the color of the error cluster wires (or any cluster wires for that matter) on the block diagram? I have seen images posted that have green error cluster wires.

    Example:

    post-1591-1143677727.png?width=400

    Put the following line into labview.ini

    funkyerrClustWire=True

    It works in LV7.0, I don't know about LV8, since I don't use it (yet).

  8. I was hoping to avoid using an OPC. Find some drivers somewhere but....

    Hi,

    I'm using product called Prodave MPI ($$). This is an API from Siemens. It is a DLL with functions to read/write flags, data blocks, timers, inputs and outputs. Thera are two versions - full and mini. With mini version, only data block can be read or written.

    I can send you the VIs, so you don't have to study the DLL interface. They are only wrappers around DLL calls.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.