Skip to Content
0
Former Member
Dec 04, 2009 at 10:04 AM

control is jumping onto next control...

37 Views

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
        Dim EventEnum As SAPbouiCOM.BoEventTypes
        EventEnum = pVal.EventType
        If FormUID = "CQ_FA_MasterData" And (pVal.ItemUID = "23" Or pVal.ItemUID = "24") And pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS And pVal.BeforeAction = False Then
                Dim AssetValue As Integer
                Dim DepValue As Integer
                Dim NetValue As Integer
                oitem = oForm.Items.Item("23")
                oedit = oitem.Specific
                AssetValue = oForm.Items.Item("23").Specific.value.ToString
                If AssetValue < 0 Then
                    SBO_Application.StatusBar.SetText("Asset Value Must Be Greater Than 0", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                    oForm.Items.Item("23").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
                    oForm.Items.Item("23").Specific.value = 0
                End If
                oitem = oForm.Items.Item("24")
                oedit = oitem.Specific
                DepValue = oForm.Items.Item("24").Specific.value.ToString
                If DepValue < 0 Then
                    SBO_Application.StatusBar.SetText("Depreciation Value must be Greater Than 0", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                    oForm.Items.Item("24").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
                    oForm.Items.Item("24").Specific.value = 0
                End If
                oitem = oForm.Items.Item("25")
                oedit = oitem.Specific
                If DepValue < AssetValue Then
                    NetValue = AssetValue - DepValue
                Else
                    SBO_Application.StatusBar.SetText("Depreciation Value should be Less than Asset Value", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                End If
                oForm.Freeze(True)
                oForm.Items.Item("25").Specific.value = NetValue
                oForm.Items.Item("25").Enabled = False
                oForm.Freeze(False)
            End If
End Sub