cancel
Showing results for 
Search instead for 
Did you mean: 

b1 UDO problem

0 Kudos

step by step :

  1. create a UDO in b1 client.

  2. open this UDO in vs

  3. add a 'search' button with simple logic.

  4. save UDO to database.

  5. open the UDO in b1 client.
  6. click the 'search' button, has nothing happened.

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()
        {
 
        }
 
 
    }
}

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

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.

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

0 Kudos

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."

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

0 Kudos

I openned the UDO in the B1 studio, and the B1 studio just can modified the UI of UDO, right?

the SaveToDatabase context item just can saved xml content to database, right?

if I have add some c# codes for UDO, then click SaveToDatabase context item, why the c# codes didn't work?

How to do?

0 Kudos

the UDO isn't the Add-on, right?

the UDO must running rely on Foobar.exe, right? so, if you want to the UDO is effective, you must execute Foobar.exe manually?

0 Kudos

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.