05-25-2017 8:39 AM - edited 02-03-2024 11:17 PM
step by step :
why? how do I continue to?
but if I execute the 'Foobar.exe' which is built from vs, then the result is correct.
all screenshots for your reference.
Program.cs
using System;
using System.Collections.Generic;
using SAPbouiCOM.Framework;
namespace Foobar
{
class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
new Application().Run();
}
}
}
FoobarUdo.b1f
<?xml version="1.0" encoding="UTF-16" standalone="yes"?>
<form Top="127" Left="370" Width="600" Height="357" AutoManaged="True" DefaultButton="" FormType="UDO_FT_Foobar" BorderStyle="0" Color="0" Pane="1" Mode="3" ObjectType="Foobar" Client_Height="" Client_Width="" Settings_GridItemUID="" Enabled="True" EnableRowFormat="True" BrowseBy="0_U_E" Title="Foobar" Visible="True" UniqueID="UDO_F_Foobar">
<datasources>
<dbdatasources>
<datasource TableName="@FOO" />
<datasource TableName="@BAR" />
</dbdatasources>
<userdatasources>
<datasource Type="9" Size="10" UniqueID="FolderDS" />
</userdatasources>
</datasources>
<item Top="52" Left="5" Width="570" Height="227" AffectsFormMode="True" Description="" DisplayDesc="False" Enabled="True" FromPane="0" ToPane="0" LinkTo="" RightJustified="False" Type="9000" Visible="True" UniqueID="U_RC" IsAutoGenerated="False">
<specific AutoPaneSelection="False" TableName="" />
<item Top="58" Left="6" Width="116" Height="14" AffectsFormMode="True" Description="" DisplayDesc="False" Enabled="True" FromPane="0" ToPane="0" LinkTo="" RightJustified="False" Type="99" Visible="True" UniqueID="0_U_FD" IsAutoGenerated="True">
<specific Pane="1" Caption="BAR" AutoPaneSelection="True">
<databind DataSource="FolderDS" Databound="True" TableName="" Alias="FolderDS" />
</specific>
</item>
</item>
<item Top="6" Left="6" Width="121" Height="14" AffectsFormMode="True" Description="DocEntry " DisplayDesc="False" Enabled="True" FromPane="0" ToPane="0" LinkTo="0_U_E" RightJustified="False" Type="8" Visible="True" UniqueID="0_U_S" IsAutoGenerated="True">
<specific Caption="DocEntry " />
</item>
<item BackColor="-1" FontSize="-1" ForeColor="-1" TabOrder="0" TextStyle="0" Top="6" Left="127" Width="148" Height="14" AffectsFormMode="True" Description="DocEntry " DisplayDesc="False" Enabled="False" FromPane="0" ToPane="0" LinkTo="" RightJustified="False" Type="16" Visible="True" UniqueID="0_U_E" IsAutoGenerated="True">
<specific ChooseFromListAlias="" ChooseFromListIsAutoFill="False" ChooseFromListUID="" IsPassword="False" SuppressZeros="False">
<databind DataSource="@FOO" Databound="True" TableName="@FOO" Alias="DocEntry" />
</specific>
</item>
<item Top="297" Left="6" Width="65" Height="19" AffectsFormMode="True" Description="" DisplayDesc="False" Enabled="True" FromPane="0" ToPane="0" LinkTo="" RightJustified="False" Type="4" Visible="True" UniqueID="1" IsAutoGenerated="True">
<specific Caption="Ok" />
</item>
<item Top="297" Left="76" Width="65" Height="19" AffectsFormMode="True" Description="" DisplayDesc="False" Enabled="True" FromPane="0" ToPane="0" LinkTo="" RightJustified="False" Type="4" Visible="True" UniqueID="2" IsAutoGenerated="True">
<specific Caption="Cancel" />
</item>
<item CellHeight="16" TabOrder="0" TitleHeight="21" Top="98" Left="15" Width="555" Height="163" AffectsFormMode="True" Description="" DisplayDesc="False" Enabled="True" FromPane="1" ToPane="1" LinkTo="" RightJustified="False" Type="127" Visible="True" UniqueID="0_U_G" IsAutoGenerated="True">
<specific MatrixLayout="0" SelectionMode="2" />
<Column BackColor="-1" ChooseFromListAlias="" ChooseFromListIsAutoFill="False" ChooseFromListUID="" FontSize="-1" ForeColor="-1" TextStyle="0" DisplayDesc="False" Visible="True" AffectsFormMode="True" ValOn="Y" IsAutoGenerated="True" ValOff="N" Description="#" Title="#" Width="20" Editable="False" Type="16" RightJustified="False" UniqueID="#" Sortable="False">
<databind DataSource="" Databound="False" TableName="" Alias="" />
</Column>
<Column BackColor="-1" ChooseFromListAlias="" ChooseFromListIsAutoFill="False" ChooseFromListUID="" FontSize="-1" ForeColor="-1" TextStyle="0" DisplayDesc="False" Visible="True" AffectsFormMode="True" ValOn="Y" IsAutoGenerated="True" ValOff="N" Description="U_Name" Title="U_Name" Width="556" Editable="True" Type="16" RightJustified="False" UniqueID="C_0_1" Sortable="False">
<databind DataSource="@BAR" Databound="True" TableName="@BAR" Alias="U_Name" />
</Column>
</item>
<item Top="297" Left="154" Width="65" Height="19" AffectsFormMode="True" Description="" DisplayDesc="False" Enabled="True" FromPane="0" ToPane="0" LinkTo="" RightJustified="False" Type="4" Visible="True" UniqueID="Search" IsAutoGenerated="False">
<specific Caption="Search" />
</item>
<FormCategory type="UDOForm" />
</form>
FoobarUdo.b1f.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SAPbouiCOM.Framework;
namespace Foobar
{
[FormAttribute("UDO_FT_Foobar")]
class FoobarUdo : UDOFormBase
{
public FoobarUdo()
{
}
/// <summary>
/// Initialize components. Called by framework after form created.
/// </summary>
public override void OnInitializeComponent()
{
ButtonSearch.Caption = "Test";
ButtonSearch.ClickBefore += ButtonSearch_ClickBefore;
this.OnCustomInitialize();
}
private void ButtonSearch_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
{
Application.SBO_Application.MessageBox("Hello World");
BubbleEvent = true;
}
public SAPbouiCOM.Button ButtonSearch => (SAPbouiCOM.Button)(GetItem("Search").Specific);
/// <summary>
/// Initialize form event. Called by framework before form creation.
/// </summary>
public override void OnInitializeFormEvents()
{
}
private void OnCustomInitialize()
{
}
}
}
You need to install your logic, save UDO form is not enough.
Use VS Toolbar -> SAP Business One Studio ->Extension Package to create install package.
Next install via Extension manager, assign addon to company and users.
Restart Client.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eric,
Obviously, Visual Studio program should be running.
From 'Save UDO to Database' option, you just saved the changes made on the form. Visual Studio should be running in order to execute the action written for the new button.
Hope you got it!
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.
tks for your answer. but the vs shouldn't running, you know the UDO must be run anywhere without vs env.
or how to run the 'Foobar.exe' automaticlly? i have try to registered it with add-on, the register is successful, but the installation progress is falied. the messbox display "install failed."
Hi Eric,
I am not able to get your concern here:
If you want that "Hello World" message should be displayed, then Visual Studio must be running. (It is for Debug Mode)
If you want that "Hello World" message should be displayed, the add-on must be running. (It is for Runtime)
The error "Install failed" is totally because of incorrect creation of the Add-on package.
Kind regards,
ANKIT CHAUHAN
SAP SME Support
As per my understanding you want to execute a exe from your UDO screen and for that purpose you have added button.
Suggestion for this requirement.
What you have show in your code and screen that is correct even we follow the same.
you have to create one package and include all the dll and exe with this package and assign that package to your database and run the package , it will work.
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.