Using Python com with B1

I would like to use python to generate invoices from a sales order and am hoping that someone has experience using python com with SAP Business One. I have tried the following:
import win32com.client
import win32com.client.dynamic
from win32com.server.util import wrap as wrap
vCompany win32com.client.dynamic.Dispatch('SAPbobsCOM.Company')
vCompany.Server="SERVER"
vCompany.CompanyDB = "SBO_Test"
vCompany.UserName = "test"
vCompany.Password = "test"
vCompany.Connect()
however I am stranded from here ...
Help and tips would be very appreciated!
Alex

Hi Alex,
I don't know Python, but the code you wrote looks a lot like Visual Basic (well, the second part at least does). Do you get any errors? The Connect method of the company object is a function. You should check if the call returns an error, like
iResult = vCompany.Connect
If the iResult value is 0 there is no error. You can even check
if vCompany.Connected = True then
afterwards.
Next thing you need to do is create a document object. Herewith some VB code, so maybe you can translate - I hope this send you in the right direction
        Dim oDoc As SAPbobsCOM.Documents
        oDoc = vCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
        oDoc.CardCode = "C1000"
        oDoc.DocDate = Now
        oDoc.Lines.ItemCode = "A1000"
        oDoc.Lines.Quantity = 1
        oDoc.Lines.Add()
        oDoc.Lines.ItemCode = "A1000"
        oDoc.Lines.Quantity = 1
        oDoc.Lines.Add()
        oDoc.Lines.ItemCode = "A1000"
        oDoc.Lines.Quantity = 1
        If oDoc.Add <> 0 Then
            MessageBox.Show(vCompany.GetLastErrorDescription)
        End If
Hope it helps,
Adele

Similar Messages

  • Keeping and using the comes with music license onc...

    if i buy a comes with music phone, but the online service isn't yet available to my country, can i keep the license and use it once the service is available to my country?
    Greece Nokia X6 RM-559 v40.0.002

    Hi,
    Most of the time, the reason behind this issue is that a user has 2 services subscribed into, a Comes With Music service and a Nokia Music Store Service. If you sign up and you are being charged, that indicates that you are on the Nokia Music Store.
    The best way to make sure that you are logging in to the correct service, make sure to click on the Comes With Music button and then click sign in. If it so happens that after doing so, you are still being charged, it could be that the username and password for your Comes With Music account is different. 
    You can ask Nokia Careline to assist you in retreiving these information. You would then receive it thru email with the correct username and the temporary password. The information you need to provide the representative for them to be able to pull up your account detail are:
    *IMEI
    *E-mail address
    *Mobile Number
    Hope this helps.
    Your Nokia Angel in disguise

  • Didn't AppleCare used to come with diagnostic software?

    I believe AppleCare used to to come with diagnostic software. I believe it was TechTools by MicroMat, am I correct? Why did they stop including it?
    Is it good software and worth buying & having a copy?

    Is TechTool Pro worth the extra cost?
    Here's the macupdate.com download page for TextTool Pro as well as DiskWarrior and Drive Genius:
    TechTool Pro
    DiskWarrior
    Drive Genius
    I'm giving you those links because macupdate shows reviews from users of this stuff.  Of these three (and apparently all the same price) I would recommend DW ofer TTP.  I'm "neutral" on DG.  But read the reviews for yourself.  Another place for reviews is to check Amazon.
    I view these utiilities as file system utilities more or less in the same category as Disk Utility.  The Apple Hardware Test can be used, as its title suggests, for attempting to validate your hardware (e.g., ram).

  • Can i use Python Matplotlib with labview?

    I have a python code that i want to develop a User Interface for, i found Labview, but can i still use all the add-ons and modules when i run the script in labview? basically, i just want to develop a GUI for my code and I want to use all the modules and add-ons that I had in my code. Addons and modules such as pylab, matplotlib, numpy, scipy, and so on. Thanks!
    Solved!
    Go to Solution.

    The only integration LabVIEW has with Python is that it can call scripts and use the output from those scripts.  Here is an example of how to do that.
    https://decibel.ni.com/content/docs/DOC-8995
    I would use a Python GUI Framework to control your Python application.  Here is a link to the Python Wiki on GUI Frameworks.
    http://wiki.python.org/moin/GuiProgramming
    Regards,
    Matt M.
    Applications Engineer
    National Instruments

  • How do I get DVD for the Windows 7 that should have come with my new laptop please

    This is my first message here so please bear with me. I have just bought a new Lenovo Essentials B570 laptop which has come with Windows 7 pre-installed. Previously I used to buy Dell laptops which used to come with OS Re-installation DVDs which check to see if they are being installed on the hardware it was bought for but would allow us to install the OS on a new hard disk if the original one crashed. Now Lenovo seems to be using a very complicated method to allow buyer's to re-install the OS - they are expected to retain the same hard disk - but what happens is the hard disk crashes and one wants to install the OS along with all the drivers? The Dell DVD allows me to do precisely that. Can I create a similar disk to install the OS on a new hard disk as and when I want/need it please? I have created two sets of DVDs using the OKR software - one set using the 'system presently on disk' and another set for 'resetting to factory defaults' - but from what I have read on these forums these OKR disks would not work if I put a completely new hard disk. So at least if I can get hold of the correct version of the Windows DVD - as I have paid for the license I would be very grateful. Thank you.
    Solved!
    Go to Solution.

    yigit wrote:
    http://forum.lenovo.com/t5/Lenovo-3000-and-Essential/How-to-create-quot-Factory-Default-Recovery-Dis...
    Thanks for the quick reply.
    But to me this looks more like a OKR solution and I have already created these Factory Reset discs.
    Will these discs work if I have installed a completely new hard disk in the dive? Because that is what I would need to do in the rare event that I have a complete hard disk failure.
    What is confusing is the fact that on these forums, I find many messages which indicate that the OKR solution would work only with the original hard disk and it would not work with a completely new hard disk and also that the OKR itself would not be able to change partitions on the hard disk - even when it is the original hard disk. To me this means any disks that are created using the OKR would be useless when the original hard disk has undergone severe change or a completely new hard disk is in its place. Correct me if I am wrong. (In fact I am hoping that I am wrong in that assumption.)
    My laptop has a 750GB hard disk and it has Windows 7, 64bit. I actually want to make this into a dual boot machine with KUbuntu. What is stopping me attempting that is the fact that C drive has bigger partition and D drive is a smaller partition (too small in fact - 30GB these days is practically nothing) and I learn that any modifications I do to drive partitions would render the OKR non functional.
    I can live without this simplistic one key rescue operation if I have recourse to the Windows 7 DVD and that is why I asked the question.

  • Can u hook up a apple remote that comes with a computer with an iPad

    please help

    If you are asking about the infrared remotes that used to come with Apple computers .... No. That will not work.

  • How to use a com server develpped in python

    Hi,
    I am trying to use a Com server, developped with python to communicate with an equipment.
    The server is working fine if  called from VBScript ex:
    Set device = CreateObject("My_server")
    msg = device.DetectTactic(NomTACTIC,portCom).
    I have tried through the ActiveX AutomationOPen, but my Com server doesn't appear in the List.
    How can I correctly register this Server (I have only done a regsvr32 Path/Myserver.dll command)
    Any help will be welcome.
    Best regards
    Marc Baulin

    Hi,
    To select an ActiveX, you have to place an refunum automation on your front-panel and then right click >> Select ActiveX class >> Browse. Your server should appear in the list.
    On the follow link, you will find how manually Register Type Libraries, ActiveX Controls, and ActiveX Servers :
    http://digital.ni.com/public.nsf/websearch/4F811A9​B23F1D46E862566F700615B7A?OpenDocument
    Hope its help.
    Regards,
    Isabelle
    Ingénieur d'applications
    National Instruments France

  • HT4623 I just got an ipad and I use att/yahoo for a server, it comes with free mcafee virus software, but my ipad says that it cant download it because of my upgrade to higher over 6.1.0 and I dont know what to do can anyone help me,want to have mcafee on

    I just got an Ipad and I really dont know much about them its a 32gb 4g wi-fi, I use at&t as my server(dsl) and that works fine but I need to download my mcafee which comes with my at&t for free but it wont let me download it says I need more than 6.1.0and I dont know what to do can anyone help, I know someone that has 1 just like mine but she doesnt use a antivirus and doesnt have any trouble but,,, I have a laptop and a desktop and I use mcafee on both,, so any suggestions, I just down know what to do,,, can anyone give me input on what to do, and I also what to know is there anyway I can use my portable device that I got thru at&t that I can buy minutes on, is there an adapter for this ipad that I can use this on,, help I need all I can get,, thanks chrystie

    You can not install it.
    Only apps from the official Apple App Store can be installed.

  • I've just installed CS6 creative suite mainly for photoshop CS6. It comes with camera raw 7.0.something, but need something newer to use my canon 6d. When I download camera raw 8.5 and install the raw converter doesnt work anymore, wont even open or isnt

    I've just installed CS6 creative suite mainly for photoshop CS6. It comes with camera raw 7.0.something, but need something newer to use my canon 6d. When I download camera raw 8.5 and install the raw converter doesnt work anymore, wont even open or isnt available anymore in the plugin list. Tried to reinstall everything for a few times, but nothing helps.

    When I search for updates the raw converter doesnt get update automaticly. Frustrating, is costing me the whole morning.

  • Can BI Publisher comes with EBize be used to print pdf report from APEX?

    Hi,
    We have EBiz suit (11.5.10) with APEX 3.2. Both are working fine. I want to enable APEX to develop PDF reports. I would like to know whether I can use BI Publisher comes with EBiz to print PDF from APEX.
    If yes where can I get instructions on how to setup APEX with BI Publisher with EBiz.
    TIA
    DineshS

    I'm not aware of the BIP/XMLP Web Services being available in the embedded EBS version (XML Publisher 5.6.3). But you might be able to create your own wrapper to the XMLP APIs in EBS.
    Regards,
    Gareth

  • I'm waiting for my new iPhone 5s to be delivered. I lost my iPhone 5 but did have it backed up on my MacBook Pro. I was using iOS6 at the time. Will I have a problem restoring the data to my new iPhone 5s assuming it will come with iOS7?

    I'm waiting for my new iPhone 5s to be delivered. I lost my iPhone 5 but did have it backed up on my MacBook Pro. I was using iOS6 at the time. Will I have a problem restoring the data to my new iPhone 5s assuming it will come with iOS7?

    No, you should not.  There are problems trying to go the other way, but updating a newer iOS release from a backup of an older iOS release has always been supported and is the basic means of setting up a new device from a previous one.

  • How to use registrati​on-free COM with TestStand

    We create several different test programs run by TestStand. The sequence typically calls a function in a .NET dll that in turn calls functions in COM objects. We would like to use registration free COM to isolate the programs from each other but I'm having difficulty making it work. I know that in principle the manifest file and COM objects could be put in the same directory as SeqEdit.exe but this is unacceptable. I was thinking that using the activation context might be a way to do it. For example in C#: ActivationContext.CreatePartialActivationContext(ApplicationIdentit​y, string[]). ApplicationIdentity is the application identity of SeqEdit and the string [] parameter contains paths and names of manifest files that describe the needed COM objects. The idea would be to load an activation context with the .NET dll called by the sequence so SeqEdit could find the COM dlls in the same directory as the sequence. I haven't gotten it to work yet. Any ideas?

    Russell1,
    I'm going to try to give as thorough description as I can, since many other users may not understand what you're asking about.
    Normally, a COM server (ActiveX servers are COM servers) is registered with Windows via the registry.  Unfortunately, you can only have one version of the server registered at a time.  This is one of the reasons why TestStand (which is a COM server) needs a version switcher to change between engine versions.
    There is a technology called "Registration-free COM" that allows an application to use a COM server without having it registered in the windows registry.  It involves creating manifest files for the COM server and for the application that is calling the com server.  These manifest files are used by the operating system when the application tries to call the COM server to find the server.  Usually the OS would go to the registry, but it will check the manifest files first.
    The best reference on registration-free COM is an article on MSDN: Registration-Free Activation of COM Components: A Walkthrough.
    A year or so ago, there was a TestStand customer who was interested in forcing some of their applications to use a certain version of a COM server; I was able to get this working for them. 
    I tested the .NET and MFC TestStand user interfaces, and found that I could get registration-free COM working with both.  I found that two .manifest files needed to be created.
    The first is a .manifest file for the COM server.  This was a straightforward process following exactly the instructions in the above walkthrough (Step 7).
    The second is a .manifest file for the UI.  Since the TestStand UIs have their manifest files embedded in the application, I had to modify the .manifest file before building the UI, or use the .NET SDK tool mt.exe.
    After creating both manifest files, I found that adding them was enough to make .NET calls to the COM server work correctly if the application and server were in the same directory. 
    Unfortunately, I did not do any testing with having the COM server in a different directory.
    Now, on to your question:
    I just did some poking around on MSDN, and I have found the following information.
    Note that after you have configured a .manifest file for your COM server, it is then referred to as an "assembly".  I am making an assumption here (but I think it's a reasonable assumption) that after this, the COM server can be used just like any other assembly.  Specifically, it will be searched for in the same way an assembly is searched for.
    MSDN documents How the Runtime Locates Assemblies.  Note near the bottom of that page, if the assembly has not been bound to before, and it is not in the Global Assembly Cache (GAC), it will probe for the assembly.  From this I think the following are possible solutions.  Please note that I haven't tested any of them.
    MSDN documents the Probing behavior.  Note that it will only probe in sub-folders of the current application root directory ([application base]).  Note that there is also some information at the bottom of the page about COM interop scenarios.  I think what it is saying is that if you already are in an assembly, and call a COM server, it will look in the same folder as that assembly for the COM server.  This might be a possible solution for you.
    There is also an AssemblyResolve event that is fired if the CLR is unable to locate the assembly.  I don't know if this event is fired in the case that the COM server cannot be found, but if it is, you could then define your own way to search for the server.  I found this information in a blog post by Microsoft developer: https://blogs.msdn.com/junfeng/archive/2006/03/27/​561775.aspx
    One last possibility is to use an Application Configuration file; which is similar to a manifest file.  According to that page, there is an element called 'probing' that you can use with Windows 7 or Windows Server 2008 R2 when defining assembly binding to specify relative paths to probe for the assembly.
    I honestly don't know if any of these possibilities will work.  Please let me know if you get it working or if you need some more help, and I'll do my best to assist you.
    Message Edited by Josh W. on 02-04-2010 03:23 PM
    Josh W.
    Certified TestStand Architect
    Formerly blue

  • I recently got a hand-me-down Macbook (white) 2010 and want to restore to factory settings. The computer did not come with any discs. It is running 10.6.8 and I purchased 10.6.3 recently to upgrade my MacBook Pro. Can I use that to restore the MacBook?

    I want to give the hand-me-down to my kids so they will stay off my MacBook Pro I'd like to start fresh with the MacBook, remove all the former owners information, restore it to factory settings, but it did not come with any installation discs, so I don't know what to do. I recently purchased Snow Lepoard for my 2008 MacBook Pro. Can I use that to restore the MacBook? Also, the former owner purchased Microsoft Office (ugh) with the computer but again, no installation discs. How do I keep that when I restore?
    Any help would be appreciated.
    Thanks!

    I purchased a mini to HDMI cable and tried to connect to the TV but the TV is not recognizing the computer. I attempted to set sound and display settings under the "my Preferences" utility with no success.  Again, I'm not sure if I need to upgrade my OS software Any Suggestions?

  • An issue using the COM components supplied with SAP GUI 6.2 or 6.4

    We are having an issue using the COM components supplied with SAP GUI 6.2 or 6.4.  We used to have SAP 4.6c and now we have 5.0.  When we were on 4.6c, we used these COM components to logon and execute RFC calls and we had much success.  Now that we are on 5.0, we can’t seem to instance any SAP functions that have something to do with SAP Workflow.  We have experienced this problem when using VB6 or .NET, but our existing code that always worked is in VB 6.0.
    SAP Components used:
    o     SAP Logon Control
    o     SAP Function Control
    o     Librfc32.dll
    o     Other supporting C DLLs and/or COM object supplied with the SAP GUI installation.
    For example, if we want to call the RFC ARCHIV_CONNECTION_INSERT, this code fails in VB6 when the “Set objworkflow = objFuncCtrl.Add(strFunction)” line of code executes.  Instead of returning an instance of the object ARCHIV_CONNECTION_INSERT function, no object is created.  In 6.2, SAP raises no errors, but the object we are trying to create is still “Nothing”.  If we use 6.4, SAP raises an error “SAP data type not supported” via a message box and then the object is still = Nothing.  Interestingly enough, the 6.2 GUI COM controls don’t display the error dialog.  The message box that is shown comes from the SAP Function COM Object "SAP.Functions" (wdtfuncs.ocx).
    Now, what is interesting is if we use the same code to call a standard function or custom function that doesn’t have anything to do with SAP Workflow, then the code works fine.  Again, all of our code used to work just fine on an SAP 4.6 system.
    Here is the code that fails:
        'SAP Logon control - object for creating connections to an SAP system
        Dim objSAPLogonCtrl As Object
        'SAP connection object
        Dim objConnection As Object
        'Object that will represent the SAP function called
        Dim objSAP As Object
        'SAP function control object - object factory for creating other SAP function objects
        Dim objFuncCtrl As Object
        'Create instance of an SAP logon conrol
        Set objSAPLogonCtrl = CreateObject("SAP.Logoncontrol.1")
        'Create a connection object
        Set objConnection = objSAPLogonCtrl.NewConnection
        'Define connecion parameters
        objConnection.ApplicationServer = "sapvm"
        objConnection.SystemNumber = "00"
        objConnection.Client = "800"
        objConnection.User = "iissap"
        objConnection.Password = "tstadm"
        objConnection.Language = "E"
        objConnection.TraceLevel = 10
        'call the logon method of the connection object
        If objConnection.Logon(0, True) = False Then
            MsgBox Error
            Exit Sub
        End If
        'Create an instance of the SAP Function control object
        Set objFuncCtrl = CreateObject("SAP.Functions")
        'Set the function control connection object
        Set objFuncCtrl.Connection = objConnection
        'Function name to be generated and called
        Dim strFunction As String
        strFunction = <b>"ARCHIV_PROCESS_RFCINPUT"</b>
        'Create an instance of the function defined in strFunction
        Set objworkflow = objFuncCtrl.Add(strFunction)
        If objworkflow Is Nothing Then
            MsgBox "Could not create object " & strFunction
        Else
            MsgBox strFunction & " object created."
        End If
    If anyone has seen anything like this or has any ideas, please help!
    Mike and Hameed
    <b></b>

    Hi,
    documentation on the Scripting API is available at ftp://ftp.sap.com/pub/sapgui/win/640/scripting/docs/
    This API is a replacement of the existing, obsolete COM interfaces.
    Best regards,
    Christian

  • HT4437 I have successffully used my iPad with the Apple TV with no problem but just recently, the Airplay icon doesn't come up on the iPad anymore when I'm trying to connect.   What can I do to fix this?

    I have successffully used my iPad with the Apple TV with no problem but just recently, the Airplay icon doesn't come up on the iPad anymore when I'm trying to connect.   What can I do to fix this? 

    Try restarting your router as a first thing, this sometimes works for me.

Maybe you are looking for

  • Control of Incoterms in creation of Shipment Costs

    Dear All, We calculate shipment costs (Through Transportation module in SD-Freight payment-Outwards) on calculation base A (Delivery) or B (Delivery item) and do not want to calculate deliveries that have certain Incoterms (for example, TOP-To Pay, w

  • How can I repair organizer in adobe photoshop elements 6.0?

    I ran the optimizer in Norton and after that I couldn't get to the organizer in adobe photoshop elements 6..  When I try to reinstall the program it says to "insert disc 1".  (I am sure you know because lots of people with adobe have this same proble

  • How to translate database character from GB2312 to GBK?

    I have a problem. I am response for managing a large Oracle database. The RDBMS is oracle 8.1.6 under solarise 2.7 . I need to translate database character from GB2312 to GBK. Who can tell me how to do? Thank you very much.

  • Logical databases (sorry for not introducing myself)

    New on this forum. Logical databases have any use? What is a subprogram? Moderator message: please search for available information/documentation. [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] [Asking Good Question

  • Server capacity

    Hello everyone. Thanks for taking a second to read this and hopefully reply. I will start off with the usual "hi my name is matt and im an alcoh.. wait I mean im a complete zero when it comes to Servers. But I know I needed one or two because I have