B1DE / PrintEvent  ..

I am trying to think of a way to capture the output from a document print ( a sales invoice) so that i can do some additional processing on a subset of the printed items (export them to an external file) . I am using B1DE to create my application and the event handlers but i'm having a a problem with the printEvent  - namely where to put it and how to name it  ? I can add a handler to the "ok" button on the Document print dialog but this receives an ItemEvent and i'm not sure that this can or should be cast to a printEvent .. Is it just a case of capturing the print event from the main menu and doing all my processing within there  ?  I'm hoping the printEvent will hold the necessary info for me to extract what i want . In the main class B1DE generates a number of event handlers (eg OnShutDown(), OnCompanyChange() ...)  that i can overide but i dont see anything related to printEvents ..
How can I handle this within B1DE framework  ? 
Thanks  ..

Thanks for the reply  .. I did try this within the main addon event handling application class generated by B1DE  ..
In the constructor ..
public Sample() {
            // ADD YOUR INITIALIZATION CODE HERE     ...
            // Add an event handler for the print event  ...
            B1Connections.theAppl.PrintEvent += new  SAPbouiCOM._IApplicationEvents_PrintEventEventHandler(myPrintEventHandler);
and this for the event handler in the same class .. 
  private void myPrintEventHandler(ref SAPbouiCOM.PrintEventInfo pVal, out bool BubbleEvent)
            BubbleEvent = true;
            B1Connections.theAppl.MessageBox("The Print event has been sent", 1, "Ok", "", "");
But the code is never called  ..  Would you happen to know if this is the correct way to add this handler
via B1DE  ?
As an aside i tried one of the samples provided in the SDK(2007A) but with a couple of small amendments  ..
I used the "CatchingEvents" example but added the following 2 lines to register additional listeners ..
// Try these additional events  .. 
        SBO_Application.PrintEvent += new SAPbouiCOM._IApplicationEvents_PrintEventEventHandler(SBO_Application_PrintEvent);
        SBO_Application.ReportDataEvent += new SAPbouiCOM._IApplicationEvents_ReportDataEventEventHandler(SBO_Application_ReportDataEvent);
with this handling code ..
    private void SBO_Application_PrintEvent(ref SAPbouiCOM.PrintEventInfo pVal, out bool BubbleEvent){
        BubbleEvent = true;
        SBO_Application.MessageBox("The Print event has been sent", 1, "Ok", "", "");   
    private void SBO_Application_ReportDataEvent(ref SAPbouiCOM.ReportDataInfo pVal, out bool BubbleEvent)
        BubbleEvent = true;
        SBO_Application.MessageBox("The ReportData event has been sent", 1, "Ok", "", "");   
These events didn't fire as expected either - they didn't fire at all . Can anyone see a problem with my implementation or my interpretation of the event handling  ?  ..
Edited by: Rob Morning on Apr 8, 2008 2:59 PM

Similar Messages

  • Problem in creation of ARD using B1DE 1.5

    Hi Experts
    I have develop an AddOn using B1DE 1.5. It is working properly. Now I want to create ARD file of addon . I use 'SAP B1 AddOnInstaller.Net wizard to create ARD file. I follow all the setps of wizard. It finish without any error. But it does not create ARD file in Bin folder. What can be problem ? Please suggest me.
    Thanks
    Regards
    Jitender

    Jitender,
    You could manually create the ARD file by using the AddOnRegDataGen.exe.  If you search the SDK Help file for "Create a Registration Data File", you will find the documentation that tells you how to do this.
    With respect to B1DE ... if you actually go to the folder where you save your projects and open the installer project you created, as an example ...\Documents\Visual Studio 2008\Projects\B1AddOnInstallerNET1\B1AddOnInstallerNET1\B1AddOnInstallerNET1\
    ... in the ...\AddOnRegDataGenFile there should be an AddOnRegDataGen.bat file.  You can try to also manually execute this to see if the .ARD file gets created.  If it still does not it could be due to a pathing issue .bat file.  You may want to check that the paths are correct.
    Again ... worst case you can manually create the .ARD file as stated above.
    Eddy

  • B1DE Add-on Failure

    Hey Gurus,
    We have developed an Add-on using the code generator wizard from the B1DE. The Add-on runs fine on machines, where Microsoft Visual Studio .Net 2005 is installed. But it crashes on the PCs, where .Net Framework 2.0 is installed properly and do not have Microsoft Visual Studio .Net installed.
    Below are the few information that can help you to track down the issue.
    System: SAP Business One 2005 A (6.80.318) SP:01 PL:10
    SQL: SQL 2005
    .Net Framework: 2.0
    Add-on created using: B1DE Add-on Wizard
    Error Message:
    System.Reflection.ReflectionTypeLoadException
    Message: "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information."
    Source: "mscorlib"
    I did rebuilt the add-on using B1DE, copied my code in the new solution file and the Add-on worked for few days, now it started giving me the problem again
    Any help in this regards will be rewarded.. I mean will be highly appreciated..:)
    Thanks & Regards,
    ~Bibs

    Hey Rob,
    Thanks for the reply.
    I did use the B1DE Add-on generator for my Add-on code and the wizard generated the correct and the latest dll i.e., B1WizardBase.dll.
    My Add-on works if i rebuilt a new solution and move the code from the old solution file to the latest solution.. But the problem persist after some days..
    I think I have mistakenly unmarked my post as normal post and no one wants to help for a post which will not give any rewards...???
    Regards,
    ~Bibs

  • B1DE Installer compatibility with Windows Vista

    Hi All,
    We are developing an add-on for SAP Business One 2005B.
    While testing the add-on on Windows Vista we noticed that the Add-on installer created using the the professional installer of B1DE hangs during installation.
    i.e. - After registering the Add-on in SAP Business One, when we restart SAP Business One, the install routine does start but hangs during the installation process.
    We are using Version 1.2 of B1DE.
    Can some one please help us with this situation.
    Regards,
    Pankaj Mathur

    Hi Pankaj,
    Vista is not currently supported for either the B1DE or SAP Business One. Therefore, even if you could get the add-on to install, you couldn't get support from SAP if you come across any issue.
    I expect SAP will bring out a service pack or a patch for running SBO on Vista and a new version of the B1DE will emerge about the same time. Until then, I'm afraid you'll have to stick to XP.
    Kind Regards,
    Owen

  • B1DE 1.4: unknown error 2869

    I can't install B1DE 1.4, give me at the end of installation process an 'unknown error 2869'.
    I'm using Windows Vista, with Visual Studio VB 2005 AND Visual Studio C#, SapB1 2007.
    Thanks!

    Hi,
    B1DE installation checks the Namespace lenght you give and blocks installation in case your namespace is more than 4 characters long.
    It is recommended to use short Namespaces to avoid length restrictions fixed by B1.
    Nevertheless if you have a longer namespace and you don't want to /can change it to a shorter one there is a trick allowing you to use your namespace with B1DE. Just follow the steps here bellow:
    1) During B1DE installation give a short Namespace of 3 characters to allow B1 DE installation.
    2) After installation just run "regedit" in order to change the value of the namespace used by B1DE.
    The registry you have to change is:
    HKEY_CURRENT_USER\Software\SAP\SAP Business One Development Environment\ => namespace
    or
    HKEY_LOCAL_MACHINE\Software\SAP\SAP Business One Development Environment\ => namespace
    3) Once you have changed the registry value the new namespace entered will be used by B1DE (even if it is longer than 4 characters).
    I have just tested it with a small project, if you have any problem with long namespaces in B1DE please post it here.
    Hope it helps
    Regards
    Trinidad.

  • Error in B1DE during creation of a professional installer (VS2005/SAP2005)

    Hi, few weeks ago, I created a professional installer for my add-on with the B1DE for SAP 2004. Now, I have to create exactly the same professional instaler for SAP 2005 (and VS2005), but I have some problems.
    First: When I execute the 'VB B1 AddOnInstaller Setup .NET' wizard, enter all required information and press 'Finish', I always have the same messagebox error:
    "Cannot add the link because the source file '.../relase/setup.msi' cannot be found"
    When I press OK, the installer project is shown, but no setup has been created. If I manualy add the setup and add my addon in the 'Application Folder' section of 'File System', the UI and DI API dependecies are not detected, is it normal is Vs 2005 ?
    Thanks for your help, Francois

    Hi ESAKKI, I read your post and I can now install and uninstall my add-on, thanks !
    However, at the end of the uninstallation. I've got this error:
    "Unhandled exception at 0x774d2108 inmsiexec.exe: 0xC0000005: Access violation reading location 0x00000000"
    I know that is not very helpful, but it's the only info I can give. Anyone know why I have that error or know how haven't it ?
    Thanks, Francois

  • B1DE 1.5 Help

    Hi experts
    I am new for B1DE coding. Can anybody give me the link for B1DE help. I am very good in simple coding of SDK. I also checked the help file the B1DE but there is no samle program. Plz send me pdf or flash file .
    Thanks
    Regards
    Jitender

    Jitender,
    There is not sample code that comes with B1DE.  You can download the source code for the tool ... but I am not sure this is what you are asking.  The B1DE Help discusses what is available with B1DE.  There are presentations on B1DE that you can find in the "Recent Business One Articles" area such as this one ...
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/92af3198-0e01-0010-27aa-8859890672c9
    Eddy

  • How to add multiple table when creating add on using b1de

    Hi all,
    Plz help me
    How to add multiple table when creating add on using b1de.
    Thanks

    Hi dns_sap,
    Can you explain a little better what you are trying to accomplish? Is it to create UserTables and UserFields in the database, when the addon runs the first time?
    If so, you can use the following code
    Add User Table
            Try
                Dim lRetCode As Long
                Dim oUDT As SAPbobsCOM.UserTablesMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
                oUDT.TableName = TableName
                oUDT.TableDescription = TableDescription
                oUDT.TableType = TableType
                lRetCode = oUDT.Add
                '// Check for error when adding the Table: if lRetCode = 0 the table was created; if lRetCode = -2035 the table already exisits
                If lRetCode <> 0 Then
                    oApplication.MessageBox("Error: " & lRetCode.ToString & ", " & oCompany.GetLastErrorDescription)
                End If
            Catch ex As Exception
                oApplication.MessageBox(oCompany.GetLastErrorDescription)
            Finally
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oUDT)
                oUDT = Nothing
                lRetCode = Nothing
                GC.Collect()
            End Try
    Add User Field
    Try
                Dim lRetCode As Long
                Dim oUDF As SAPbobsCOM.UserFieldsMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
                oUDF.TableName = TableName
                oUDF.Name = FieldName
                oUDF.Description = FieldDescription
                oUDF.Type = FieldType
                lRetCode = oUDF.Add
                '// Check for error when adding the field: if lRetCode = 0 the field was created; if lRetCode = -2035, the field already exists
                If lRetCode <> 0 Then
                    oApplication.MessageBox("Error: " & oCompany.GetLastErrorCode & ", " & oCompany.GetLastErrorDescription)
                End If
            Catch ex As Exception
                oApplication.MessageBox(oCompany.GetLastErrorDescription)
            Finally
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oUDF)
                oUDF = Nothing
                lRetCode = Nothing
                GC.Collect()
            End Try
    Regards,
    Vítor Vieira

  • How to change connection string for a form created with b1de

    Hi all
    i've created a form using the Code Generator tool ob B1DE
    My question is how can i set the connection string to a different server and database. doing so after the creation wizard has finished?

    Hi,
    Why do you need to change the connection string? What are you calling "connection string for a form"???
    The only connection string I now about is the one used to connect to the UI API... and this one is fixed for all apps in debug mode and given as parameter when your addon is registered in B1.
    The connection string is filled in the code of your generated addon.
    Please go to the main class of your addon, in the main method you have the following code where the connection string is filled either with the command line parameters (release mode) or with the fixed value given by SAP. This code doesn't need to be changed...
            public static void Main()
                int retCode = 0;
                string connStr = "";
                bool diRequired = true;
                // CHANGE ADDON IDENTIFIER BEFORE RELEASING TO CUSTOMER (Solution Identifier)
                string addOnIdentifierStr = "";
                if ((System.Environment.GetCommandLineArgs().Length == 1)) {
                    connStr = B1Connections.connStr;
                else {
                    connStr = System.Environment.GetCommandLineArgs().GetValue(1).ToString();
                try {
                    // INIT CONNECTIONS
                    retCode = B1Connections.Init(connStr, addOnIdentifierStr, diRequired);
    Regards
    Trinidad.

  • Can't connect to company using B1DE

    Hi
    I have just installed B1DE for SAP 2005 SP1.
    The problem I have is that when I run the addon wizard and the connection screen comes up, I get an error - 'connection to database failed - connection to sbo-common has failed '
    I get this with the sdk if I don't have a valid period set up. The periods are set fine.
    Can anyone suggest anything please ?
    Thanks
    Regards Andy

    Hi,
    Can you please take a simple addon and replace the DI connection by the following code?
    You only have to replace all strings with the corresponding datas you want to use:
    diCompany.Server = "localhost";
    diCompany.CompanyDB = "YourCompany";
    diCompany.UserName = "manager";
    diCompany.Password = "manager";
    diCompany.DbUserName = "dbusername";
    diCompany.DbPassword = "dbpassword";
    int ret = diCompany.Connect();
    if (ret != 0)
            int errcode;
            string errmsg;
            Globals.diCompany.GetLastError(out errcode,out errmsg);
            Cursor.Current = Cursors.Default;
            MessageBox.Show("ERROR - Connection to company failed: " + errmsg);
    Please let me know if it works or not
    Regards
    Trinidad.

  • B1DE / CFL / Event Handling  ..

    Had problems with CFL's in an application i'm developing so i've created a real simple demo of my problem in the hope someone can help me ..
    In the sample i have a simple screen designed with the painter with a static text field, an edit box and a button . In the .srf  I have defined a CFL with multi selection =  false, object type=2 and a unique ID = 'CFL_1'  and i have attached it to the button via within the .srf .
    I then have a simple before / after event handlers attached to my button to catch the before/after choose from list events 
    When i push the button the before event fires and my little message is displayed (correctly) .  The event returns true (bubbleevent ..) BUT no list appears and no after event is fired .. The routine is trivial but i can't see any reason for the non appearance of my list .. Can anyone shed any light on my problem ?  I'm on SAP2007A PL 15 and using B1DE to generate my initial app (using C#) .. I've tried generating the code inline (creating CFL in code) and attaching it to the button but the result is the same - before event fires and no list ...   If i run one of the SDK examples (ChooseFromLists) which uses this list then it runs without problem ..  I've been on with this for a couple of days now and it's really frustrating ..  I've added the event handlers - but these are essentially the vanilla ones generated by B1DE. Is it anything to do with how B1DE registers the event handlers ?
    public Button__CFL1__btLookup() {
                FormType = "CFL1";
                ItemUID = "btLookup";
            [B1Listener(BoEventTypes.et_CHOOSE_FROM_LIST, true)]
            public virtual bool OnBeforeChooseFromList(ItemEvent pVal) {
                Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
                Item item = form.Items.Item("btLookup");
                Button button = ((Button)(item.Specific));
                // ADD YOUR ACTION CODE HERE ...
                B1Connections.theAppl.MessageBox("Choose from list button (before) ", 0, "Ok", null, null);
                return true;
            [B1Listener(BoEventTypes.et_CHOOSE_FROM_LIST, false)]
            public virtual void OnAfterChooseFromList(ItemEvent pVal) {
                bool ActionSuccess = pVal.ActionSuccess;
                Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
                Item item = form.Items.Item("btLookup");
                Button button = ((Button)(item.Specific));
                // ADD YOUR ACTION CODE HERE ...
                B1Connections.theAppl.MessageBox("Choose from list button (after) ", 0, "Ok", null, null);
    " Help me Obi Wan  .. you're my only hope  ... "
    Thanks

    Hi Noor , I think i found my problem  .. I created this using the screen painter in PL 7  .. I created a similar screen by hand , saved both and compare XML  .. Screen painter added a 'MODE=0' tag  , manual one created using parameters had 'Mode='1' .. Changed mode on screen painter code to mode='1' and everything worked !  .. Couldn't  see anywhere on screen painter how to explicitly set this keyword , only ones saying -1 represents all modes .. Anyway , thanks again for you interest  and contributions  .

  • B1DE / KeyDown Event  ...

    I have a problem with an addon i'm developing  .. I have a matrix on a screen for which i'm trying to capture a KeyDown event (actually the 'Del' key but it seems to happen with all keys) ..
    I attach an item listener to my matrix as shown below ..
      [B1Listener(BoEventTypes.et_ITEM_PRESSED, true)]
            public virtual bool OnBeforeItemPressed(ItemEvent pVal) {
                Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
                Item item = form.Items.Item("mtx_0");
                Matrix matrix = ((Matrix)(item.Specific));
                // ADD YOUR ACTION CODE HERE ...
                B1Connections.theAppl.MessageBox("Key Pressed", 0, "Ok", null, null);
                return true;
    I notice there is no KeyDown event so i assume the ItemPressed event can be used .. Is this correct  ?
    Also in my main add on I have ..
    // ADD YOUR INITIALIZATION CODE HERE     ...
                EventFilters filters = B1Connections.theAppl.GetFilter();
                //  BoEventTypes.
                EventFilter filter = filters.Add(BoEventTypes.et_KEY_DOWN);
                filter.AddEx("MyAddonScreen");
    ... to enable global trapping of keydown by my addon ..
    Any help gratefully received  ..

    Thanks David  ..
    In that case B1DE doesn't expose a KeyDown Event  .. So I assume that I must create a separate
    key down event handler in my main addon code  .. maybe like  ..
    // ADD YOUR INITIALIZATION CODE HERE     ...
                EventFilters filters = B1Connections.theAppl.GetFilter();
                //  BoEventTypes.
                EventFilter filter = filters.Add(BoEventTypes.et_KEY_DOWN);
                filter.AddEx("MyAddonScreen");
               B1Connections.theAppl.ItemEvent += new _IApplicationEvents_ItemEventEventHandler(theAppl_ItemEventHandler);
    .. and then an event handler ..
    private void theAppl_ItemEventHandler(string formUID, ref SAPbouiCOM.ItemEvent pval, out bool BubbleEvent)
                BubbleEvent = true;
                Form form = B1Connections.theAppl.Forms.Item(formUID);
                if(form.TypeEx.Equals("MyAddonScreen"))
                    B1Connections.theAppl.MessageBox("The ItemEvent has been trapped ", 1, "Ok", "", "");
    Is this the correct best practice ?

  • B1DE For VS 2008

    Hi,
    Am Currently working with VS 2008 to Create Add-ons.. sofar i worked on VS 2005 and created ARD through B1DESetup_2005_1.3_VS2005 without any problem.. now what version i have to use to create ARD.. B1DE only available for Frameworks upto 2.0 only in Downloads Section.Any suggestion...
    -- Ganesh

    Hi
    Still now there is no new version of B1DE for Visual Studio 2008. I think so new version will be released soon.
    There is another method
    Go to this path
    C:\Program Files\SAP\SAP Business One SDK\Tools\AddOnRegDataGen
    run AddOnRegDataGen
    Through this it could be solved.
    -Anto

  • B1DE (AddOn Installer) for 64 bit server

    Hi All,
    I have a problem. One of my client has a 64 bit server. AddOn installation created with B1DE for SAP 2007 doesn't work on that server. After running SAP AddOn is trying to install, and then there is an error. Is there any way to create AddOn installation files that work on 64 bit server?
    Regards
    Hmg

    Both Robin and Owen are right... You need to run your code as forced 32 bit.
    The reason is the following:
    - A default project in Visual Studio is compiled as "Any CPU"
       - Any CPU means that you code will be executed as 32bit on a 32bit machine, and 64bit on a 64bit machine.
       - The Any CPU option is great for pure .NET (since all parts of it can run 32bit and 64bit)
       - In case of the SAP SDK and the AddonInstaller.dll, these are COM-based unmanaged code
          - If such unmanage code is not written to work with 64 bit, problems like yours can occur (this happens not only for SAP SDK... Tons of API out there have the same problems)
    - If you change the Any CPU option to the x86 option, you will force 64 bit mashines to run your code in "simulated" 32bit (Don't worry.. it is quite fast and gives no problems)
    We are you this with our 64 bit customers and without any problems...
    Lastly, if you wish to know more about this please hear the following podcast that describes the issue in detail (A good listen): http://www.dotnetrocks.com/default.aspx?showNum=341
    /Rasmus

  • B1DE Problem

    Hi everybody, I created a program that add a menu and a menu item, if I work with the visual studio without creating the installer, the system works fine. But if I want to create the installer with B1DE, I have a lot of problems. It creates me the .exe but not the .ard file. If I create the .ard later, with the sdk tool, when I try to install the addon in sap b1 the system shows me an access denied error. Do you any idea of that? Regards.

    Hi Fernando
    The best place to post this question is the SDK forum and not the Business One Forum.
    Kind regards
    Peter Juby

Maybe you are looking for

  • Error while defining USB dribe as backup device in MSSQL

    Hi all, i am facing this error when i am creating a new backup device in MSSQL and while watching media contents. System.Data.SqlClient.SqlError: Cannot open backup device 'SAPMSQLDB(E:\SAPBackup\SAPMSQLDB.bak)'. Operating system error 2(The system c

  • IPod Touch (5th Gen) Battery Won't Hold Charge

    After the last update my iPod Touch 5th Gen will not hold a charge. I haven't had any problems with it until this 8.1.1 update. Yesterday I charged the battery up to full charge and  used it briefly to listen to music in my car however here it is the

  • Notify users before password expires

    Hi, We have some Vibe external users that need to be notified when their passwords are about to expire, so they can ask us for a new password (their accounts are created in our tree) I can't seem to figure out any way to allow this so please help...

  • WPC web form error...

    Hi all, I am new to WPC and i am trying to create sample  DropDownList wpc editor component that will be shown in the custom web form properties. When i try to open the custom web form i am getting the below error. Exception ID:11:29_01/10/09_0012_10

  • Help. Cs6 to CC!!!

    Is it not possible to upgrade from cs6 to CC ?- or do I buy for a year at a time? //