on 07-25-2008 9:15 PM
Hola a todos,
Quiero llamar un UDO desde mi Form principal. ¿Alguién sabe como realizar esto ?
Saludos
Giuseppe
Edited by: Rui Pereira on Aug 8, 2008 10:55 AM
Hola Giuseppe,
El UDO necesita un form propio para poder ser instanciado. Para ello hacen falta dos cosas:
- Que el UDO no tenga registrado el servicio de "Formulario estándar" (durante el asistente de registro de objetos)
- Tener definido un formulario en XML para el mismo. Puedes crearlo desde cero con el AddOn Screen Painter, pero te recomiendo que utilices el programa "UDO Form Generator" que está disponible en el paquete de herramientas para desarrollo "B1DE"
Una vez definido el punto anterior, para poder cargar ese XML en SAP Business One, necesitaremos hacer dos cosas:
1) Habilitar un menú propio
Fragmento de código C#
SAPbouiCOM.MenuItem menuItem = application.Menus.Item("4864"); // Menú Herramientas
Menus menus = menuItem.SubMenus;
MenuCreationParams menuParams = application.CreateObject(BoCreatableObjectType.cot_MenuCreationParams) as MenuCreationParams;
if (!menus.Exists("MiUDO"))
{
menuParams.Type = BoMenuType.mt_STRING;
menuParams.UniqueID = "MiUDO";
menuParams.String = "Abrir UDO";
menuParams.Enabled = enabled;
menus.AddEx(menuParams);
}
2) Controlar la activación del menú (es un evento del tipo MenuEvent)
Fragmento de código C# orientativo
if ((pVal.MenuUID == "MIUDO") && (!pVal.BeforeAction))
{
DOMDocument xmlDoc = new DOMDocument();
xmlDoc.load("C:
utadeForm.xml");
FormCreationParams paramsForm = application.CreateObject(BoCreatableObjectType.cot_FormCreationParams) as FormCreationParams;
paramsForm.XmlData = xmlDoc.xml;
paramsForm.UniqueID = "MIFORM"; // Cambiar este valor para varios formularios
application.Forms.AddEx(paramsForm);
// Controlar si ya estaba creado. Si no la línea anterior dará una excepción
Espero que te sirva de ayuda.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Buenas a Todos,
Saludos y gracias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola Guisepe,
La unica forma que he utilizado para agregar forms al menu principal es via programacion.
Yo intente hacerlo incluso al menu de usuario o mediante una tecla de acceso rapido y tampoco lo pude hacer.
Atte. Rosa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
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.