Skip to Content
-1

Desktop app with SAP B1 UI API inside

Hello,

I just started developing an addon for SAP Business One 9.0.

I need some advanced components (e.g. a complex tree-grid). SAP UI API is quite poor in components. I know I can insert third-party ActiveX controls inside UI API forms, it works, but in this way my choice is limited to ActiveX controls and also developing an addon in this way is intricate...

So I wonder if I can do the opposite: can I create a classic Windows application, embedding SAP UI API controls when I need them? I could launch it from a B1 menu item.

It's an idea, what do you think? Everybody make do with SAP UI API? Or are there other solutions? Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 05, 2013 at 06:47 AM

    Hi Simone Pastorin,

    The first, you must install some things :

    1. DI API Installation : to do with object and database of SAP Business One. You can create Window Application to communication to SAP Business One.

    2. SAP Business One SDK : to do with UI of SAP Business One. You can create UI form in SAP Business One like the standard UI of SAP Business One.

    I hope to help you.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Simone Pastorin

      Hi Simone,

      i guess this is not possible! SAP has it's own drawing routines and controls. I guess they just don't use standard .Net Controls or ActiveX controls. This is why you can't use it in your own windows application.

      You may go another way. Try to create your form as a standalone control in .Net und force SAP B1 to show your control in a normal SAP Form in SAP B1.

  • Posted on Apr 09 at 07:58 PM

    Hi Simone Pastorin,

    first solution maybe is using sap for visual studio, where it has it's on designer like win forms has.

    which can connect to sap system forms and your created forms as well.

    Second solution

    It's possible to embed windows.forms in SAP UI,

    but it will limit to custom created forms, not SAP system forms.

    also one important thing is that you will not be able to bind win forms controls to sap data sources.

    So with windows form you are adding system.windows.forms components on designer, but you will need to handle all data processing by hand, it will not be automated, I gave up on this method as sap for vs is better choice though it has lack of customisable controls and activex nowadays is hard to mantananse.

    private static void SapApp_MenuEvent(ref MenuEvent data, out bool bubbleEvent)
            {
                bubbleEvent = true;
                if (!data.BeforeAction) return;
    
                try
                {
                    //this is my custom created form
                    if (data.MenuUID == "MNU_Form1")
                    {
                        var par = SapApp.CreateObject(BoCreatableObjectType.cot_FormCreationParams) as FormCreationParams;
                        par.UniqueID = "Form1";
                        par.FormType = "Form1";
                        par.BorderStyle = BoFormBorderStyle.fbs_Fixed;
                        par.Modality = BoFormModality.fm_None;
    
                        var sapForm = SapApp.Forms.AddEx(par);
                        sapForm.Title = "Form1";
    
                        var type = _formsAssembly.GetTypes()
                                .Where(t => t.IsSubclassOf(typeof(WindowsForm)) && !t.IsAbstract)
                                .FirstOrDefault();
    
                        var t = new System.Threading.Thread((start) =>
                        {
                            //WindowsForm is child class of Form with additional method void Register where I path SAP.Form object
                            var winForm = Activator.CreateInstance(type) as WindowsForm;
                            winForm.Visible = true;
                            winForm.ShowInTaskbar = true;
                            winForm.TopMost = true;
                            winForm.ControlBox = true;
                            winForm.Register(sapForm);
                            winForm.Show();
                            winForm.Activate();
                            winForm.Focus();
                            
                            //this is where I load my win form into sap UI
                            System.Windows.Forms.Application.Run(winForm);
                        });
                        t.Start();
                        //sapForm.Visible = true;
                        //sapForm.Select();
                    }
                }
                catch (Exception ex)
                {
                    HandleException(ex, "Exception occurred during MenuEvent handling.", true);
                }
            }
    
    
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.