cancel
Showing results for 
Search instead for 
Did you mean: 

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

jaccomoolenaar
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Yo load the form in a XML structure, for this reason you can change the value of FormUID attribute before you use the loadBatchAction method.

In other way you can use the method addEx of Forms collection and asing the values directly.

Best regards.

Former Member
0 Kudos

hi

to change the Form.UID, you can use this code:

Dim oXMLDoc1 As MSXML2.DOMDocument

oXMLDoc1 = New MSXML2.DOMDocument

oXMLDoc1.load("c:\FormFile2Open.xml")

'

' Set form.UID

'

Dim s_Path As String

s_Path = "Application/forms/action/form/@uid"

oXMLDoc1.selectSingleNode(s_Path).nodeValue = "<NewKey>"

Dim oForm As SAPbouiCOM.Form

Dim creationPackage As SAPbouiCOM.FormCreationParams

creationPackage = SboApp.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)

creationPackage.XmlData = oXMLDoc1.xml

m_sboFrm = SboApp.Forms.AddEx(creationPackage)

Hope this helps

Kind regards,

Andrea Moschetto

Answers (1)

Answers (1)

Former Member
0 Kudos

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

jaccomoolenaar
Participant
0 Kudos

Thanks for the answers!