05-11-2017 2:07 PM - edited 02-03-2024 11:40 PM
Hi, everybody
I have successfully registered a test add-on in SAP B1.
To run the add-on, this is what I should do:
> Modules > Administration > Add-ons > Add-on Manager > Start
I wish to run the add-on by clicking a menu in SAP, instead of doing as above.
For example, suppose I create a sub-menu called MYMENU within the INVENTORY MENU. (I know how to create the sub-menu.)
Now, I wish to run my add-on by simply clicking on MYMENU
How can we do this? Can anyone briefly outline the steps to achieve this?
I want the facility to remain permanently in SAP, unless I deliberately remove it.
Thank you
Leon
Hi Leon,
Why don't you set the add-on startup to 'Mandatory' rather than doing so much customization?
Kind regards,
ANKIT CHAUHAN
SAP SME Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Ankit
Thanks for your reply.
I am not very familiar with using add-ons, as I am still developing my add-on.
.
> Why do I want so much customization?
Really don't know. I was just thinking that my future users won't have access to Administration module.
So, I think it would be better to have a sub-menu in Inventory (to which they do have access)
.
> Why don't you set the add-on startup to 'Mandatory'
I did a test with Mandatory. I am not sure what Mandatory does. It seems this runs the add-on automatically when SAP is opened.
.
It may help you to understand my problem if I give you a few additional facts:
The add-on we are developing is quite huge, and I don't think I will make it install automatically (more likely I will make it run manually) to save memory. At the same time, I would like to give a facility to our users to run the add-on by simply clicking on a sub-menu).
.
Clicking a menu is just something I am thinking of. But there may be more practical solutions.What would be the best advice you can give me?
I am thinking of something like SAP B1 Studio. I don't use Studio, and hard code everything in VB.NET.
But I find the idea interesting: you click on a sub-menu, and the add-on runs! .... How can we achieve this wonder?
.
Best Regards,
Leon
Hi, Leon
Thanks again.
I'll see how I can adapt your helpful suggestions to my problem.
Best Regards,
Leon
-----------------
Added:
I think I will adopt this simple solution - not too much customization as you said...
I install the add-on as manual (so as not to consume too much memory when it's not in use) rather than mandatory or automatic.
Then I give the users a shortcut (say F3) to Add-on Manager.
This is the simplest solution (but which I have not thought before). I found that the users can have access to Add-on Manager without having access to other Admin menus.
Best Regards,
Leon
On Visual Studio 2013, a new SBO project has by default a file called Menu.cs which does this for you. Here's a sample
using System;
using System.Collections.Generic;
using System.Text;
using SAPbouiCOM.Framework;
namespace ImportOrders
{
class Menu
{
public void AddMenuItems()
{
SAPbouiCOM.Menus oMenus = null;
SAPbouiCOM.MenuItem oMenuItem = null;
oMenus = Application.SBO_Application.Menus;
SAPbouiCOM.MenuCreationParams oCreationPackage = null;
oCreationPackage = ((SAPbouiCOM.MenuCreationParams)(Application.SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)));
oMenuItem = Application.SBO_Application.Menus.Item("43520"); // modules'
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP;
oCreationPackage.UniqueID = "ImportOrders";
oCreationPackage.String = "ImportOrders";
oCreationPackage.Enabled = true;
oCreationPackage.Position = -1;
oMenus = oMenuItem.SubMenus;
try
{
// If the manu already exists this code will fail
oMenus.AddEx(oCreationPackage);
}
catch (Exception e)
{
}
try
{
// Get the menu collection of the newly added pop-up item
oMenuItem = Application.SBO_Application.Menus.Item("ImportOrders");
oMenus = oMenuItem.SubMenus;
// Create s sub menu
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING;
oCreationPackage.UniqueID = "ImportOrders.Form1";
oCreationPackage.String = "Form1";
oMenus.AddEx(oCreationPackage);
}
catch (Exception er)
{ // Menu already exists
Application.SBO_Application.SetStatusBarMessage("Menu Already Exists", SAPbouiCOM.BoMessageTime.bmt_Short, true);
}
}
public void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
{
BubbleEvent = true;
try
{
if (pVal.BeforeAction && pVal.MenuUID == "ImportOrders.Form1")
{
Form1 activeForm = new Form1();
activeForm.Show();
}
}
catch (Exception ex)
{
Application.SBO_Application.MessageBox(ex.ToString(), 1, "Ok", "", "");
}
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.