on 04-14-2010 2:39 PM
hello there !!!!
i m in Great Trouble please help me out..
i have to search for a specific Column n then i have to validate that portion, similarly after validating i have to add update delete all the fuction apply... so please help me i m very upset.
Public Sub HandleEventts_Allowance(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByRef BubbleEvent As Boolean)
Try
Dim Count As Int32
If FormUID.Equals("Allowance") Then
If (pVal.BeforeAction = True) And (pVal.ItemUID = "1") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) Then
If pVal.Row = 0 Then
'BubbleEvent = False
End If
o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
Count = o_Matrix.RowCount()
SBO_Application1.MessageBox("Matrix Count is " & o_Matrix.RowCount)
Validate(pVal, EventEnum, FormUID, BubbleEvent)
End If
End If
Catch ex As Exception
SBO_Application1.MessageBox(ex.Message)
End Try
End Sub
Public Sub Validate(ByRef pval As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByVal FormUID As String, ByRef BubbleEvent As Boolean)
Dim Row, ii As Integer
o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
o_Matrix.FlushToDataSource()
Try
For Row = 2 To o_Matrix.RowCount
StrName = Convert.ToString(DBtable.GetValue("CardCode", Row - 1)).Trim()''' i got Error over there n rest of my code is also not working pls...
StrUId = Convert.ToString(DBtable.GetValue("U_AlwID", Row - 1)).Trim()
StrEnter = Convert.ToString(DBtable.GetValue("U_SupEnter", Row - 1)).Trim()
StrExist = Convert.ToString(DBtable.GetValue("U_SupExist", Row - 1)).Trim()
If Row - 1 < DBtable.Rows.Count - 1 Or (Not (StrName.Equals(String.Empty) And StrUId.Equals(String.Empty) And (StrEnter.Equals(String.Empty) Or StrExist.Equals(String.Empty))) And (Row - 1 = DBtable.Rows.Count - 1)) Then
If (Not StrName.Equals(String.Empty)) And ((StrUId.Equals(String.Empty) Or StrEnter.Equals(String.Empty)) Or StrExist.Trim.Equals(String.Empty)) Then
SBO_Application1.StatusBar.SetText("Invalid values provided!Blank values not vllowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
BubbleEvent = False
Exit Sub
End If
For ii = Row To DBtable.Rows.Count - 1
If Convert.ToString(DBtable.GetValue("ColName", ii)).Trim().Equals(StrName.Trim()) Then
SBO_Application1.StatusBar.SetText("Invalid Allowance ID: Duplication Not Allowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
BubbleEvent = False
Exit Sub
End If
Next
If CDbl(StrName) < 0 Then
SBO_Application1.StatusBar.SetText("Invalid values provided!Blank values not vllowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
BubbleEvent = False
Exit Sub
End If
End If
Next Row
Catch ex As Exception
SBO_Application1.MessageBox(ex.Message)
End Try
End Sub
Hi,
You are make your matrix with screen painter or by code?
If it's with screen painter you can't get problem. If it's by code pls post your code (your from draw procedure code).
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello there !!!!
thanx for reply... brother i have sort out my problem.... again thanx
but brother now i think i have another problem which is Lost Focus .....
i really dont know how to handle my Matrix. n how to put check the matrix Columns that the user must enter some values...and User cann't go another field untill he or she filled the matrix field....
if u have any kind of sample then please send sample.. it will be very helpful for me..
Thanx
best Regards
Hi,
We use in general matrix for the document line or master data line. If you use a document or master data, you can add only one row.
You don't need code to fill your matrix. You need code to add new row or delete the row. I think that you follow the sample in SDK help (Blanket Agreement), in this example the matrix is used to load data and update it.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I don't know your question, can you be very explicit.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello there!!!!
sir my question is that i have to perform three basic operation on matrix which are insert to the database,update to the database and load data from database..
i have loaded data from the database now i have to insert and update the data to the database. for this purpose i want to use Flush to the datasource....
Regards
Hi,
If i understand, you want to select the row and delete it. And also select the row and add another row.
If is it that, this sample can help you.
If (pVal.ItemUID = "add") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then
Dim f As SAPbouiCOM.Form
Dim sel As Integer
Dim oMatrix As SAPbouiCOM.Matrix
f = SBO_Application.Forms.Item(FormUID)
oMatrix = f.Items.Item("mtx_0").Specific
f.DataSources.DBDataSources.Item(1).Clear()
sel = oMatrix.GetNextSelectedRow
oMatrix.AddRow(1, sel)
End If "This sample allow you to add row"
If (pVal.ItemUID = "del") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then
Dim f As SAPbouiCOM.Form
Dim sel As Integer
Dim oMatrix As SAPbouiCOM.Matrix
f = SBO_Application.Forms.Item(FormUID)
oMatrix = f.Items.Item("mtx_0").Specific
f.DataSources.DBDataSources.Item(1).Clear()
sel = oMatrix.GetNextSelectedRow
oMatrix.DeleteRow(sel)
End If "This sample allow you to delete row"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello there
sir i want to Add Update and delete these three basic operation onto the Matrix, Sir u game me a Sample code of Delete a specific Column...
Sir can u do me a favour pls leave every thing n just told me how to update a matrix ,like i have to fill the matrix field through the DATABASE table now i want to update the DataBase table from the matrix..
i just only know thta i have to fill back database table with the help of FLUSHTODATABASE()
here is my Sample Code...n i have to update in the validate portion...
Public Sub HandleEventts_Allowance(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByRef BubbleEvent As Boolean)
Try
Dim oCellValue As SAPbouiCOM.EditText
If FormUID.Equals("Allowance") Then
If (pVal.ItemUID = "MatAllow") Then
If pVal.Row = 0 Then Exit Sub
o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
If (pVal.Row > o_Matrix.RowCount) Then Exit Sub
oForm = SBO_Application1.Forms.Item(FormUID)
If (pVal.ItemUID = "1" Or EventEnum = SAPbouiCOM.BoEventTypes.et_CLICK) Then
o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
If pVal.ColUID = "ColName" And pVal.BeforeAction = True Then
If pVal.Row = 0 Then Exit Sub
oCellValue = CType(o_Matrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific(), SAPbouiCOM.EditText)
If (oCellValue.Value.Trim().Equals(String.Empty) And o_Matrix.RowCount <> pVal.Row) Then
SBO_Application1.StatusBar.SetText("Invalid Allowance ID: Blank Value Not Allowed", )
oCellValue.Active = True
BubbleEvent = False
Exit Sub
End If
End If
End If
End If
End If
Validate(pVal, EventEnum, FormUID, BubbleEvent)
Catch ex As Exception
SBO_Application1.MessageBox(ex.Message)
End Try
End Sub
Public Sub Validate(ByRef pval As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByVal FormUID As String, ByRef BubbleEvent As Boolean)
Dim str, str1 As String
Dim checkbox1, Checkbox2 As SAPbouiCOM.CheckBox
Dim o_Matrix As SAPbouiCOM.Matrix
Dim Sum As Integer
Dim oRecordset As SAPbobsCOM.Recordset
Dim Container As Integer
Dim Count As Int32
o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
oRecordset = o_CompanyObj.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Try
For Count = 0 To DBtable.Rows.Count - 1
CodeFill = Convert.ToString(DBtable.GetValue("Name", Count).Trme())
NameID = Convert.ToString(DBtable.GetValue("ColUID", Count).Trim())
Price = Convert.ToString(DBtable.GetValue("ColPrice", Count).Trim())
Quantity = Convert.ToString(DBtable.GetValue("ColQuant", Count).Trim())
Total = Convert.ToString(DBtable.GetValue("ColTotal", Count).Trim())
checkbox1 = o_Matrix.Columns.Item("ColSEnter").Cells.Item(Count).Specific
Checkbox2 = o_Matrix.Columns.Item("ColSExist").Cells.Item(Count).Specific
If (checkbox1.Checked = True) And (Checkbox2.Checked = True) Then
Dim Sql As String
Sql = "Update [@Supplier] Set U_Price=' " & Price & " ',U_ID=" & NameID & "Where Name ='" & CodeFill & " '"
oRecordset.DoQuery(Sql)
End If
Next Count
SBO_Application1.MessageBox("Record was Updated")
Catch ex As Exception
SBO_Application1.MessageBox(ex.Message)
End Try
End Sub
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
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.