Skip to Content

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

RE:Form Already Exists Error

Hi All,

While accessing multiple forms Iam getting the error like Form Already exists.

This is my code :

Public Sub New(ByVal aFormFileName As String)

MyBase.New()

Dim FormName As String

SetApplication()

LoadForm(aFormFileName)

FormName = "Frm" & New IO.FileInfo(aFormFileName).Name.Split(".")(0)

oForm = SBO_Application.Forms.Item(FormName)

End Sub

Public Sub LoadForm(ByRef oFormName As String)

Dim sPath As String

Dim oXmlDoc As Xml.XmlDocument

Try

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

oXmlDoc = New Xml.XmlDocument

oXmlDoc.Load(sPath & "\Forms\" & oFormName)

SBO_Application.LoadBatchActions(oXmlDoc.InnerXml)

Catch ex As Exception

Throw ex

End Try

End Sub

I have writtenthe above code in a separate class. then i created another class which inherited the above class.Then I wrote the code as

Public Class ParameterCFL

Inherits GeneralLibrary

Public Sub New(ByVal aCurrentRow As Integer, ByVal aParMatrix As SAPbouiCOM.Matrix)

MyBase.New("ParameterCFL.srf")

SetApplication()

oCurrentForm = SBO_Application.Forms.Item("FrmParameterCFL")

oCurrentRow = aCurrentRow

oParMatrix = aParMatrix

AddUserDataSources()

ConfigureMatrix()

FetchData()

oMatrix.SelectRow(1, True, False)

End Sub

Private Sub SetApplication()

Dim SboGuiApi As SAPbouiCOM.SboGuiApi

Dim sConnectionString As String

SboGuiApi = New SAPbouiCOM.SboGuiApi

sConnectionString = "0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056"

SboGuiApi.Connect(sConnectionString)

SboGuiApi.AddonIdentifier = "5645523035446576656C6F706D656E743A453038373933323333343581F0D8D8C45495472FC628EF425AD5AC2AEDC411"

SBO_Application = SboGuiApi.GetApplication()

End Sub

How should i solve this problem.

Thanx in advance

Mohana

Former Member
Former Member replied

Hi

See the code below...

Sierdna S.

Public Sub SBO_ManageItemEvent( _
      ByVal FormUID As String, _
      ByRef pVal As SAPbouiCOM.ItemEvent, _
      ByRef BubbleEvent As Boolean _
) ... Handles ItemEvent
  Dim oForm As SAPbouiCOM.Form
  Try
      oForm = SBO_Application.Forms.Item(FormUID)
  Catch ex As Exception
      oForm = Nothing
  End Try

  If Not oForm Is Nothing Then
    Select Case oForm.TypeEx
      Case "YOUR_FORM_TYPEEX"
	Select Case pVal.EventType
	  Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
	    Select Case pVal.ItemUID
	      Case "1"  ' Button Confirm Operation
		  If Not pVal.BeforeAction Then
		    ' do actions
		  End If
	      Case "2"
		  If Not pVal.BeforeAction Then
		    Me.<parent_event_handler_class>.oYourFormClass = Nothing
		    oForm.Close()
		  End If
	    End Select
	End Select
    End Select
    
    oForm = Nothing

  End If
End Sub

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question