cancel
Showing results for 
Search instead for 
Did you mean: 

Form not getting displayed in sap b one

Former Member
0 Kudos

I have created a form using screen painter.But it is not getting displayed in sap b one.When I debugged the form it doesnot show any error.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

u can also overcome by this-

private void LoadFromXML( ref string FileName ) {

System.Xml.XmlDocument oXmlDoc = null;

oXmlDoc = new System.Xml.XmlDocument();

// load the content of the XML File

string sPath = null;

sPath = System.IO.Directory.GetParent( Application.StartupPath ).ToString();

sPath = System.IO.Directory.GetParent( sPath ).ToString();

oXmlDoc.Load( sPath + "
" + FileName );

// load the form to the SBO application in one batch

string sXML = oXmlDoc.InnerXml.ToString();

SBO_Application.LoadBatchActions(ref sXML);

}

and pass the name of xml file by reference like-

string transTemp0 = "MySimpleForm.xml";

LoadFromXML( ref transTemp0 );

// Get the added form object by using the form's UID

oForm = SBO_Application.Forms.Item( "MySimpleForm" );

// Show the loaded Form

oForm.Visible = true;

this is the only thing to do man...

i m sure it will work...

regards

yogesh gupta

Former Member
0 Kudos

Dear Yogesh,

I have done all the above coding.

Former Member
0 Kudos

hi dilip,

set the break point in your program and and start the execution step by step. u will find out the error..

if not, can you send me your code. i will tell u the problem ...

regards

yogesh

Former Member
0 Kudos

Option Strict Off

Option Explicit On

Friend Class frmEmployee

Private WithEvents SBO_Application As SAPbouiCOM.Application

Private objForm As SAPbouiCOM.Form

Public Sub New()

MyBase.New()

'//*************************************************************

'// set SBO_Application with an initialized application object

'//*************************************************************

SetApplication()

LoadFromXML("frmEmployee.xml")

'LoadFromXML("MySimpleFormxml")

'// Get the added form object by using the form's UID

objForm = SBO_Application.Forms.Item("F_4")

'// Show the loaded Form

objForm.Visible = True

'//*********************************************

'// Saving the Form as an XML file

'// although it already exist as an XML file

'// it is good for practice

'//*********************************************

'SaveAsXML(objForm)

End Sub

Private Sub SetApplication()

'*******************************************************************

'// Use an SboGuiApi object to establish connection

'// with the SAP Business One application and return an

'// initialized appliction object

'*******************************************************************

Dim SboGuiApi As SAPbouiCOM.SboGuiApi

Dim sConnectionString As String

SboGuiApi = New SAPbouiCOM.SboGuiApi

'// by following the steps specified above, the following

'// statment should be suficient for either development or run mode

sConnectionString = Environment.GetCommandLineArgs.GetValue(1)

'// connect to a running SBO Application

SboGuiApi.Connect(sConnectionString)

'// get an initialized application object

SBO_Application = SboGuiApi.GetApplication()

End Sub

Private Sub LoadFromXML(ByRef FileName As String)

Dim oXmlDoc As Xml.XmlDocument

oXmlDoc = New Xml.XmlDocument

'// load the content of the XML File

Dim sPath As String

'sPath = IO.Directory.GetParent(Application.StartupPath).ToString

sPath = "D:\Final\Forms"

oXmlDoc.Load(sPath & "\" & FileName)

'// load the form to the SBO application in one batch

SBO_Application.LoadBatchActions(oXmlDoc.InnerXml)

End Sub

Private Sub SaveAsXML(ByRef Form As SAPbouiCOM.Form)

Dim oXmlDoc As Xml.XmlDocument

Dim sXmlString As String

oXmlDoc = New Xml.XmlDocument

'// get the form as an XML string

sXmlString = Form.GetAsXML

'// load the form's XML string to the

'// XML document object

oXmlDoc.LoadXml(sXmlString)

Dim sPath As String

'sPath = IO.Directory.GetParent(Application.StartupPath).ToString

sPath = "D:\Final\Forms"

'// save the XML Document

oXmlDoc.Save((sPath & "\frmEmployee1.xml"))

End Sub

End Class

Former Member
0 Kudos

hi dilip,

i read your code...

'//*************************************************************

'// set SBO_Application with an initialized application object

'//*************************************************************

SetApplication()

LoadFromXML("frmEmployee.xml")

'LoadFromXML("MySimpleFormxml")

instead of calling LoadFromXML("frmEmployee.xml") by this,

do it like

dim file as string

file="frmEmployee.xml"

now pass this variable to LoadFromXML function by reference..

then it will work...

regards

yogesh

Former Member
0 Kudos

<?xml version="1.0" encoding="iso-8859-1"?>

<Application><forms><action type="add"><form appformnumber="-1" FormType="-1" type="0" BorderStyle="0" uid="SBOFormEditor_116" title="New Form 16" visible="1" default_button="" pane="0" color="0" left="370" top="88" width="508" height="337" client_width="500" client_height="310" AutoManaged="0" SupportedModes="15" ObjectType=""><datasources><dbdatasources><action type="add"/></dbdatasources><userdatasources><action type="add"/></userdatasources></datasources><Menus/><items><action type="add"/></items><ChooseFromListCollection><action type="add"><ChooseFromList UniqueID="-1" ObjectType="-1" MultiSelection="0" IsSystem="1"/></action></ChooseFromListCollection><DataBrowser/><Settings Enabled="0"/></form></action></forms></Application>

Still not working.Hope this xml will track the problem.

Former Member
0 Kudos

hi dilip,

can u send the xml as well as code file to my mail id.i will see by run it.

as it is dificult to track the problem by reading code.my mail id is yogesh2058@gmail.com

regards

yogesh

Former Member
0 Kudos

hi dilip,

finally i have solved the problem..

make a small change in xml

open the xml file in note pad, and in first line

<?xml version="1.0" encoding="iso-8859-1"?>

replace with

<?xml version="1.0" encoding="UFT-16"?>

and save it.

regards

yogesh

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi dilip..

Please Check the Property Of Ur SRF.. Please set the Proprty Embedded Resource for Ur SRF.. and set the path very carefully...

save the path in a variable and then Gives it into Load from XMl() method...

Check the property of Your SRF

if it is helpful...

Please give rewards points...

Former Member
0 Kudos

I can not find the specified properties.The propeorties shown to me are height,width etc

Former Member
0 Kudos

this property u will find in .net framework...

select Your SRF in Solution explorer then Right Click-->Property Window..

then u find SRF Property-->Build Action --> Embedded Resource

Former Member
0 Kudos

I have solved the problem.The problem was with xml.The xml file does not gets created in first intance.I create new xml files by saving xml files from sample example.

Thanks for u r support.

Former Member
0 Kudos

hi dilip,

do one thing, after oading a form, set the visible form property to true...

if satisfied, rewards points

regards

yogesh

Former Member
0 Kudos

Dear Yogesh,

I have set the visible form property to true.Still it is not getting displayed.The UID of the form is getting changed.First it takes value from xml but later the object SBO_Application has to be debugged to get uid.The debugged value remains constant but the form is not visible.