cancel
Showing results for 
Search instead for 
Did you mean: 

Error: LoadBatchActions(formXML) is success but Form never exist

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Alfa,

     dim Path As String = "complete path of your SRF"

      formXML = LoadFromXML(Path & "\ProjectBudgetingTemplate.srf") 

Regards,

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Alfa,

     When I'm loading my XML, I use this code.

          Dim oXmlDoc As System.Xml.XmlDocument

        oXmlDoc = New System.Xml.XmlDocument

        Dim sPath As String = IO.Directory.GetParent(FileName).ToString

        oXmlDoc.Load(FileName)

        SBO_Application.LoadBatchActions(oXmlDoc.InnerXml)

Regards,

Former Member
0 Kudos

Thank You .... I've solved the problem. It's because the the add On conflicted with Coresuites Customize Add On. Thanks for your help .

Former Member
0 Kudos

No worries.

Answers (1)

Answers (1)

edy_simon
Active Contributor
0 Kudos

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