on 07-12-2012 5:59 AM
Hello All,
I have a problem when trying to load a form from an .SRF file. SAP shows us that the error message is "Form - Invalid Form". When loading the SRF, SAP shows no error that's why I assume the SRF has the right format (line 11 code below). But when I try to find the form and assigned the form unto a "oForm" variable, the program throws an exception that shows an exception as I mention before (line 12). The formUID is "STEM_PBTH" is exacly the same as defined in the SRF file. You can find the SRF in the attachment.
Public Sub Show()
Dim formXML As String
Dim formName As String
formName = "STEM_PBTH"
Try
Me.oForm = SBO_Application.Forms.Item(formName)
Catch ex As Exception
Try
SwissAddonFramework.Messaging.Debug.WriteMessage(ex.Message, SwissAddonFramework.Messaging.Debug.DebugLevel.Always)
formXML = LoadFromXML("ProjectBudgetingTemplate.srf")
SBO_Application.LoadBatchActions(formXML)
oForm = SBO_Application.Forms.Item(formName)
InitComponent(Me.oForm)
Catch e As Exception
Debug.Print(e.ToString)
Debug.Print(e.Message)
End Try
End Try
End Sub
Here is the error code:
System.Runtime.InteropServices.COMException (0xFFFFF43C): Form - Invalid Form
at SAPbouiCOM.FormsClass.Item(Object Index)
at ProjectBudgeting.ProjectBudgetingTemplate.Show() in D:\PROJECTS\SSP\ProjectBudgeting\Project\ProjectBudgetingTemplate.vb:line 51
And the XML code is in the attachment.
Can anyone suggest any solution for this problem? Thank you.
Alfa
Hi Alfa,
dim Path As String = "complete path of your SRF"
formXML = LoadFromXML(Path & "\ProjectBudgetingTemplate.srf")
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
LoadFromXML in the code actually is a method to set the filepath. the code is as follow:
Public Function LoadFromXML(ByRef FileName As String) As String
Dim oXmlDoc As Xml.XmlDocument
Dim sPath As String
oXmlDoc = New Xml.XmlDocument
'// load the content of the XML File
sPath = System.Windows.Forms.Application.StartupPath
sPath = sPath & "\Project\"
'sPath = sPath.Remove(sPath.Length - 3, 3)
oXmlDoc.Load(sPath & FileName)
'// load the form to the SBO application in one batch
Return (oXmlDoc.InnerXml)
End Function
So, there is no worry the filepath is wrong.
Hi Alfa,
After you load the batch, can you check the load batch result with :
SBO_Application.GetLastBatchResults
and also,
After your line :
oForm = SBO_Application.Forms.Item(formName)
Put :
{code}
oForm.Visible = True
{code}
Regards
Edy
Message was edited by: Edy Simon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
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.