cancel
Showing results for 
Search instead for 
Did you mean: 

Error on LoadBatchActions for XML file

Former Member
0 Kudos

I am trying to load a screen painter form which I have saved as an xml file. My code worked last week. I haven't changed anything. I don't know why it gives me an error now, maybe someone can help me?

Here is my code:

private void LoadFromXML(string FileName )

{

try

{

XmlDocument oXmlDoc = new System.Xml.XmlDocument(); string sPath;

sPath = "D:
SAP
Direct
DirectControls";

string sFile = sPath + "
" + FileName;

oXmlDoc.Load( sFile );

string sXML = oXmlDoc.InnerXml;

SBO_Application.LoadBatchActions( ref sXML );

}

catch ( Exception ex )

{

string s = ex.Message;

}

}

It blows up on SBO_Application.LoadBatchActions( ref sXML ); and gives me an error of Object Does Not Exist. I know it finds the xml file as I can see that it does. Anyone have any suggestions?

Thanks!

Laura

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Laura,

It is ok to create the form with LoadBatchAction, and I think you problem could possibly be the databind or something related to your database.

One suggestion is to use another simple srf file created, then load it with your code. If no error is raised, it should be the problem of your srf. Please check all the databinding of your srf file.

HTH,

Nick

barend_morkel2
Active Contributor
0 Kudos

Hi Laura,

If you are using SBO 2004 you should not be using this method of loading the srf form (Loadbatch actions is for SBO 6.5). Here is code in VB .Net the load it - you can convert it (I don't have it in c#).

Private Sub btnXMLForm67_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnXMLForm67.Click

Dim oXMLDoc As New System.Xml.XmlDocument

Dim xmlData As String = "C:\Training2004\Code\SBOTest\VideoStore\XMLForms\AddMovie.srf"

Dim oForm As SAPbouiCOM.Form

Dim creationPackage As SAPbouiCOM.FormCreationParams

'Create the FormCreationParams object

creationPackage = oAppObj.SBO_App.CreateObject( _

SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)

'Specify the parameters in the object

creationPackage.UniqueID = "SOS_MyFormID"

creationPackage.FormType = "60004"

creationPackage.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed

oXMLDoc.load(xmlData)

'Just a sample for a XML string describing a form… same as used for LoadBatchActions

creationPackage.XmlData = oXMLDoc.InnerXml

'Add the form to the SBO application

Try

oForm = oAppObj.SBO_App.Forms.AddEx(creationPackage)

Catch ex As Exception

Exit Sub

End Try

'Set the form title and visibility

oForm.Title = oForm.Title & "-2004"

oForm.Visible = True

End Sub

Former Member
0 Kudos

Thanks Barend,

I am using SBO2004. I converted the code to C# and it works great in my dev environment. When I move it to test I get the same error, so there must be something different in the database somewhere that I will have to go track down. At least things are working in dev now though!

Thanks for giving me the correct code to do this.

Laura