Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Load From XML

Hello...

I am using the following function to load a form from xml, I found this function here in forum, not mine, BUUUUT when trying runing the function I got:

"ERROR: Form - Reserved / Illegal form Unique ID"

I tryed change form name a bunch of times, but keep getting error.

If someone could help me I would be glad.

 Private Function LoadXMLForm(ByVal sFile As String) As Boolean
        Try
            Dim oXMLDoc As MSXML2.DOMDocument
            Dim oCreationParams As SAPbouiCOM.FormCreationParams
            Dim s As String
            Try
                s = "c:/FormSample_simple.srf"
                oXMLDoc = New MSXML2.DOMDocument
                oXMLDoc.load(s)
                oCreationParams = oapplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
                oCreationParams.XmlData = oXMLDoc.xml
                oApplication.Forms.AddEx(oCreationParams)
                Return True
            Catch e As Exception
                oApplication.MessageBox("Error: " & e.Message)
                Return False
            End Try
            System.Runtime.InteropServices.Marshal.ReleaseComObject(oCreationParams)
            System.Runtime.InteropServices.Marshal.ReleaseComObject(oXMLDoc)
        Catch ex As Exception
            oApplication.MessageBox("Error: " & ex.Message)
        End Try
        GC.Collect()
    End Function

replied

Try to add this line

oCreationParams.UniqueID = "formUid"

after

oCreationParams.XmlData = oXMLDoc.xml

Problem must be that the xml you load have a invalid Unique (Is the xml-form a system form?)

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question