Load form created by screen painter

hello every one,
i've a problem. What are the steps to be followed to load a form created by screen painter?  might i have any  sample code In order to understand the various phases? thank a lot

hi
lorenzo pelati
  first u   create  a  form in   screen painter , nd after save this form , when  u save this form than this fom  extation is  .srf file,   after that  convert this file  to  .xml
  file ,  and after call  this form to   our application ,
follow this code.........................................
in this code  newpa.xml     is a one form xml file.
in this code   SBOFormEditor_13  is a screen painter  form id,
  private void LoadFromXML( ref string FileName ) {
        System.Xml.XmlDocument oXmlDoc = null;
        oXmlDoc = new System.Xml.XmlDocument();
        // load the content of the XML File
        string sPath = null;
        sPath = System.IO.Directory.GetParent( Application.StartupPath ).ToString();     
          sPath = System.IO.Directory.GetParent( sPath ).ToString();
          oXmlDoc.Load( sPath + "
" + FileName );
        // load the form to the SBO application in one batch
          string sXML = oXmlDoc.InnerXml.ToString();
        SBO_Application.LoadBatchActions(ref sXML);
    private void SaveAsXML( ref SAPbouiCOM.Form Form ) {
        System.Xml.XmlDocument oXmlDoc = null;
        string sXmlString = null;
        oXmlDoc = new System.Xml.XmlDocument();
        // get the form as an XML string
        sXmlString = Form.GetAsXML();
        // load the form's XML string to the
        // XML document object
        oXmlDoc.LoadXml( sXmlString );
        string sPath = null;
        sPath = System.IO.Directory.GetParent( Application.StartupPath ).ToString();
        SBO_Application.MessageBox("sahe ha " + sPath, 1, "OK", "", "");
        // save the XML Document
        oXmlDoc.Save( ( sPath + @"\newpa.xml" ) );
  public   call form() {
        SetApplication();
        string transTemp0 = "newpa.xml";
        LoadFromXML( ref transTemp0 );
                oForm = SBO_Application.Forms.Item("SBOFormEditor_13");
        // Show the loaded Form
        oForm.Visible = true;
        SaveAsXML( ref oForm );
   fallow this code .

Similar Messages

  • Add functionalities to form created in screen Painter

    Hello.
    Where I can find information or an example of as
    I can add functionalities to form created in screen Painter?
    Regards,
    Jose

    Hi David,
    I want add and modify a field of it_EDIT from my form.
    I find on the web this: BoFormItemTypes.it_EDIT.
    But same error.
    I am using this code:
        Private Sub CodeForm()
            Dim oitem As SAPbouiCOM.Item
            Dim oLabel As SAPbouiCOM.BoFormItemTypes
            oForm = SBO_Application.Forms.GetFormByTypeAndCount(60004 '// <<----
    this is my form, 0)
            oitem = oForm.Items.Item("10")
            oLabel = oitem.Specific
            oLabel = "Escribir nombre"
        End Sub
    But don't  function.
    Regards,
    Jose

  • Is it possible to open a form created with screen painter more than once?

    I have created a form with the screen painter. In the screen painter the form is assigned a FormUID. Probably because this is done, it is impossible to open the form more than once??
    Thanks,
    Kind regards

    Hi J.
    The answer is yes You just have to give your form a unique id.
    1) Give your form in screen painter a name like BTWO_DYNAMIC_UID (just plain text).
    2) Make sure your <i>FormType</i> and <i>appformnumber</i> have a unique number (i.e. 2000060001). You can do this in the xml source.
    3) By loading your document replace the BTWO_DYNAMIC_UID with an unique id. I have a counter that's a member of my class and increase that number to get a unique id (BTWO_F_1, BTWO_F_2 etc)
    I have added a code sample, SBOApplication is my SAP application object and mFormNumber is a member (integer) of my class.
    <i>Succes d'r mee, en als 't nie lukt hoor ik het wel... ;)</i>
    <b>Code (C#):</b>
    // New xml document
    XmlDocument oXmlDoc = new XmlDocument();
    private Form LoadUniqueForm(string AMyFile)
      // Define your path to
      sPath = @"Forms" + AMyFile;
      // Load the form
      oXmlDoc.Load(sPath);
      // Replace the string with an unique id
      mFormNumber++;
      string sXML = oXmlDoc.InnerXml.Replace("BTWO_DYNAMIC_UID", "BTWO_F_" + mFormNumber.ToString());
      // load the XML file in SAP
      SBOApplication.LoadBatchActions(ref sXML);
      // Return the form
      return SBOApplication.Forms.Item("BTWO_F_" + mFormNumber.ToString());

  • How to increase formUID to a form created with screen painter

    Hi,
    I've got a problem with my form. I created a form with screen painter but i can't succeed to increase my UID form.
    For example, when i open my first form, the UID is always at FP_0.
    My script:
    private string FormUID = null;
      public FP_Form(int NumInstance_)
                this.NumInstance = NumInstance_;
    this.FormUID = "FP" + NumInstance.ToString();
                load();
              oDBDataSource = oForm.DataSources.DBDataSources.Add(DBDataSourceTable);
              SBO_Application.ItemEvent += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
    private void SBO_Application_ItemEvent(string _FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
                BubbleEvent = true;
                try
    if (_FormUID == this.FormUID) //here "_FormUID" is increased but "this.FormUID" is still = FP_0
                        switch (pVal.EventType)// selon le type d'action executée
                            case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:
                                if (pVal.BeforeAction == true)
                                    SAPbouiCOM.ComboBox List_reseau = (SAPbouiCOM.ComboBox)oForm.Items.Item("5").Specific;
                                    List_reseau.ValidValues.Add("1", "test");
                               break;
                           case ...
                              break;
    Please help.
    Regards,
    Zakia.

    Hi J.
    The answer is yes You just have to give your form a unique id.
    1) Give your form in screen painter a name like BTWO_DYNAMIC_UID (just plain text).
    2) Make sure your <i>FormType</i> and <i>appformnumber</i> have a unique number (i.e. 2000060001). You can do this in the xml source.
    3) By loading your document replace the BTWO_DYNAMIC_UID with an unique id. I have a counter that's a member of my class and increase that number to get a unique id (BTWO_F_1, BTWO_F_2 etc)
    I have added a code sample, SBOApplication is my SAP application object and mFormNumber is a member (integer) of my class.
    <i>Succes d'r mee, en als 't nie lukt hoor ik het wel... ;)</i>
    <b>Code (C#):</b>
    // New xml document
    XmlDocument oXmlDoc = new XmlDocument();
    private Form LoadUniqueForm(string AMyFile)
      // Define your path to
      sPath = @"Forms" + AMyFile;
      // Load the form
      oXmlDoc.Load(sPath);
      // Replace the string with an unique id
      mFormNumber++;
      string sXML = oXmlDoc.InnerXml.Replace("BTWO_DYNAMIC_UID", "BTWO_F_" + mFormNumber.ToString());
      // load the XML file in SAP
      SBOApplication.LoadBatchActions(ref sXML);
      // Return the form
      return SBOApplication.Forms.Item("BTWO_F_" + mFormNumber.ToString());

  • Coding in form created in screen painter

    I have created a form in screen painter.How can I do coding in this form.I have added a save button in the form.How can I fire the click event on this button.The file created has extension srf and it can not be opened in asp.net.

    Hi Dilip,
    Although the file has a srf file extension it is actually an XML file. You can use this file to create an instance of your form through code. In the UI API there is a Application object. This object has a method called LoadBatchActions which takes one parameter which is your srf file (ie the path and filename). Calling this method will create a form in the active UI based on your srf file. You can then create an instance of the Form object in the UI API and use this to manipulate your form through code.
    I also recommend you look at the SDK learning material here on the SDN and also look at the samples that come with the SDK.
    Kind Regards,
    Owen
    P.S. Please note that you've posted your question in the application forum for SAP Business One. This forum is for discussions on the application functionality of SBO and not the SDK. Instead, please post queries about screen painter and other development questions here:
    SAP Business One SDK
    Thanks

  • Loaded Forms on the screen and the underline link between the forms-Callee

    Hi Dear Experts,
    I am wondering wehter you would be able to shed some lights on the follwoing and on how SAP handles below situations:
    In SAP when loading up two documnts and try to add items to each using 'List of Items' screen, the systme is clever enough to return back the item code to the relevant screen.
    I need to know that how SAP is holding this trail of formids when returning the select item code to fill in the document lines on the origianl caller doc.
    Is it some kind of  internal array structures or it could be a table in the database which contains the list of loaded forms on the screen and the revelant callee and caller ids.
    Many thanks in advance.
    Maryam Gharib.

    Hi Maryam Gharib,
    You may check this first: how to work with multiple forms
    Thanks,
    Gordon

  • Problem with Folder created in Screen painter

    Hello,All
    I created six folder for UD screen with screen painter and i set pane level properties correctly. While running with screen painter we can see each and every item with respect to folder
    But the problem is while loading this user defined form in SAP B1 items related with folder is not coming. (Not at all coming any item under any folder) if will run same screen in screen painter items correctly.
    is der any coding is required for foder creation and manage
    By
    Firos.C

    Hi Firoz,
    You need to set a PaneLevel for each and every pane and that pane level is what you need to set as the From Pane and To Pane for the individual items within that corresponding pane.
    Say, you have a pane with PaneLevel = 3, then, for all the items within that pane, you need to have the from and to pane as 3.
    Hope this helps,
    Best Regards,
    Satish. B.

  • Cannot load XML file in Screen Painter in SAPB1

    Hi All,
    i am creating an xml file of existing purchase order through the following code
    Public Sub getxml(ByVal FormUID As String)
            Dim f As SAPbouiCOM.Form
            f = sbo_application.Forms.Item(FormUID)
            Dim oXmlDoc As Xml.XmlDocument
            Dim sXmlString As String
            oXmlDoc = New Xml.XmlDocument
            '// get the form as an XML string
            sXmlString = f.GetAsXML
            oXmlDoc.LoadXml(sXmlString)
            Dim sPath As String
            sPath = IO.Directory.GetParent(Application.StartupPath).ToString
            oXmlDoc.Save((sPath & "\ChangedXml.xml"))
        End Sub
    i am calling this function getxml in pageload of this form as
    Private Sub B1_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles sbo_application.ItemEvent
            If pVal.FormType = "142" And pVal.BeforeAction = False Then
                Dim oItem As SAPbouiCOM.Item
                Dim oFolder As SAPbouiCOM.Folder
                Dim oform As SAPbouiCOM.Form
                Dim oStaticText As SAPbouiCOM.Button
                Dim oEditText As SAPbouiCOM.EditText
                Select Case pVal.EventType
                    Case SAPbouiCOM.BoEventTypes.et_FORM_LOAD
                        getxml(FormUID)
                End Select
            End If
    End Sub
    it will create the xml file ChangedXml.xml in the destination folder, then i will copy that one and paste it and change the extension to .srf.
    then i will open screen painter and try to acceess this one it will open the form but it will give an error as Error: Menu - Image Type Not Supported
    it will open the screen but it won't open the matrix, the space which consists of matrix in the original form will come as blank.
    Please any one help me, it's urjent.
    Thanks,
    Vaithy
    09886807576

    Hi Vaithy,
    Not all the items you have in B1 forms are supported by the UI API and/or the ScreenPainter.
    If you need to reproduce a B1 system form you will have to remove all items giving you an error in the ScreenPainter and then have a reduced form.
    Why do you need the xml of the Purchase Order form? Please take care if you are trying to reproduce the behavior of the Purchase Order form, there can be some Formatted Searches or other customizations in the B1 form if you are using other addons.
    Hope it helps
    Trinidad.

  • System form loadable in Screen Painter ?

    Hello,
    is it possible, in some way to load one of the system form in screen painter?
    How?
    Thank you

    I would like to know which are the values possible to insert to be sure that are not used by other system forms.
    Must appformnumber and FormType have same value?
    In Screen Painter there is only FormType and not appformnumber attribute and when I save they assume same value.
    Which relation is there between this FormType and number of form that I see inside Sap Business One System Information when I run it?
    Thank you very much

  • How to read the contents of Input Field created via Screen Painter?

    Hi All,
    I have a module program / dialog program, on my second screen, I created an input/outbox field via screen painter of course,
    now in my PAI, how can I read the contents of the input/outbox field?
    Let's say the name of my input/outbox field is: P_WEKRS.  Note: Get Parameter and Set Parameter is ticked.
    PROCESS AFTER INPUT.
      LOOP WITH CONTROL TC_DATA.
        MODULE MODIFY_DATA.
      ENDLOOP.
    I want to get the value of the input/outbox field before my loop in table control?  I thought that it will work like normal parameter in non-dialog programs.
    Any helpful inputs will be appreciated/rewarded.
    Thanks.
    Jaime

    Hi, Jaime
    Do the following Change in you Follow Logic
    PROCESS AFTER INPUT.
    MODULE read_or_change_value. " Add this
    LOOP WITH CONTROL TC_DATA.
      MODULE MODIFY_DATA.
    ENDLOOP.
    Add the Bellow Module code in you Driver Program.
    MODULE read_or_change_value.
    DATA: P_WEKRS like " the Field on Screen. Must be the same name as on SCREEN. and Type must be same too.
    " Here you will find the Value in that Variable or if you will change the Value here you will find it change on Screen
    END MODULE.
    Please Reply if any Issue..
    Best Regards,
    Faisal

  • How to insert a new line in table control created in screen painter

    hai,
    i am stuck up in the place where i need to insert a row of data in the table in screen developed in screen painter..cud some one help me out...

    You can try the following statement:
    MODIFY <DBtable> from table <itab>.
    Of course, you would need to append the user-entered data (from the screen) into the internal table first.
    Hope this helps.
    Sudha

  • UI: Event Handling of forms created with the Screen Painter

    Hi,
    I created a form with the Screen Painter and saved it as XML document. After that, I loaded this form with the following code:
    <i>Dim oXMLdoc As MSXML2.DOMDocument
    oXMLdoc = New MSXML2.DOMDocument
    oXMLdoc.load("C:\form1.xml")
    SBO_Application.LoadBatchActions(oXMLdoc.xml)</i>
    Then the loaded form appears in the SBO application with all added items.
    Now, I would like to know how I could handle an ITEM_PRESSED event for a button of this imported form.
    It would be great if someone could help me with this problem and post some example code.
    Regards,
    Dennis

    Dennis,
    you have to create a function that will handle all the event receive from B1
    <i>    Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
            If (pVal.FormUid = "YourUIDForm") Then
                If ((pVal.itemUID = "YourItemUID") And _
                    (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) And _
                    (pVal.Before_Action = False)) Then
                    ' Here write the coe you need....
                End If
            End If
        End Sub</i>
    Off course, you need your variable SBO_Appliation declared as follow :
    Private WithEvents SBO_Application As SAPbouiCOM.Application

  • Load Form Screen Printer in C#

    Hi all,
    How load a form created in screen printer in language c# ?
    Exemple:
    I use this function to load a form in SAP business one with language VB:
    Private Sub LoadForm()
            Dim oxmldoc As New Xml.XmlDocument
            oxmldoc.Load("Form Name.srf")
            SBO_Application.LoadBatchActions(oxmldoc.InnerXml)
            oForm = SBO_Application.Forms.Item("FormID")
            oForm.Visible = True
        End Sub
    But, in C# this code not is valid.
    Im need a code valid in C#.
    Somebody could help?

    Welcome Fabio
    i use this c# procedure to load a XML:
        private static void LoadFromXML(string FileName)
            System.Xml.XmlDocument oXmlDoc = null;
            try
                oXmlDoc = new System.Xml.XmlDocument();
                // load the content of the XML File
                string sPath = null;
                sPath = System.IO.Directory.GetParent(Application.ExecutablePath).ToString();
                oXmlDoc.Load(sPath + "\\" + FileName);
                // load the form to the SBO application in one batch
                string sXML = oXmlDoc.InnerXml.ToString();
                globals.SBO_Application.LoadBatchActions(ref sXML);
            catch (Exception er)
            finally
                oXmlDoc = null;
                GC.Collect();
    lg David

  • Adding images in background in forms in screen painter

    Hi,
    My thought is it not possible to add images in the background of the forms in the screen painter and also have add colours and other attributes to the texts in the screen painter. pls share your idea and it is very important. pls convey me....

    Hello,
    Please go through this thread:
    about displaying background image.
    Vasanth

  • Publishing a screen painter form with full code

    Hi Dear;
    could you publish a sample of screen painter form with the coding that you use in it please?
    bets regards;

    Hi,
    Take a look at the following sample provided by SAP in the following path C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\04.WorkingWithXML\2003.
    In the above sample a form designed in Screen painter (MySimpleForm.xml) is used with the code. U can open the MySimpleForm.xml in screen painter.
    Vasu Natari.

Maybe you are looking for