on 10-15-2008 8:17 AM
Hi All,
In my form itemevent is executing more than once.first time when i open the form and add some value then i click cancel to close the form. again i open the form and selected CFL.it is executing two times.then again i press cancel and load the form again.and chose CFL it is executing 3 times.
How should avoid this problem.Even i used pval.innerevent still the problem exists..
Kind regards
Mohana
Hi...
send me only item event code.
Regards...
Billa 2007
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This is my code :
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Dim ChooseFromListEvent As SAPbouiCOM.ChooseFromListEvent
Try
If pVal.FormUID = "FSI" And pVal.FormTypeEx = "FSI" Then
'****************************ChooseFromList Event is called using the raiseevent******************************
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST And pVal.BeforeAction = False Then
ChooseFromListEvent = pVal
RaiseEvent ChooseFromList(pVal.ItemUID, pVal.ColUID, pVal.Row, ChooseFromListEvent.ChooseFromListUID, ChooseFromListEvent.SelectedObjects)
End If
'****************************Selecting the clicked row in the item matrix******************************
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK And pVal.ItemUID = "MatItem" And (pVal.ColUID = "#" Or pVal.ColUID = "ItemCode" Or pVal.ColUID = "ItemName" Or pVal.ColUID = "" Or pVal.ColUID = "Qty" Or pVal.ColUID = "UOM" Or pVal.ColUID = "SamNo" Or pVal.ColUID = "Station" Or pVal.ColUID = "StanDesc" Or pVal.ColUID = "NoOfSample") And pVal.Row > 0 And pVal.BeforeAction = False And pVal.InnerEvent = False Then
Try
oItmMatrix.SelectRow(pVal.Row, True, False)
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
If pVal.CharPressed = Keys.Tab And pVal.ItemUID = "MatItem" And pVal.ColUID = "ItemCode" And pVal.Row > 0 And pVal.BeforeAction = True Then
Dim oItemCode, oItemName As SAPbouiCOM.EditText
Dim oCurrentRow As Integer
Dim oRs As SAPbobsCOM.Recordset
Dim IntICount As Integer
Dim StrSql As String
Try
oRs = Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oCurrentRow = pVal.Row
oItemCode = oItmCodeCol.Cells.Item(oCurrentRow).Specific
oItemName = oItmNameCol.Cells.Item(oCurrentRow).Specific
oItmMatrix.GetLineData(oCurrentRow)
If oItemCode.Value.Length = 0 Then
ItemCFL = New ItemCFL(oCurrentRow, oVenCodeTxt.Value, oItmMatrix)
BubbleEvent = False
Else
StrSql = "Select T0.*,T1.DocNum From [@PSSIT_CMSAMDTL] T0 " _
& "Inner Join [@PSSIT_CMSAMHDR] T1 On T1.DocEntry = T0.DocEntry " _
& "Where T1.U_CardCode = '" & oVenCodeTxt.Value & "' and T0.U_ItemCode = '" & oItemCode.Value & "' and T1.Status = 'O' and T0.U_LineStatus='O' "
oRs.DoQuery(StrSql)
If oRs.RecordCount = 0 Then
SBO_Application.SetStatusBarMessage("Invalid monetary value", SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
ElseIf oRs.RecordCount > 0 Then
oRs.MoveFirst()
For IntICount = 0 To oRs.RecordCount - 1
If oCurrentRow = oItmMatrix.VisualRowCount Then
oChildDB.Offset = oChildDB.Size - 1
SetDefaultValue()
oItmMatrix.SetLineData(oCurrentRow)
oItmMatrix.FlushToDataSource()
End If
oChildDB.SetValue("U_ItemCode", oChildDB.Offset, oRs.Fields.Item("U_ItemCode").Value)
oChildDB.SetValue("U_Dscription", oChildDB.Offset, oRs.Fields.Item("U_Dscription").Value)
oChildDB.SetValue("U_Quantity", oChildDB.Offset, "1.00")
oChildDB.SetValue("U_UOM", oChildDB.Offset, oRs.Fields.Item("U_UOM").Value)
oChildDB.SetValue("U_SampNo", oChildDB.Offset, "")
oChildDB.SetValue("U_StanID", oChildDB.Offset, "")
oChildDB.SetValue("U_StanDes", oChildDB.Offset, "")
oChildDB.SetValue("U_LineStatus", oChildDB.Offset, "O")
oChildDB.SetValue("U_SampNos", oChildDB.Offset, "")
oChildDB.SetValue("U_Samtesd", oChildDB.Offset, "")
oChildDB.SetValue("U_BaseRefNo", oChildDB.Offset, oRs.Fields.Item("DocEntry").Value)
oItmMatrix.SetLineData(oItmMatrix.GetNextSelectedRow(0, SAPbouiCOM.BoOrderType.ot_SelectionOrder))
oItmMatrix.FlushToDataSource()
If Len(oItmCodeCol.Cells.Item(oItmMatrix.RowCount).Specific.value) > 0 Then
oChildDB.InsertRecord(oChildDB.Size)
oChildDB.Offset = oChildDB.Size - 1
SetDefaultValue()
oItmMatrix.AddRow(1, oItmMatrix.RowCount)
oItmMatrix.SelectRow(oItmMatrix.RowCount, True, False)
End If
oRs.MoveNext()
Next
End If
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
'****************************Validating the values in the cell******************************
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_VALIDATE And pVal.ItemUID = "MatItem" And pVal.ColUID = "NoOfSample" And pVal.Row > 0 And pVal.BeforeAction = True And pVal.InnerEvent = False Then
Dim oRs As SAPbobsCOM.Recordset = Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Dim oItmCode, oNoOfSamples As SAPbouiCOM.EditText
Dim oCurrentRow As Integer
Dim StrSql As String
Try
If oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
oCurrentRow = pVal.Row
oItmCode = oItmCodeCol.Cells.Item(oCurrentRow).Specific
oNoOfSamples = oNoOfSamCol.Cells.Item(oCurrentRow).Specific
oItmMatrix.GetLineData(pVal.Row)
StrSql = "Select T0.* from [@PSSIT_CMINSDTL] T0 " _
& "Inner Join [@PSSIT_CMINSHDR] T1 On T1.DocEntry = T0.DocEntry " _
& "where T0.U_ItemCode = '" & oItmCode.Value & "' and T1.DocNum = " & oDocNoTxt.Value
oRs.DoQuery(StrSql)
If oRs.RecordCount > 0 Then
oRs.MoveFirst()
If oNoOfSamples.Value < oRs.Fields.Item("U_SampNos").Value Then
SBO_Application.SetStatusBarMessage("No Of Samples should not be decreased. [SampleInspection - Rows - NoOfSamples][Line: " & pVal.Row & "]", SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End If
End If
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
'****************************Fetching Parameter Details for the itemcode******************************
If pVal.CharPressed = Keys.Tab And pVal.ItemUID = "MatItem" And pVal.ColUID = "NoOfSample" And pVal.Row > 0 And pVal.BeforeAction = True And pVal.InnerEvent = False Then
Dim oItmCode, oItmName, oNoOfSamples, oSampleNo As SAPbouiCOM.EditText
Dim oCurrentRow, IntICount As Integer
Dim oRs As SAPbobsCOM.Recordset
Dim oIfExists As Boolean = False
Try
If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then
oRs = Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oCurrentRow = pVal.Row
oItmCode = oItmCodeCol.Cells.Item(oCurrentRow).Specific
oItmName = oItmNameCol.Cells.Item(oCurrentRow).Specific
oNoOfSamples = oNoOfSamCol.Cells.Item(oCurrentRow).Specific
oSampleNo = oSampleNoCol.Cells.Item(oCurrentRow).Specific
oItmMatrix.GetLineData(pVal.Row)
oChildDB.SetValue("U_SampNos", oChildDB.Offset, oNoOfSamples.Value)
oChildDB.SetValue("U_Samtesd", oChildDB.Offset, "1")
oItmMatrix.SetLineData(pVal.Row)
If oParMatrix.RowCount = 0 Then
oForm.Freeze(True)
If oNoOfSamples.Value > 0 Then
FetchParameterData(oItmCode.Value, oItmName.Value, pVal.Row, oNoOfSamples.Value, oSampleNo.Value)
End If
If oNoOfSamples.Value > 1 Then
oForm.Items.Item("BtnNS").Enabled = True
End If
oForm.Freeze(False)
BubbleEvent = False
ElseIf oParMatrix.RowCount > 0 Then
For IntICount = 1 To oParMatrix.RowCount
oParMatrix.GetLineData(IntICount)
If oItmCode.Value = oPItmCodeCol.Cells.Item(IntICount).Specific.Value Then
oIfExists = True
Return
End If
Next
If oIfExists = False Then
oForm.Freeze(True)
If oNoOfSamples.Value > 0 Then
FetchParameterData(oItmCode.Value, oItmName.Value, pVal.Row, oNoOfSamples.Value, oSampleNo.Value)
End If
oForm.Freeze(False)
BubbleEvent = False
End If
If oNoOfSamples.Value > 1 Then
oForm.Items.Item("BtnNS").Enabled = True
Else
oForm.Items.Item("BtnNS").Enabled = False
End If
End If
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
'****************************Listing the Parameter Details when next sample button is pressed******************************
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.ItemUID = "BtnNS" And pVal.BeforeAction = True And pVal.InnerEvent = False Then
Dim oItmCode, oItmName, oNoOfSamples, oSampleNo As SAPbouiCOM.EditText
Dim oCurrentRow As Integer
Try
oCurrentRow = oItmMatrix.GetNextSelectedRow(0, SAPbouiCOM.BoOrderType.ot_RowOrder)
oItmCode = oItmCodeCol.Cells.Item(oCurrentRow).Specific
oItmName = oItmNameCol.Cells.Item(oCurrentRow).Specific
oNoOfSamples = oNoOfSamCol.Cells.Item(oCurrentRow).Specific
oSampleNo = oSampleNoCol.Cells.Item(oCurrentRow).Specific
oItmMatrix.GetLineData(oCurrentRow)
If CInt(oSampleNo.Value) < oNoOfSamples.Value Then
oChildDB.SetValue("U_Samtesd", oChildDB.Offset, oSampleNo.Value + 1)
oItmMatrix.SetLineData(oCurrentRow)
oForm.Freeze(True)
FetchParameterData(oItmCode.Value, oItmName.Value, oCurrentRow, oNoOfSamples.Value, oSampleNo.Value)
oForm.Freeze(False)
BubbleEvent = False
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
End Try
End If
'****************************Loading the catalog CFL***********************************************
If pVal.CharPressed = Keys.Tab And pVal.ItemUID = "MatParam" And pVal.ColUID = "ActValue" And pVal.Row > 0 And pVal.BeforeAction = True And pVal.InnerEvent = False Then
Dim oPCode, oPType, oActVal As SAPbouiCOM.EditText
Dim oCurrentRow, IntICount As Integer
Dim oRs As SAPbobsCOM.Recordset
Dim StrSql As String
Try
oParMatrix.GetLineData(pVal.Row)
oCurrentRow = pVal.Row
oPCode = oPCodeCol.Cells.Item(oCurrentRow).Specific
oPType = oPTypeCol.Cells.Item(oCurrentRow).Specific
oActVal = oActValCol.Cells.Item(oCurrentRow).Specific
If oPType.Value = "Catalog" Or oPType.Value = "2" Or oPType.Value = "Catalogue" Then
If oActVal.Value.Length = 0 Then
CatalogCFL = New CatalogCFL(oCurrentRow, oPCode.Value)
BubbleEvent = False
ElseIf oActVal.Value.Length > 0 Then
oRs = Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
StrSql = "Select T0.* " _
& "from [@PSSIT_CMPRMCAT] T0 " _
& "Inner Join [@PSSIT_CMPARAM] T1 On T1.Code=T0.U_PCode " _
& "Where T0.Code = '" & oActVal.Value & "' and T0.U_PCode = " & oPCode.Value
oRs.DoQuery(StrSql)
If oRs.RecordCount = 0 Then
SBO_Application.SetStatusBarMessage("Invalid monetary value", SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
Else
For IntICount = 0 To oRs.RecordCount - 1
oParMatrix.GetLineData(oCurrentRow)
oParamDB.SetValue("U_ActVal", oParamDB.Offset, oRs.Fields.Item("Code").Value)
oParMatrix.SetLineData(oCurrentRow)
oParMatrix.FlushToDataSource()
Next
BubbleEvent = True
End If
End If
Else
BubbleEvent = True
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
'****************************Calculating the Average Value in the Parameter Matrix***********************************************
If pVal.ItemUID = "MatParam" And pVal.ColUID = "ActValue" And pVal.Row > 0 And pVal.EventType = SAPbouiCOM.BoEventTypes.et_VALIDATE And pVal.BeforeAction = True And pVal.InnerEvent = False Then
Dim IntICount As Integer
Dim oPILineNum, oPItmCode, oPCode, oPType, oPActValue, oAvg As SAPbouiCOM.EditText
Dim oCurrentRow As Integer
Dim DecValue As Decimal
Dim DecAvgValue As Decimal
Try
oForm.Freeze(True)
oCurrentRow = pVal.Row
oPILineNum = oILineNumCol.Cells.Item(oCurrentRow).Specific
oPItmCode = oPItmCodeCol.Cells.Item(oCurrentRow).Specific
oPCode = oPCodeCol.Cells.Item(oCurrentRow).Specific
oPType = oPTypeCol.Cells.Item(oCurrentRow).Specific
oPActValue = oActValCol.Cells.Item(oCurrentRow).Specific
oAvg = oAvgCol.Cells.Item(oCurrentRow).Specific
If oPType.Value = "Numeric" Or oPType.Value = "1" Then
For IntICount = 1 To oParMatrix.RowCount
oParMatrix.GetLineData(IntICount)
If oPActValue.Value.Length > 0 And (oPType.Value = "Numeric" Or oPType.Value = "1") Then
If oPItmCode.Value = oPItmCodeCol.Cells.Item(IntICount).Specific.Value Then
If oPILineNum.Value = oILineNumCol.Cells.Item(IntICount).Specific.Value Then
If oPCode.Value = oPCodeCol.Cells.Item(IntICount).Specific.Value Then
DecValue = DecValue + CDbl(oActValCol.Cells.Item(IntICount).Specific.Value)
End If
End If
End If
End If
Next
DecAvgValue = DecValue / CInt(oNoOfSamCol.Cells.Item(oItmMatrix.GetNextSelectedRow(0, SAPbouiCOM.BoOrderType.ot_RowOrder)).Specific.Value)
For IntICount = 1 To oParMatrix.RowCount
oParMatrix.GetLineData(IntICount)
If oPActValue.Value.Length > 0 And (oPType.Value = "Numeric" Or oPType.Value = "1") Then
If oPItmCode.Value = oPItmCodeCol.Cells.Item(IntICount).Specific.Value Then
If oPILineNum.Value = oILineNumCol.Cells.Item(IntICount).Specific.Value Then
If oPCode.Value = oPCodeCol.Cells.Item(IntICount).Specific.Value Then
oAvgCol.Cells.Item(IntICount).Specific.Value = DecAvgValue
End If
End If
End If
End If
Next
End If
oForm.Freeze(False)
oForm.Update()
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
'****************************Adding the child data to the database table***********************************************
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.ItemUID = "1" Then
If pVal.BeforeAction = True And pVal.InnerEvent = False Then
Dim IntICount, IChild As Integer
Dim oTransaction As Boolean
Try
If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Or oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
Dim oCode, oName, oPILineNum, oBaseRef, oPItmCode, oPItmName, oPSamNo, oPCode, oPName, oPType, oPValue, oPActValue, oCatDesc, oPTolPlus, oPTolMins, oAvg As SAPbouiCOM.EditText
Try
Validation()
DeleteEmptyItemRow()
Try
Company.StartTransaction()
If oParMatrix.RowCount > 0 Then
oTransaction = True
For IntICount = 1 To oParMatrix.RowCount
oCode = oCodeCol.Cells.Item(IntICount).Specific
oName = oNameCol.Cells.Item(IntICount).Specific
oBaseRef = oBaseRefCol.Cells.Item(IntICount).Specific
oPILineNum = oILineNumCol.Cells.Item(IntICount).Specific
oPItmCode = oPItmCodeCol.Cells.Item(IntICount).Specific
oPItmName = oPItmNameCol.Cells.Item(IntICount).Specific
oPSamNo = oPSamNoCol.Cells.Item(IntICount).Specific
oPCode = oPCodeCol.Cells.Item(IntICount).Specific
oPName = oPNameCol.Cells.Item(IntICount).Specific
oPType = oPTypeCol.Cells.Item(IntICount).Specific
oPValue = oStdValCol.Cells.Item(IntICount).Specific
oPActValue = oActValCol.Cells.Item(IntICount).Specific
oCatDesc = oCatDescCol.Cells.Item(IntICount).Specific
oPTolPlus = oTolPlusCol.Cells.Item(IntICount).Specific
oPTolMins = oTolMinCol.Cells.Item(IntICount).Specific
oAvg = oAvgCol.Cells.Item(IntICount).Specific
oParMatrix.GetLineData(IntICount)
If PSSIT_CMINSSTL.GetByKey(oCode.Value) = True Then
PSSIT_CMINSSTL.Code = oCode.Value
PSSIT_CMINSSTL.Name = oName.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ItemCode").Value = oPItmCode.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Dscription").Value = oPItmName.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Sno").Value = oPSamNo.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ParaCode").Value = oPCode.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ParaDesc").Value = oPName.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Ptype").Value = oPType.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Value").Value = oPValue.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_TollPlus").Value = oPTolPlus.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_TollMins").Value = oPTolMins.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ActVal").Value = oPActValue.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_CatDesc").Value = oCatDesc.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_average").Value = oAvg.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_BaseRefNo").Value = oBaseRef.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ILineNum").Value = oPILineNum.Value
IChild = PSSIT_CMINSSTL.Update()
Else
PSSIT_CMINSSTL.Code = oCode.Value
PSSIT_CMINSSTL.Name = oName.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ItemCode").Value = oPItmCode.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Dscription").Value = oPItmName.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Sno").Value = oPSamNo.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ParaCode").Value = oPCode.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ParaDesc").Value = oPName.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Ptype").Value = oPType.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Value").Value = oPValue.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_TollPlus").Value = oPTolPlus.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_TollMins").Value = oPTolMins.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ActVal").Value = oPActValue.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_CatDesc").Value = oCatDesc.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_average").Value = oAvg.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_BaseRefNo").Value = oBaseRef.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ILineNum").Value = oPILineNum.Value
IChild = PSSIT_CMINSSTL.Add()
End If
Next
Else
SBO_Application.SetStatusBarMessage("Enter Prameter Details", SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End If
If oTransaction = True Then
Company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit)
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
Finally
If oTransaction = False Then
Company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)
BubbleEvent = False
End If
End Try
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
'****************************Refreshing the form to initiate default values***********************************************
If pVal.BeforeAction = False And pVal.InnerEvent = False Then
Try
If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then
LoadDocNumber()
RefreshForm()
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
End Try
End If
End If
'****************************Editing is restricted before the item code is chosen***********************************************
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK And pVal.ItemUID = "MatItem" And pVal.Row > 0 And pVal.BeforeAction = True And pVal.InnerEvent = False Then
Dim oItmCodeEdit, oItmNameEdit As SAPbouiCOM.EditText
Dim oCurrentRow As Integer
Try
oCurrentRow = pVal.Row
oItmMatrix.GetLineData(oCurrentRow)
oItmCodeEdit = oItmCodeCol.Cells.Item(oCurrentRow).Specific
oItmNameEdit = oItmNameCol.Cells.Item(oCurrentRow).Specific
If (pVal.ColUID = "Qty" Or pVal.ColUID = "SamNo" Or pVal.ColUID = "Station" Or pVal.ColUID = "NoOfSample") Then
If oItmCodeEdit.Value.Length <= 0 Then
SBO_Application.StatusBar.SetText("Item No. is Missing [Message 131-51]", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
BubbleEvent = False
End If
Else
BubbleEvent = True
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
'****************************Realligning the values when the form is resized***********************************************
If pVal.FormUID = "FSI" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_RESIZE And pVal.BeforeAction = False And pVal.InnerEvent = False Then
Try
If BoolResize = False Then
oForm.Freeze(True)
oForm.Items.Item("MatItem").Height = 160
oForm.Items.Item("30").Left = 11
oForm.Items.Item("30").Top = oForm.Items.Item("MatItem").Top + oForm.Items.Item("MatItem").Height + 10
oForm.Items.Item("MatParam").Top = oForm.Items.Item("MatItem").Top + oForm.Items.Item("MatItem").Height + 30
oForm.Items.Item("MatParam").Height = 160
oForm.Freeze(False)
oForm.Update()
BoolResize = True
ElseIf BoolResize = True Then
oForm.Freeze(True)
oForm.Items.Item("MatItem").Height = 155
oForm.Items.Item("MatItem").Width = 589
oItmCodeCol.Width = 88
oItmNameCol.Width = 129
oQtyCol.Width = 75
oUOMCol.Width = 70
oSamNoCol.Width = 101
oStationCol.Width = 58
oStationDescCol.Width = 80
oNoOfSamCol.Width = 80
oSampleNoCol.Width = 40
oForm.Items.Item("30").Left = 11
oForm.Items.Item("30").Top = 257
oForm.Items.Item("MatParam").Top = 276
oForm.Items.Item("MatParam").Height = 148
oForm.Items.Item("MatParam").Width = 589
BoolResize = False
oForm.Freeze(False)
oForm.Update()
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
End Try
End If
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
End Try
End Sub
Regards
Mohana
hi,
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_RESIZE And pVal.BeforeAction = False And pVal.InnerEvent = False And pVal.FormUID="FormUID" then
use FormUID and check.
regards,
varma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mohana,
i Would try following:
Catch an event like this:
Case SAPbouiCOM.BoEventTypes.et_CLICK And pVal.FormType = 10001 And pVal.ItemUID = "2" And pVal. BeforeAction = True
Then you execute a procedure like this to force closing of the form and reset parameters in the originating form:
Dim oForm As SAPbouiCOM.Form
Dim oEditCardName As SAPbouiCOM.EditText
Dim oEditCardCode As SAPbouiCOM.EditText
oForm = SBO_Application.Forms.ActiveForm
oForm.Close()
oForm = SBO_Application.Forms.ActiveForm
oEditCardName = oForm.Items.Item("8").Specific
oEditCarCode = oForm.Items.Item("EditTxt").Specific
oEditCardName.Value = ""
oEditCardCode.Value = ""
Hope this helps.
Kind regards,
Winfried Tiemessen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vasu,
I need some solution ....:-)
This is my code :
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Dim ChooseFromListEvent As SAPbouiCOM.ChooseFromListEvent
Try
If pVal.FormUID = "FSI" And pVal.FormTypeEx = "FSI" Then
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST And pVal.BeforeAction = False Then
ChooseFromListEvent = pVal
RaiseEvent ChooseFromList(pVal.ItemUID, pVal.ColUID, pVal.Row, ChooseFromListEvent.ChooseFromListUID, ChooseFromListEvent.SelectedObjects)
End If
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK And pVal.ItemUID = "MatItem" And (pVal.ColUID = "#" Or pVal.ColUID = "ItemCode" Or pVal.ColUID = "ItemName" Or pVal.ColUID = "" Or pVal.ColUID = "Qty" Or pVal.ColUID = "UOM" Or pVal.ColUID = "SamNo" Or pVal.ColUID = "Station" Or pVal.ColUID = "StanDesc" Or pVal.ColUID = "NoOfSample") And pVal.Row > 0 And pVal.BeforeAction = False Then
Try
oItmMatrix.SelectRow(pVal.Row, True, False)
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_VALIDATE And pVal.ItemUID = "MatItem" And pVal.ColUID = "NoOfSample" And pVal.Row > 0 And pVal.BeforeAction = True Then
Dim oRs As SAPbobsCOM.Recordset = Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Dim oItmCode, oNoOfSamples As SAPbouiCOM.EditText
Dim oCurrentRow As Integer
Dim StrSql As String
Try
If oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
oCurrentRow = pVal.Row
oItmCode = oItmCodeCol.Cells.Item(oCurrentRow).Specific
oNoOfSamples = oNoOfSamCol.Cells.Item(oCurrentRow).Specific
oItmMatrix.GetLineData(pVal.Row)
StrSql = "Select T0.* from [@PSSIT_CMINSDTL] T0 " _
& "Inner Join [@PSSIT_CMINSHDR] T1 On T1.DocEntry = T0.DocEntry " _
& "where T0.U_ItemCode = '" & oItmCode.Value & "' and T1.DocNum = " & oDocNoTxt.Value
oRs.DoQuery(StrSql)
If oRs.RecordCount > 0 Then
oRs.MoveFirst()
If oNoOfSamples.Value < oRs.Fields.Item("U_SampNos").Value Then
SBO_Application.SetStatusBarMessage("No Of Samples should not be decreased. [SampleInspection - Rows - NoOfSamples][Line: " & pVal.Row & "]", SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End If
End If
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
If pVal.CharPressed = Keys.Tab And pVal.ItemUID = "MatItem" And pVal.ColUID = "NoOfSample" And pVal.Row > 0 And pVal.BeforeAction = True Then
Dim oItmCode, oItmName, oNoOfSamples, oSampleNo As SAPbouiCOM.EditText
Dim oCurrentRow, IntICount As Integer
Dim oRs As SAPbobsCOM.Recordset
Dim oIfExists As Boolean = False
Try
If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then
oRs = Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oCurrentRow = pVal.Row
oItmCode = oItmCodeCol.Cells.Item(oCurrentRow).Specific
oItmName = oItmNameCol.Cells.Item(oCurrentRow).Specific
oNoOfSamples = oNoOfSamCol.Cells.Item(oCurrentRow).Specific
oSampleNo = oSampleNoCol.Cells.Item(oCurrentRow).Specific
oItmMatrix.GetLineData(pVal.Row)
oChildDB.SetValue("U_SampNos", oChildDB.Offset, oNoOfSamples.Value)
oChildDB.SetValue("U_Samtesd", oChildDB.Offset, "1")
oItmMatrix.SetLineData(pVal.Row)
If oParMatrix.RowCount = 0 Then
oForm.Freeze(True)
FetchParameterData(oItmCode.Value, oItmName.Value, pVal.Row, oNoOfSamples.Value, oSampleNo.Value)
oForm.Freeze(False)
BubbleEvent = False
ElseIf oParMatrix.RowCount > 0 Then
For IntICount = 1 To oParMatrix.RowCount
oParMatrix.GetLineData(IntICount)
If oItmCode.Value = oPItmCodeCol.Cells.Item(IntICount).Specific.Value Then
oIfExists = True
Return
End If
Next
If oIfExists = False Then
oForm.Freeze(True)
FetchParameterData(oItmCode.Value, oItmName.Value, pVal.Row, oNoOfSamples.Value, oSampleNo.Value)
oForm.Freeze(False)
BubbleEvent = False
End If
End If
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.ItemUID = "BtnNS" And pVal.BeforeAction = True Then
Dim oItmCode, oItmName, oNoOfSamples, oSampleNo As SAPbouiCOM.EditText
Dim oCurrentRow As Integer
Try
oCurrentRow = oItmMatrix.GetNextSelectedRow(0, SAPbouiCOM.BoOrderType.ot_RowOrder)
oItmCode = oItmCodeCol.Cells.Item(oCurrentRow).Specific
oItmName = oItmNameCol.Cells.Item(oCurrentRow).Specific
oNoOfSamples = oNoOfSamCol.Cells.Item(oCurrentRow).Specific
oSampleNo = oSampleNoCol.Cells.Item(oCurrentRow).Specific
oItmMatrix.GetLineData(oCurrentRow)
If CInt(oSampleNo.Value) < oNoOfSamples.Value Then
oChildDB.SetValue("U_Samtesd", oChildDB.Offset, oSampleNo.Value + 1)
oItmMatrix.SetLineData(oCurrentRow)
oForm.Freeze(True)
FetchParameterData(oItmCode.Value, oItmName.Value, oCurrentRow, oNoOfSamples.Value, oSampleNo.Value)
oForm.Freeze(False)
BubbleEvent = False
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
End Try
End If
If pVal.CharPressed = Keys.Tab And pVal.ItemUID = "MatParam" And pVal.ColUID = "ActValue" And pVal.Row > 0 And pVal.BeforeAction = True Then
Dim oPCode, oPType, oActVal As SAPbouiCOM.EditText
Dim oCurrentRow, IntICount As Integer
Dim oRs As SAPbobsCOM.Recordset
Dim StrSql As String
Try
oParMatrix.GetLineData(pVal.Row)
oCurrentRow = pVal.Row
oPCode = oPCodeCol.Cells.Item(oCurrentRow).Specific
oPType = oPTypeCol.Cells.Item(oCurrentRow).Specific
oActVal = oActValCol.Cells.Item(oCurrentRow).Specific
If oPType.Value = "Catalog" Or oPType.Value = "2" Or oPType.Value = "Catalogue" Then
If oActVal.Value.Length = 0 Then
CatalogCFL = New CatalogCFL(oCurrentRow, oPCode.Value)
BubbleEvent = False
ElseIf oActVal.Value.Length > 0 Then
oRs = Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
StrSql = "Select T0.* " _
& "from [@PSSIT_CMPRMCAT] T0 " _
& "Inner Join [@PSSIT_CMPARAM] T1 On T1.Code=T0.U_PCode " _
& "Where T0.Code = '" & oActVal.Value & "' and T0.U_PCode = " & oPCode.Value
oRs.DoQuery(StrSql)
If oRs.RecordCount = 0 Then
SBO_Application.SetStatusBarMessage("Invalid monetary value", SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
Else
For IntICount = 0 To oRs.RecordCount - 1
oParMatrix.GetLineData(oCurrentRow)
oParamDB.SetValue("U_ActVal", oParamDB.Offset, oRs.Fields.Item("Code").Value)
oParMatrix.SetLineData(oCurrentRow)
oParMatrix.FlushToDataSource()
Next
BubbleEvent = True
End If
End If
Else
BubbleEvent = True
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
If pVal.ItemUID = "MatParam" And pVal.ColUID = "ActValue" And pVal.Row > 0 And pVal.EventType = SAPbouiCOM.BoEventTypes.et_VALIDATE And pVal.BeforeAction = True Then
Dim IntICount As Integer
Dim oPILineNum, oPItmCode, oPCode, oPType, oPActValue, oAvg As SAPbouiCOM.EditText
Dim oCurrentRow As Integer
Dim DecValue As Decimal
Dim DecAvgValue As Decimal
Try
oForm.Freeze(True)
oCurrentRow = pVal.Row
oPILineNum = oILineNumCol.Cells.Item(oCurrentRow).Specific
oPItmCode = oPItmCodeCol.Cells.Item(oCurrentRow).Specific
oPCode = oPCodeCol.Cells.Item(oCurrentRow).Specific
oPType = oPTypeCol.Cells.Item(oCurrentRow).Specific
oPActValue = oActValCol.Cells.Item(oCurrentRow).Specific
oAvg = oAvgCol.Cells.Item(oCurrentRow).Specific
If oPType.Value = "Numeric" Or oPType.Value = "1" Then
For IntICount = 1 To oParMatrix.RowCount
oParMatrix.GetLineData(IntICount)
If oPActValue.Value.Length > 0 And (oPType.Value = "Numeric" Or oPType.Value = "1") Then
If oPItmCode.Value = oPItmCodeCol.Cells.Item(IntICount).Specific.Value Then
If oPILineNum.Value = oILineNumCol.Cells.Item(IntICount).Specific.Value Then
If oPCode.Value = oPCodeCol.Cells.Item(IntICount).Specific.Value Then
DecValue = DecValue + CDbl(oActValCol.Cells.Item(IntICount).Specific.Value)
End If
End If
End If
End If
Next
DecAvgValue = DecValue / CInt(oNoOfSamCol.Cells.Item(oItmMatrix.GetNextSelectedRow(0, SAPbouiCOM.BoOrderType.ot_RowOrder)).Specific.Value)
For IntICount = 1 To oParMatrix.RowCount
oParMatrix.GetLineData(IntICount)
If oPActValue.Value.Length > 0 And (oPType.Value = "Numeric" Or oPType.Value = "1") Then
If oPItmCode.Value = oPItmCodeCol.Cells.Item(IntICount).Specific.Value Then
If oPILineNum.Value = oILineNumCol.Cells.Item(IntICount).Specific.Value Then
If oPCode.Value = oPCodeCol.Cells.Item(IntICount).Specific.Value Then
oAvgCol.Cells.Item(IntICount).Specific.Value = DecAvgValue
End If
End If
End If
End If
Next
End If
oForm.Freeze(False)
oForm.Update()
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.ItemUID = "1" Then
If pVal.BeforeAction = True Then
Dim IntICount, IChild As Integer
Dim oTransaction As Boolean
Try
If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Or oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
Dim oCode, oName, oPILineNum, oBaseRef, oPItmCode, oPItmName, oPSamNo, oPCode, oPName, oPType, oPValue, oPActValue, oCatDesc, oPTolPlus, oPTolMins, oAvg As SAPbouiCOM.EditText
Try
Validation()
DeleteEmptyItemRow()
Company.StartTransaction()
If oParMatrix.RowCount > 0 Then
oTransaction = True
For IntICount = 1 To oParMatrix.RowCount
oCode = oCodeCol.Cells.Item(IntICount).Specific
oName = oNameCol.Cells.Item(IntICount).Specific
oBaseRef = oBaseRefCol.Cells.Item(IntICount).Specific
oPILineNum = oILineNumCol.Cells.Item(IntICount).Specific
oPItmCode = oPItmCodeCol.Cells.Item(IntICount).Specific
oPItmName = oPItmNameCol.Cells.Item(IntICount).Specific
oPSamNo = oPSamNoCol.Cells.Item(IntICount).Specific
oPCode = oPCodeCol.Cells.Item(IntICount).Specific
oPName = oPNameCol.Cells.Item(IntICount).Specific
oPType = oPTypeCol.Cells.Item(IntICount).Specific
oPValue = oStdValCol.Cells.Item(IntICount).Specific
oPActValue = oActValCol.Cells.Item(IntICount).Specific
oCatDesc = oCatDescCol.Cells.Item(IntICount).Specific
oPTolPlus = oTolPlusCol.Cells.Item(IntICount).Specific
oPTolMins = oTolMinCol.Cells.Item(IntICount).Specific
oAvg = oAvgCol.Cells.Item(IntICount).Specific
oParMatrix.GetLineData(IntICount)
If PSSIT_CMINSSTL.GetByKey(oCode.Value) = True Then
PSSIT_CMINSSTL.Code = oCode.Value
PSSIT_CMINSSTL.Name = oName.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ItemCode").Value = oPItmCode.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Dscription").Value = oPItmName.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Sno").Value = oPSamNo.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ParaCode").Value = oPCode.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ParaDesc").Value = oPName.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Ptype").Value = oPType.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Value").Value = oPValue.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_TollPlus").Value = oPTolPlus.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_TollMins").Value = oPTolMins.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ActVal").Value = oPActValue.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_CatDesc").Value = oCatDesc.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_average").Value = oAvg.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_BaseRefNo").Value = oBaseRef.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ILineNum").Value = oPILineNum.Value
IChild = PSSIT_CMINSSTL.Update()
Else
PSSIT_CMINSSTL.Code = oCode.Value
PSSIT_CMINSSTL.Name = oName.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ItemCode").Value = oPItmCode.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Dscription").Value = oPItmName.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Sno").Value = oPSamNo.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ParaCode").Value = oPCode.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ParaDesc").Value = oPName.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Ptype").Value = oPType.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_Value").Value = oPValue.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_TollPlus").Value = oPTolPlus.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_TollMins").Value = oPTolMins.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ActVal").Value = oPActValue.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_CatDesc").Value = oCatDesc.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_average").Value = oAvg.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_BaseRefNo").Value = oBaseRef.Value
PSSIT_CMINSSTL.UserFields.Fields.Item("U_ILineNum").Value = oPILineNum.Value
IChild = PSSIT_CMINSSTL.Add()
End If
Next
Else
SBO_Application.SetStatusBarMessage("Enter Prameter Details", SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End If
If oTransaction = True Then
Company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit)
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
Finally
If oTransaction = False Then
Company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)
BubbleEvent = False
End If
End Try
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
If pVal.BeforeAction = False Then
Try
If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then
LoadDocNumber()
RefreshForm()
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
End Try
End If
End If
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK And pVal.ItemUID = "MatItem" And pVal.Row > 0 And pVal.BeforeAction = True Then
Dim oItmCodeEdit, oItmNameEdit As SAPbouiCOM.EditText
Dim oCurrentRow As Integer
Try
oCurrentRow = pVal.Row
oItmMatrix.GetLineData(oCurrentRow)
oItmCodeEdit = oItmCodeCol.Cells.Item(oCurrentRow).Specific
oItmNameEdit = oItmNameCol.Cells.Item(oCurrentRow).Specific
If (pVal.ColUID = "Qty" Or pVal.ColUID = "SamNo" Or pVal.ColUID = "Station" Or pVal.ColUID = "NoOfSample") Then
If oItmCodeEdit.Value.Length <= 0 Then
SBO_Application.StatusBar.SetText("Item No. is Missing [Message 131-51]", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
BubbleEvent = False
End If
Else
BubbleEvent = True
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_RESIZE And pVal.BeforeAction = False Then
Try
If BoolResize = False Then
oForm.Freeze(True)
oForm.Items.Item("MatItem").Height = 160
oForm.Items.Item("MatParam").Top = oForm.Items.Item("MatItem").Top + oForm.Items.Item("MatItem").Height + 20
oForm.Items.Item("MatParam").Height = 160
oForm.Freeze(False)
ElseIf BoolResize = True Then
oForm.Freeze(True)
oForm.Items.Item("MatItem").Height = 155
oForm.Items.Item("MatItem").Width = 589
'oItmCodeCol.Width = 88
'oItmNameCol.Width = 129
'oQtyCol.Width = 75
'oUOMCol.Width = 70
'oSamNoCol.Width = 101
'oStationCol.Width = 58
'oStationDescCol.Width = 80
'oNoOfSamCol.Width = 80
'oSampleNoCol.Width = 40
oForm.Items.Item("MatParam").Top = 276
oForm.Items.Item("MatParam").Height = 148
oForm.Items.Item("MatParam").Width = 589
BoolResize = False
oForm.Freeze(False)
oForm.Update()
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
BubbleEvent = False
End Try
End If
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
End Try
End Sub
regards
Mohana
Hi...
try this one i used pVal.InnerEvent = False
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK And pVal.ItemUID = "MatItem" And (pVal.ColUID = "#" Or pVal.ColUID = "ItemCode" Or pVal.ColUID = "ItemName" Or pVal.ColUID = "" Or pVal.ColUID = "Qty" Or pVal.ColUID = "UOM" Or pVal.ColUID = "SamNo" Or pVal.ColUID = "Station" Or pVal.ColUID = "StanDesc" Or pVal.ColUID = "NoOfSample") And pVal.Row > 0 And pVal.BeforeAction = False And pVal.InnerEvent = False Then
Regards..
Billa 2007
Hi,
Still iam getting the same :
My problem is - >
1)first time iam running the addon, it is working fine.it is executing once(item event)
2)i pressed cancel and closed the form.then i again click on the menu to open the form.this time, the events are executing twice.
3)i repeat process (2).this time,the events are firing thrice the times.
....it is going on still i end the application.then i re run the addon the above process from 1,2... is executing.
How should i solve this problem.
regards
Mohana
Hi..
try this one
Private Sub SBO_Application_AppEvent(ByVal EventType As SAPbouiCOM.BoAppEventTypes) Handles SBO_Application.AppEvent
If (EventType = SAPbouiCOM.BoAppEventTypes.aet_CompanyChanged) Or (EventType = SAPbouiCOM.BoAppEventTypes.aet_ShutDown) Then
System.Windows.Forms.Application.Exit()
End If
End Sub
regards..
Billa 2007
hi,
for form_resize event how did i set the flag.
this is my code :
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_RESIZE And pVal.BeforeAction = False And pVal.InnerEvent = False Then
Try
If BoolResize = False Then
oForm.Freeze(True)
oForm.Items.Item("MatItem").Height = 160
oForm.Items.Item("30").Left = 11
oForm.Items.Item("30").Top = oForm.Items.Item("MatItem").Top + oForm.Items.Item("MatItem").Height + 10
oForm.Items.Item("MatParam").Top = oForm.Items.Item("MatItem").Top + oForm.Items.Item("MatItem").Height + 30
oForm.Items.Item("MatParam").Height = 160
oForm.Freeze(False)
oForm.Update()
BoolResize = True
ElseIf BoolResize = True Then
oForm.Freeze(True)
oForm.Items.Item("MatItem").Height = 155
oForm.Items.Item("MatItem").Width = 589
oItmCodeCol.Width = 88
oItmNameCol.Width = 129
oQtyCol.Width = 75
oUOMCol.Width = 70
oSamNoCol.Width = 101
oStationCol.Width = 58
oStationDescCol.Width = 80
oNoOfSamCol.Width = 80
oSampleNoCol.Width = 40
oForm.Items.Item("30").Left = 11
oForm.Items.Item("30").Top = 257
oForm.Items.Item("MatParam").Top = 276
oForm.Items.Item("MatParam").Height = 148
oForm.Items.Item("MatParam").Width = 589
BoolResize = False
oForm.Freeze(False)
oForm.Update()
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
End Try
End If
For the fir st time it is working fine. for the second time the event is executing twice.so the code is not working properly.
Regards
Mohana
hi,
add pVal.FormUID in the Resize event as shown below in the bold Font.
If pVal.FormUID="FormUID" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_RESIZE And pVal.BeforeAction = False And pVal.InnerEvent = False Then
Try
If BoolResize = False Then
oForm.Freeze(True)
oForm.Items.Item("MatItem").Height = 160
oForm.Items.Item("30").Left = 11
oForm.Items.Item("30").Top = oForm.Items.Item("MatItem").Top + oForm.Items.Item("MatItem").Height + 10
oForm.Items.Item("MatParam").Top = oForm.Items.Item("MatItem").Top + oForm.Items.Item("MatItem").Height + 30
oForm.Items.Item("MatParam").Height = 160
oForm.Freeze(False)
oForm.Update()
BoolResize = True
ElseIf BoolResize = True Then
oForm.Freeze(True)
oForm.Items.Item("MatItem").Height = 155
oForm.Items.Item("MatItem").Width = 589
oItmCodeCol.Width = 88
oItmNameCol.Width = 129
oQtyCol.Width = 75
oUOMCol.Width = 70
oSamNoCol.Width = 101
oStationCol.Width = 58
oStationDescCol.Width = 80
oNoOfSamCol.Width = 80
oSampleNoCol.Width = 40
oForm.Items.Item("30").Left = 11
oForm.Items.Item("30").Top = 257
oForm.Items.Item("MatParam").Top = 276
oForm.Items.Item("MatParam").Height = 148
oForm.Items.Item("MatParam").Width = 589
BoolResize = False
oForm.Freeze(False)
oForm.Update()
End If
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, True)
End Try
End If
regards,
varma
Edited by: Varma on Oct 16, 2008 12:01 PM
hi,
can u give me code
regards,
varma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
14 | |
10 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.