Matrix Add Row
hi guys,
I created one form in screen painter and used this form in VB.net. In this form one grid is available.
In the menuevent of this form I write the code for open the form when user click on menu. I also write the code for add row in the matrix.
When I open the form first time both opening the form as well as adding row into the matrix works fine.
After closing the form and open the form second time menuevent occur more than 2 times.
Due to this many rows are added in the matrix only one click of add row.
What would be reason for occuring menuevents more than 2 times?
Can anyone help me?
thanks in advance.
hi kamil,
this function is called when click on Menu event.
when form is loaded.
// code when form is loaded from XML File.
Public Sub LoadForm1()
Dim oXmlDoc As Xml.XmlDocument
oXmlDoc = New Xml.XmlDocument
Dim sPath As String
Try
sPath = IO.Directory.GetParent(Application.StartupPath).ToString & "\"
oXmlDoc.Load(sPath & "NewInvoicePO.srf")
Dim cp As SAPbouiCOM.FormCreationParams
cp = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
cp.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed
cp.FormType = "Invoice"
cp.XmlData = oXmlDoc.InnerXml
cp.UniqueID = "IndentPO"
cp.ObjectType = "POHeader"
oForm1 = SBO_Application.Forms.AddEx(cp)
oForm1.Title = "Indent PO"
oForm1.AutoManaged = True
oForm1.SupportedModes = -1
'oForm1.DataBrowser.BrowseBy = oForm1.Items.Item("33").Specific().value
oForm1.Freeze(True)
oForm1.EnableMenu("1281", True) '// Add Find Mode
'oForm1.EnableMenu("1282", True) '// Add New Record
oForm1.EnableMenu("1288", True) '// Next Record
oForm1.EnableMenu("1289", True) '// Pevious Record
oForm1.EnableMenu("1290", True) '// First Record
oForm1.EnableMenu("1291", True) '// Last record
oForm1.EnableMenu("1292", True) '// Add Row
oForm1.EnableMenu("1293", True) '// Delete Row
oForm1.EnableMenu("1294", True) '// Duplicate Row
AddDataBindToMainForm()
CreateMatrixForForm1()
oDBDataSource4 = oForm1.DataSources.DBDataSources.Add("@INDENTPOMASTER")
oDBDataSource5 = oForm1.DataSources.DBDataSources.Add("@INDENTPOCHILD")
oForm1.DataBrowser.BrowseBy = "31"
GetMaxPONo()
oForm1.Freeze(False)
oForm1.Visible = True
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
I write the following code in the item event when click on close button.
// code when click on close button
If pVal.FormUID = "IndentPO" And pVal.ItemUID = "2" And pVal.BeforeAction = True Then
Try
oForm1.EnableMenu("1288", False) '// Next Record
oForm1.EnableMenu("1289", False) '// Pevious Record
oForm1.EnableMenu("1290", False) '// First Record
oForm1.EnableMenu("1291", False) '// Last record
oForm1.EnableMenu("1292", False) '// Add Row
oForm1.EnableMenu("1293", False) '// Delete Row
oForm1.EnableMenu("1294", False) '// Duplicate Row
Exit Sub
Catch ex As Exception
'MsgBox(ex.Message)
End Try
End If
In the first line of the try block I got the error.
Error : object reference not set to an instance of an object.
Similar Messages
-
Matrix Add Row and Duplicate Row
Hi All,
Can anybody suggest me how to work on Add row and duplicate row in any document table.
Lets take one example
Sales order document
In this doc we have table format where we specify item no, item description etc. In this table when we right click on particluar row we have option for add, delete, duplicate rows..etc.
wht i would like to know is that when we click add row .....one row is added and number is incremented under # column. Hw to perform and display this auto increment/ decrement of number for these rows under this # column
thanks
harishHi,
I tried following both code, but in that i am geting value. Means i am getting .Value Why i not getting value.
matrix.Columns.Item("V_-1").Cells.Item(pVal.Row).Specific.value = matrix.RowCount
and i also tried for "AddRow",
If pVal.BeforeAction = False Then
Select Case pVal.ItemUID
Case "AddRow"
matrix = form.Items.Item("mtr").Specific
If matrix.RowCount > 0 Then
If Trim(matrix.Columns.Item("V_-1").Cells.Item(matrix.RowCount).Specific.value) = "" Then
End If
End If
End Select
End If
In both example i not getting .Value.
Plz tell y ?
Thanks -
hello expert
i want to know how to add row in matrix as like in SAP b1.i create the code to add row in matrix by button but this is so many time consuming for end user due to this i want to add row functionality automatic as like SAP B1.so pls help me sir for this
thanx a lotHi
you can add row in matrix on lost focus of a column
Regards -
Hi All,
I want to add a row in matrix by clicking the Add Row option by right clicking on the matrix. If the form has one matrix means its working well. But if the form has more than one matrix if i activate the Add Row menu and write the code in the MenuEvent i am not able to give the ItemUID so if i add row in any of the matrix one row is added in all the matrix. How can i solve the problem.
Thanks in Advance.
Regards,
Madhavi.Hi Madhavi,
save the position and and the itemuid in a variable.
use the et_GOT_FOCUS event for this - than you know always in which matrix
and position you're standing.
use the variables in the et_MENU_EVENT to add the row in correct matrix and position
lg David -
In Matrix Value is duplicating while giving add row
In matrix i have given add row but the value is duplicating from the previous row in update mode.in add mode its ok
and while clicking update = error is coming "This entry already exists in the following tables "
plz help
its UrgentHi Nikhil k,
This is a kind of behavior of matrix.
So what you can do is that after calling the AddRow () Method put the blank values in the newly added row. Use this as follows:
oMatrix.AddRow();
oMatrix.FlushToDataSource();
this.oForm.DataSources.DBDataSources.Item("@DETAILTABLE").SetValue("U_Code", oMatrix.VisualRowCount - 1, "");
this.oForm.DataSources.DBDataSources.Item("@DETAILTABLE").SetValue("U_Name", oMatrix.VisualRowCount - 1, "");
oMatrix.LoadFromDataSource();
Hope it helps.
Thanks & Regards
Ankit Chauhan -
Dear all
I owe add row in matrix woth different information.
How ican do?
Sorry for my english
Thank'sFirst, in sap business one open the 'Fattura in uscita' form, then in menu 'View' set 'Informazioni di debug'.
Here you can see the column number corresponding to the fields you want to add in the row.
In your code use this information to insert records in the grid. Here's an example in VB6.
For i = 1 to 10
'Codice
Set c = m.Columns("1").Cells(i).Specific
c.Value = "Cod" & i
'Quantità
Set c = m.Columns("11").Cells(i).Specific
c.String = "10"
Next i
(c is a EditBox, m is the Fattura detail matrix)
Hope this helps
Ciao -
Matrix Select Row And Click()
Good Day
Experts:
I am in a bit of a quandry here today. I cannot figure out why I am unable to programatically acheive the 2 following actions:
1)Select a row in a Matrix
2)Click in a field to set cursor
I have the right-click Add Row event working. A new row is added to the Matrix. However, right now
the row I right-clicked on to add a new row is staying highlighted. I want to deselect that row and/or select the newly added row. Then click in a certain column in the new row.
The forum has many helpful suggestions but it seems I have tried al of them with no luck.
Here is what I have for the AddRow(after right-clicking on a row in the Matrix) and attempt at selecting a
row and clicking it:
MatlRFQMatrix.AddRow()
ClearMatrixDataSourceAdd(MatrixRowCount + 1)
PrevSeq = MatlRFQMatrix.Columns.Item("clHash").Cells.Item(MatlRFQMatrix.VisualRowCount - 1).Specific.value
PrevRFQSeq = MatlRFQMatrix.Columns.Item("clDocSeq").Cells.Item(MatlRFQMatrix.VisualRowCount - 1).Specific.value
MatlRFQMatrix.Columns.Item("clHash").Cells.Item(MatrixRowCount + 1).Specific.value = PrevSeq + 1
MatlRFQMatrix.Columns.Item("clDocNum").Cells.Item(MatrixRowCount + 1).Specific.Value = ReqNoPassed
MatlRFQMatrix.Columns.Item("clDocLine").Cells.Item(MatrixRowCount + 1).Specific.Value = ReqLinePassed
MatlRFQMatrix.Columns.Item("clDocSeq").Cells.Item(MatrixRowCount + 1).Specific.Value = PrevRFQSeq
MatlRFQMatrix.Columns.Item("clStatus").Cells.Item(MatrixRowCount + 1).Specific.Value = "Order"
Dim oMatrix As SAPbouiCOM.Matrix
oMatrix = MatlRFQForm.Items.Item("mtxMatRFQ").Specific
oMatrix.SelectRow(MatrixRowCount + 1, True, False)
MatlRFQMatrix.Columns.Item("clCardCd").Cells.Item(MatrixRowCount + 1).Click(SAPbouiCOM.BoCellClickType.ct_Regular)
Any ideas why I can't select a row or have a click sei in a column?
Thanks,
EdHi Ed,
on which event you are doing this coding.
It should be on right click After Event.
As well as you add the new row into the matrix, the visual row count increamented by one.
So insted of using Matrix.VisualRowCount+1 or matrix.VisualRowCount -1, you have to usae only and simply Matrix.VisualRowCount.
whats the value of MatrixRowCount. Is it a variable.
please try to more clear your code. -
Hi
i am developing a indent form in that i placed a matrix.
can u plz get me some hints of adding rows and deleting rows..
now i am placing buttons and writing code to do these tasks..Hi,
Dim OCT_Form As SAPbouiCOM.Form
Dim OCT_Matrix As SAPbouiCOM.Matrix
OCT_Form = OCT_Application.Forms.Item("FormUID")
OCT_Matrix = OCT_Form.Items.Item("MatrixUID").Specific
'To add row in the matrix use
OCT_Matrix.Addrow()
'To Delete Row from the matrix use
OCT_Matrix.DeleteRow()
Hope this will help you.
Regards,
Mahendra
Edited by: Mahendrakumar on Sep 25, 2008 2:18 PM -
Add row in Memu Event can't work
1:I create a Master UDO
2:Regist UDO with a child table
3:use UDO form generator tool to generate a UDO form with xml file
4:I use load from xml funtion to call form.
5. Add a buttom name "Add row" and have code with Add a row for matrix
I have two problems
one is,
I can add row by press "Add row" button and I can delete a row by UDO default menu("delete Row CtrlK"). My problem is why the default menu(Add Row CtrlI) don't work? May I write code for add a row by myself?
The other is
When I add menueven sub(catch menueven) in program ,my "Add row" buttom can't work normally. If I remove the menueven sub from my program, the "Add row" buttom work fine. Why? somebody help me.Hi Glen,
In my case, I developed own functionality to add row for a matrix.
I don't use 'add row' menu event actually.
And I don't know about menu event sub problems without any source code.
Regards,
Hyunil. -
Dear Experts,
How to activate the Data->Add Row, Delete Row for User matrix in user form
Regards,
Mathienable menuuid 1292 and 1293
Dim m_menus As SAPbouiCOM.Menus
Dim m_menuItem As SAPbouiCOM.MenuItem
m_menus = SBO_Application.Menus
m_menus = m_menus.Item("1280").SubMenus
m_menuItem = m_menus.Item("1292")
m_menuItem.Enabled = True
m_menuItem = m_menus.Item("1293")
m_menuItem.Enabled = True -
hello expert
i want to create add row functionality by right click event like in SAP B1 when we click on matrix colum it give menu for Remove,copy,add row in matrix how i do it by in my userdefiend form matrixHello,
If you enable the menu on your form Add row (menu id: 1292), Del Row (menu id: 1293 )it will automatically appear in right click .
copy should be added indivudally, and developed the functionality for each
enable them:
oForm.EnableMenu("1292", True)
oForm.EnableMenu("1293", True)
You can use MenuEvent to add/del/copy rows in the matrix or RightClickEvent
Regards,
J. -
Matrix multiple rows adding problem
Hi all,
In a SDK developed form, have a button "Add Row". When press Add Row a new row has to be added in the matrix.
I' ve written the set of codes as
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Dim oitem As SAPbouiCOM.Item
Try
If (FormUID = "Frm_itemsupplier") Then
If (pVal.Before_Action = False) Then
'Add Row
If (pVal.ItemUID = "AddRow") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then
Dim f As SAPbouiCOM.Form
Dim oMatrix As SAPbouiCOM.Matrix
f = SBO_Application.Forms.Item(FormUID)
oMatrix = f.Items.Item("mat1").Specific
f.DataSources.DBDataSources.Item(1).Clear()
oMatrix.AddRow(1)
End If
But at run time, when press Add row button first time this will add one row. Then I cancel the form, open the same form then press add row Button, 1+1 rows are adding in the matrix. If I do the above(cancel and open the form again), keep on increasing rows additionally on every time.
Let me get a solution how to solve the issue and I will be appreciated.
Thanks & regards,
Venkatesan g.try it as
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Dim oitem As SAPbouiCOM.Item
Try
If (FormUID = "Frm_itemsupplier") Then
If (pVal.Before_Action = False) Then
'Add Row
If (pVal.ItemUID = "AddRow") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then
Dim f As SAPbouiCOM.Form
Dim oMatrix As SAPbouiCOM.Matrix
f = SBO_Application.Forms.Item(FormUID)
oMatrix = f.Items.Item("mat1").Specific
f.DataSources.DBDataSources.Item(1).Clear()
Dim cell As SAPbouiCOM.Cell
Dim col As SAPbouiCOM.Column
Dim ed As SAPbouiCOM.EditText
col = omatrix1.Columns.Item(1)
cell = col.Cells.Item(1)
ed = cell.Specific
if ed.String <> "" then
oMatrix.AddRow(1,0)
end if
End If
this will test before addrow if there exist blank first row and in case that no, it will add new row. The sample test for column index 1 and first row.
Hope it`s what you need. -
Error when seelcting serial numbers - Matrix - invalid row number
When selecting serial numbers in the Inventory posting screen, we are getting the following error. can you please assist.
HDserialselection:0: Matrix - invalid row numberThe error message sounds like from Add-on, not B1. Do you have any add-on installed?
Thanks,
Gordon -
[Help]Grid (Add row - Delete row)
Hi experts. Just want to ask how can I add row and delete row in Grid?
And how can I get the data from the specific row so I can Save the data in my table.
Please help.Hi hikaru1207 ,
this code for delete row from Matrix :
Matrix oMatrix_cat = (Matrix)form.Items.Item("mtx_cat").Specific;
Delete Row -
for (int i = 2; i <= oMatrix_cat .rowcount; i++)
oEditText = (EditText)oMatrix.Columns.Item(colname).Cells.Item(i).Specific;
oMatrix.DeleteRow(i);
if (form.Mode == BoFormMode.fm_ADD_MODE)
if (oMatrix.RowCount == 0)
DBDataSource oDBDataSource = form.DataSources.DBDataSources.Item(table name);
oDBDataSource.Clear();
oMatrix_cat .FlushToDataSource();
Add row----
if (oMatrix_cat.RowCount == 0)
oMatrix_cat.AddRow(1, 1);
oDBDataSource_cat.InsertRecord(oDBDataSource_cat.Size);
else
oDBDataSource_cat.InsertRecord(oDBDataSource_cat.Size - 1);
oDBDataSource_cat.SetValue("LineId", oDBDataSource_cat.Size - 1, "");
oDBDataSource_cat.SetValue("U_SKU", oDBDataSource_cat.Size - 1, "");
oDBDataSource_cat.SetValue("U_CatId", oDBDataSource_cat.Size - 1, "");
oMatrix_cat.LoadFromDataSource();
oDBDataSource_cat = null;
please reply ......
yhanks
surajit -
Dear All,
I want to add right click add row and delete row on a matrix.can any one tell me the code.
Thanks
RajkumarHi
First enable add and delete menus. Then catch the before menu click event and write your add and delete code.
I have some problem with standard add and delete so i write custom function. I will give you some code samples.
<B1Listener(BoEventTypes.et_MENU_CLICK, True, New String() {"--your_form--"})> _
Public Overridable Function OnBeforeMenuClick(ByVal pVal As MenuEvent) As Boolean
Dim form As Form = B1Connections.theAppl.Forms.ActiveForm
'GENERATED CODE
If pVal.MenuUID = "1293" Then
form.Freeze(True)
DeleteMatrixRow(form) ' write your row delete logic in this function
form.Freeze(False)
Return False
ElseIf pVal.MenuUID = "1292" Then
form.Freeze(True)
InsertMatrixRow(form) '' write your insert row logic in this function
form.Freeze(False)
Return False
End If
Return True
End Function
Regards
Arun
Maybe you are looking for
-
How to change a faulty hard drive on MacBook Pro
The hard drive on my laptop is failing: overall performance has greatly diminished, the computer has slowed down, sometimes even crashing; looking at /var/ log messages, plenty of I/O error messages are building up. Added to this, the System Informa
-
Welches imovie für osx 10.7.5
Hi, do someone know what imovie is usefull for osx 10.7.5 and where I can get it from? Thanks for any help!
-
When I change a contacts name in my contact list, the name on the texts that I received from them before doesn't change. The new texts that I receive from them afterwards are the only ones with the current name. Is this just how nokia works or is the
-
Flash Builder 4.7 slows to the point of being unusable
I've read a few similar forum posts but haven't found any solutions that fix the problem. I've ramped up the mem usage in the ini file as discussed in this post http://forums.adobe.com/message/5237664#5237664, but this allows the mem to balloon way
-
Photoshop CS5 - OnOne PhotoTools round trip crashes post Lion upgrade
Any other OnOne PhotoSuite 5.5 and CS5 users out there seeing this? Problem Description: When I take an image in CS5 into OnOne's PhotoTools 2.6, make some adjustments and click Apply then upon its return to CS5 it will process the changes and then c