Monday, February 22, 2016

First SAP Business One Add-On Project on Visual Studio 2013 using SAPBusinessOneSDK

In this post, I'm going to explain how I created my first SAP Business One Add-On Project using Visual Studio 2013.

Before progressing ahead you must verify the prerequisites mentioned in this SAP Community Page.

After you have installed the SAP Business One studio, make a search in the start menu.



- SAP Business One Studio (32-bit), is the SAP in-build IDE provided for Add-on development.


- SAP Business One Studio for Microsoft Visual Studio 2013 opens up the visual studio 2013


If you want to create the add-on from a Package generated by the "SAP Business One Studio" go ahead with the "SAP Business One Add-On Project From B1s File" project type and Visual Studio will prompt you to browse your 'b1s' file.

Select "SAP Business One Add-On Project", and you will get an SAP Business One to look and feel form as below.


When you start debugging the project you will be hit with the below exception.



The reason was I haven't opened up the SAP Business One Client (32-bit) before starting the debugging process.

I have updated the Title property of Form1 as "Hello Sap B1" and pressed F5.


1- My add-on is listed under the Modules of the Main Menu.
2- Form1 will be visible when you click on Hello_SAP_B1.
3-When Form1 is clicked, you could see your form inside the SAP Business One.

Then open the Menu.cs file, according to my understanding the code in this file controls how the add-on is shown in the SAP Business One Client.

I've done a few changes in the Menu.cs file with the intention of observing how it behaves.

I've changed the name of the package (removed underscore signs), added an extra code block to check and remove if my add-on it is listed in the Main Menu, and changed the display name of my form.


I've got the exact result that I wanted. Then I renamed Form1.b1f in the solution as "HelloB1.b1f" and set the same value for Unique ID. (Note::this change is indicated in the Menu.cs file code change by a red arrow).

oCreationPackage.UniqueID = "Hello_SAP_B1.HelloB1";

If you debug the project at this stage your form will be listed in the main menu but will not be popped out. Luckily I could find out what was the reason by observing the HelloB1.b1f.cs file.



Even I have renamed the Form from Solution Explorer, which has not renamed the name of the behind class and certain annotation properties. So I've altered "Form1" with "HelloB1", as a result, you even will get two compilation issues in SBO_Application_MenuEvent of Menu.cs class.

After doing the below amendments, I could see my form inside the SAP Business One.



These are the first few experiences that I had with the SAP Business One add-on development, and I believe this post will be informative for all the people who start it for the first time.

I'm pretty sure these PDFs will save a few days of your life.

How to Guide SAP Business One 9.0

SAP Business One – SoftwareDevelopment Kit (SDK)

Web site of  Mepa-Data AG

13 comments:

  1. Where did you find an installation of SAP Business One Studio for Visual Studio 2013? I am installing from SAP 9.2 and all I get is the version that requires Visual Studio 2010.
    The version installed is 920.130 PL03. What version do you have installed that is SAP Business One Studio for Visual Studio 2013?

    ReplyDelete
    Replies
    1. Hello Brad, I use SAP 9.1 PL5. If you have the installation setup files start the setup and continue with Client side installation. Make sure to check B1Studio. It will install the SAP B1 Studio + the addon to your visual studio (I use vs 2013).
      You can locate the installation files under Packages\B1Studio or Packages.x64\B1Studio. I have also tried to install just the extension for the VS 2013 from the installation folder but the installation failed. I ran the setup inside B1Studio and install only the visual studio extension.

      Delete
  2. Go figure. I installed VS 2010 and reinstalled SAP Business One Studio. It appears that the installer required VS 2010 and once that was present it installed Studio for VS 2010 and VS 2013.

    ReplyDelete
    Replies
    1. Yes, You must have visual studio installed before installing the SAP business one studio.

      Delete
  3. Do you know if it will work with Visual Studio 2015?

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. I haven't tried to install it on VS 2015, but I've noticed below in the extension.vsixmanifest file which is located inside the Business One Studio folder (where the VS extension package is)

      <SupportedProducts>
      <VisualStudio Version="10.0"> <Edition>Ultimate</Edition> <Edition>Premium</Edition> <Edition>Pro</Edition> </VisualStudio>
      <VisualStudio Version="11.0"> <Edition>Ultimate</Edition> <Edition>Premium</Edition> <Edition>Pro</Edition> </VisualStudio>
      <VisualStudio Version="12.0"> <Edition>Ultimate</Edition> <Edition>Premium</Edition> <Edition>Pro</Edition> </VisualStudio> </SupportedProducts>

      So, logically it's not supported.

      Visual Studio 2010 = version 10
      Visual Studio 2012 = version 11
      Visual Studio 2013 = version 12
      Visual Studio 2015 = version 14

      I haven't tried out adding the VS 2015 entry and try to install. I couldn't find any update for the extension in SCN as well.

      Delete
  4. Any have one link for download SAP Business One studio ?

    ReplyDelete
  5. Hi,

    I wonder if I am able to install SAP Business One Studio for Microsoft Visual Studio when I install VS 2013 Express?

    ReplyDelete
  6. Thank you for sharing the information here. Its much informative and really i got some valid information. You have posted the amazing article on SAP Business One Add-On Project

    ReplyDelete
  7. Hi,

    Could you please help me out? I am trying to install SAP Business One for Visual Studio 9using Packages/B1Studio), but the only feature that I am able to select is SAP Business One Studio. There is no SAP Business One for Visual Studio feature...

    Have you any idea what might be going on? I have tried a lot but resulted to nothing at this moment.

    Thank you.

    ReplyDelete
  8. Hi,
    What is the difference between Business One Studio and Business One Studio for Visual Studio? Can I use B1 Studio without not installed Visual Studio to my computer?

    ReplyDelete
    Replies
    1. Hi Merve, Yes you can use B1 studio without having VS. Check this : https://www.youtube.com/watch?v=1PEcVa1e-9s

      Delete