Matrix row focus
Hey All,
Can anyone tell me how I can set the focus of my matrix to the most recent row that was added to my UDO? I have a UDO that could have a few hundred line items and I want to move the screen to the most recent line item so that the user does not have to scroll all the way every time they open the record?
If this is not possible does anyone know how I can reverse the order of the line items in the matrix based on the docentry or date or something like that?
> Can anyone tell me how I can set the focus of my
> matrix to the most recent row that was added to my
> UDO? I have a UDO that could have a few hundred line
> items and I want to move the screen to the most
> recent line item so that the user does not have to
> scroll all the way every time they open the record?
This should do it:
oMatrix.Columns.Item("colUid").Cells.Cell.Item(rowIndex).Click(BoCellClickType.ct_Regular,0)
If you can't get it working for a normal cell, do it for the rowsheader and set the matrix so rows can be selected (BoMatrixSelect.Single)
> If this is not possible does anyone know how I can
> reverse the order of the line items in the matrix
> based on the docentry or date or something like that?
Can't be done... sorry... Matrix sorting is (still) not supported... Rumors is that it will be supported from SBO2006A (But it was also a rumor for SBO2005A )
Similar Messages
-
Another Delete matrix row thread
I have read some threads with Q&A on the delete matrix row subject but I cant make it work properly. Deleted rows have a tendency to return.
I first tried to make my own:
If pVal.MenuUID = "RmLine" And pVal.BeforeAction = True Then
Set oMatrix = m_oForm.Items("MatrixM").Specific
i = 1
While i <= oMatrix.RowCount
If oMatrix.IsRowSelected(i) Then
If oMatrix.RowCount = 1 Then
oMatrix.AddRow
End If
oMatrix.DeleteRow i
m_oForm.DataSources.DBDataSources("@ITCCR_DM").Clear
oMatrix.LoadFromDataSource
m_oForm.Mode = fm_UPDATE_MODE
End If
i = i + 1
Wend
End If
Problem here is that I cant remove last row without having it return right after.(Thats why I tried the addrow)
Then I tried using SAP's function:
m_oForm.EnableMenu "1293", True
But as soon I hit "Update" the row returns so what do I need to add to the menu event to make it work?I use the two following standard methods for add and delete of rows... so far no problems with them (½ a year)
(Please not that I've have wrapped the entire UI for faster use, so not every method in here are core SDK, but hope you get the idea for the approach)
public int Add(B1ItemEvent pVal,B1DBDatasource Dbds, bool SwitchToUpdateMode, string ColumnToSelect) {
InnerMatrix.FlushToDataSource();
if(Dbds.GetValue_String(0,0)!="" || InnerMatrix.RowCount!=0) {
Dbds.InsertRecord(Dbds.Size);
Dbds.SetValue_String(0,Dbds.Size-1,"");
InnerMatrix.LoadFromDataSource();
InnerMatrix.Update();
if(SwitchToUpdateMode) {
if(pVal.IsFormModeOK) {
InnerForm.SwitchToUpdate();
InnerMatrix.Columns[ColumnToSelect].Focus (InnerMatrix.RowCount);
return Dbds.Size-1;
public bool RemoveSelected(B1ItemEvent pVal, B1DBDatasource Dbds, bool SwitchToUpdateMode, string WarningIfNoRowsSelected) {
InnerMatrix.FlushToDataSource();
int row = InnerMatrix.GetNextSelectedRow(0,BoOrderType.ot_RowOrder);
if(row!=-1) {
InnerForm.Freeze(true);
while(row != -1) {
InnerMatrix.DeleteRow(row);
if(InnerMatrix.RowCount==0) {
Dbds.BlankRecord(0);
row = InnerMatrix.GetNextSelectedRow(0,BoOrderType.ot_RowOrder);
InnerForm.Freeze(false);
InnerMatrix.FlushToDataSource();
InnerMatrix.Update();
if(SwitchToUpdateMode) {
if(pVal.IsFormModeOK) {
InnerForm.SwitchToUpdate();
return true;
else {
Notification.Statusbar_Warning (WarningIfNoRowsSelected);
return false; -
Hi
I have been observing that my matrix row deleted before executing my code for delete the matrix row. I write my code in BeforeAction=False and I use the menu id to delete the row in matrix.
Some code snap
If pval.BeforeAction = False Then
Select Case pval.MenuUID
Case MenuID.Add_Row
BubbleEvent = Me.AddRow
Case MenuID.Delete_Row
BubbleEvent = Me.DeleteRow
Case MenuID.Duplicate_Record
'oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE
End Select
Else
And My Delete Row logic is
Private Function DeleteRow() As Boolean
If iRow <= 0 Then
Return False 'If no row selected
End If
'oSIONMstDtl = oForm.DataSources.DBDataSources.Item("@INCM_SIONDTL")
oExeMatDtl.Clear()
Try
oMatrix = oForm.Items.Item("MtxExeMat").Specific
oMatrix.DeleteRow(iRow)
' oForm.DataSources.DBDataSources.Item("@INCM_SIONDTL").RemoveRecord(iRow)
Catch ex As Exception
MsgBox(ex.Message)
End Try
For i As Integer = oMatrix.RowCount To 1 Step -1
oEdit = oMatrix.Columns.Item("ColSr").Cells.Item(i).Specific
oEdit.Value = i
oMatrix.GetLineData(i)
Next
If oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE Then
oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
End If
Return False
End Function
Edited by: Manmath Das on Feb 10, 2010 1:26 PM
Edited by: Manmath Das on Feb 10, 2010 1:28 PMI use this code in deleting row. and it works fine in all may addon. I use C# in my development.
public virtual void menuevent(string FormUID, ref SAPbouiCOM.MenuEvent pVal, ref bool BubbleEvent)
if (pVal.BeforeAction)
switch (pVal.MenuUID)
case "1293": // deleterow
ondeleterow(is_CurrentMatrixUID, il_CurrentMatrixRow, ref BubbleEvent, false);
break;
public override void ondeleterow(string matrixuid, int row, ref bool BubbleEvent, bool innerevent)
base.ondeleterow(matrixuid, row, ref BubbleEvent, innerevent);
int li_rowcount;
SAPbouiCOM.Matrix oMatrix;
GC.Collect();
oForm.Freeze(true);
oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item(matrixuid).Specific;
oForm.DataSources.DBDataSources.Item("@FAIAC1").RemoveRecord(row - 1);
oMatrix.DeleteRow(row);
li_rowcount = oMatrix.RowCount;
for (int li_row = 1; li_row <= li_rowcount; li_row++)
setColumnString(matrixuid, "LineId", li_row, li_row.ToString());
oForm.Freeze(false);
BubbleEvent = false;
Hope this will help you.
Regards
John Wilson de los Santos -
Can't catch the matrix row for Deleting Rows
Hi,
I've already read related topics but couldn't solve the problem.
I catch the Delete Row menu event 1293, but then I can't save the deleted row in an array since it's no longer listed as a selected row.
All the matrix rows return
oMatrix.IsRowSelected(i) = False after catching that 1293 event.
Trying BeforeAction True or false didn't solve that problem.
What am I missing ?
Güit sounds like a bug.
here is workaround: in oMatrix-itempress event try to store selected rowIndex in your variable - so, when you catch 1293-menuEvent you'll know which row you should save - it'll be value of your variable. -
Hello,
My form is in ADD Mode and i'm deleting some rows from it thru my code using the following code:
matItems = SBO_Application.Forms.ActiveForm.Items.Item("38").Specific
matItems.DeleteRow(intMatRow)
Now,
This deletes the row at intMatRow, but the matrix row numbers do not reset as they do when we select and delete a row manually.
For. eg.: if there are 3 rows in my matrix and i delete the first row, then the row numbers remain 2 and 3 for the remaining rows.
I want them to change to 1 and 2 as there are only 2 rows now.
Please help me with this.Hi Rohan
try This
in menu event pval before action false
If pVal.MenuUID = "1293" Then
If objForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then
For intCurrentRow = 1 To objMatrix.VisualRowCount
objMatrix.Columns.Item("V_-1").Cells.Item(intCurrentRow).Specific.Value = intCurrentRow
Next
End If
End If
in item event for any validation regarding matrix use visualrowcount
ex code:
If objMatrix.Columns.Item(1).Cells.Item(objMatrix.VisualRowCount).Specific.Value = "" Then
Call objMain.objUtilities.MatrixDeleteRow(FormUID, "11", objMatrix.VisualRowCount)
End If
Rgds
Micheal
Edited by: micheal willis on Aug 11, 2009 8:06 PM -
Udo matrix rows saving problem
Hi,
i am creating a form by using UDO form generator.
in that documet and doucument rows are existed. if user select the combobox value from the form, by taking that value and i am generating a query, i am generating a recordset. by using Userdatasources i am binding each column in matrix.
i binded all values to the matrix successfully. but
but when i press Add button, this matrix rows are not getting saved. and also if i have two rows, when i press add, in database only one row is adding with NULL values. how to save that matrix data?
i am sending my code here. plz help me
ds = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
ds.DoQuery("select a.code as Code,b.Itemname as Desc1,a.quantity as Quantity from itt1 a,oitm b where a.code=b.Itemcode and a.code=' " & oComboBox.Selected.Value & ' "")
'User datasources creation
oForm = SBO_Application.Forms.Item("TBL_JOBWORK_")
oUserDataSource = oForm.DataSources.UserDataSources.Add("dsItemcode", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 40)
oUserDataSource = oForm.DataSources.UserDataSources.Add("dsItemdesc", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 40)
oUserDataSource = oForm.DataSources.UserDataSources.Add("dsQuantity", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 40)
ds.MoveFirst()
oForm = SBO_Application.Forms.Item("TBL_JOBWORK_")
oItem = oForm.Items.Item("mtx_0")
oMatrix = oItem.Specific
oColumns = oMatrix.Columns
Dim oColumn1 As SAPbouiCOM.Column
Dim oColumn2 As SAPbouiCOM.Column
Dim oColumn3 As SAPbouiCOM.Column
' Dim oColumn4 As SAPbouiCOM.Column
oColumn1 = oColumns.Item("col_0")
oColumn2 = oColumns.Item("col_1")
oColumn3 = oColumns.Item("col_2")
' oColumn3 = oColumns.Item("col_3")
While Not ds.EoF
oMatrix.FlushToDataSource()
oForm.DataSources.UserDataSources.Item("dsItemcode").Value = ds.Fields.Item("Code").Value
oColumn1.DataBind.SetBound(True, "", "dsItemcode")
oForm.DataSources.UserDataSources.Item("dsItemdesc").Value = ds.Fields.Item("Desc1").Value
oColumn2.DataBind.SetBound(True, "", "dsItemdesc")
oForm.DataSources.UserDataSources.Item("dsquantity").Value = ds.Fields.Item("Quantity").Value
oColumn3.DataBind.SetBound(True, "", "dsQuantity")
oMatrix.AddRow()
ds.MoveNext()
End While
plz help me any suggesions. in that. i want to save that matrix data in to tables. plz help me urgent asap
regards,
nagababu.Hi,
UDOs don't save data from UserDataSources (UDS) (and BTW: your code is wrong: you mustn't bind the UDSs to to columns time after time in the loop; that's just wrong). YOu have to handle such data in your code.
Regards,
Frank -
Hi Expert, Matrix row enable false
Hi ,
I Want to enable false matrix row for my some condition.
If u have any idea share with me.
thanks in adva.
Regards
Rajkumar GuptaHi Rujkumar,
You need to catch the GotFocus ItemEvent, for the matrix, and in the pVal.BeforeAction, check if the row should be enable or not. If it should not be enabled, you cancel the event (GotFocus) by setting BubbleEvent = False.
Regards,
Vítor Vieira -
Hi
I have a UDForm whith a Matrix in it.
And i need to close the matrix row's as sales order
are generated for the row data 1 sale order per row
like for example a sales order when it is pratialy ivoiced
Can i dataBind the row status to a UDF in a UDT
some thing like the LineStatus in the RDR1 system table 'Sales Order lines'
Thanks for any help you can provied
Pedro GomesIf you mean that you want to gray out (disable) a line in a matrix, then I would say that it is not possible. But you can catch events on the matrix and prevent editing of your closed lines (if you forsee a 'state' field in your UDT).
Maybe you can do something with the grid object, and use the collapselevel to visualize the difference between closed and open lines.
regards,
Jurgen -
Get matrix row data and put it into header field with formatted search ???
Hi All,
I ask your help concerning the following:
On an invoice matrix I want to check all Itemgroup Codes of all items in the rows, if there are some rows' items with ItemGroupcode 101 and some others with anything else, then header field should be Y, otherwise N.
My main problem is: how do I put a matrix row data to a header data with checking all rows in the matrix?
A minor problem is that I can't get the formatted search to work on all rows when the formatted search is assigned to the user field in header.
If I put the formatted search to a row field then the row field is filled with the proper value, but the same query assigned to the user field in header works only on the first row.
What am I doing wrong?
SELECT USEDPROD= CASE T0.ItmsGrpCod WHEN 101 THEN Y ELSE N END FROM .[OITM] T0 WHERE T0.ItemCode = $[$38.1.0]
(SBO 7.6)
Any suggestions are welcome.
Thanks.
BálintDear Adele,
Thanks for the answer. The major one cannot be solved. OK, I'll try to get a workaround.
However I still do not understand why my query does not work in all selected rows, just in the first row, i.e. if I assign the query to a header field and I'm positioned in the first row it's OK, but when I add a new item to the second row or any of the next rows, the header field is not updated at all.
Why is that so? Do you have any idea?
Bálint -
Can't delete matrix row in UDO form
Hi all,
i have a problem. I've already searched the forum and found a couple of solutions, but they didn't work.
I can't delete a matrix row. I'm on patch level 39, i've read that patches from 32 to 38 gave some problems with matrix row delete.
Any one has notice regarding same problems with patch 39?
I post the code i'm using for the delete.
matrix.FlushToDataSource()
dbDataSource.RemoveRecord(row - 1)
matrix.LoadFromDataSource()
UIForm.Update()
'Removes the change trace row
changeTrace.RemoveAt(row - 1)
UIForm.Mode = BoFormMode.fm_UPDATE_MODE
Thanks in advanceHi,
I'm using PL39 and I can delete rows in matrix (you are right in previous patch there was an error, and it´s imposible to delete rows). I saw the code you put and I doesn´t undestand what you are trying to do. I explain what I do:
- I enable the menu 1293 to delete row in a matrix, in the menu event i put the following code
Dim oMtx As SAPbouiCOM.Matrix =
oMtx.FlushToDataSource()
This works for me. -
Greetings All,
Does anyone know how i can check if a matrix row is enabled or disabled prior to updating the field? I need to know because my add on is throwing an exception stating invalid form item if the matrix row is disabled.
Any ideas?Hi Curtis
I'm not aware if you can make a row enabled or disabled...never seen it. I know you can make a whole matrix enabled or disabled. Also if you want an extra line in the matrix you add a extra one and that then becomes available. When you say disabled is this when you haven't said you want an extra row and it doesn't allow to add the row details?
Well, to check if a matrix is enabled you do something like
Dim item As SAPbouiCOM.Item
item = oForm.Items.Item("matrixID")
If item.Enabled = False Then item.Enabled = True
Then to see how many records are in your matrix use
oMatrix.RowCount
It will return the number of records in the matrix. But remeber if its your own matrix you should always add a line omatrix.addrow before specifying the row contents.
Hope this helps -
Matrix actions and linking the Matrix-row to some fields
Hello every One,
I would like to have the following "action" ! I have a Form where i puted 2 edit fields and 1 matrix (Screen Painter), the matrix shows me the first and lost name of the Employee ( just an exp.).
What i would like to do is to send these datas to the edit fields every time i choose another row. i cannt find any itemEvent for the raws to select the record in the data base and to bind it to the edit Fileds! is this a good way to do it ??
Thank You for every helpHi Amir
You can use the et_GOT_FOCUS event to check for focus on the Cells of the Matrix. I recommend using et_GOT_FOCUS because this will facilitate mouse and keyboard navigation.
When you capture the event on the Matrix check the pVal.Row to get the row that received the Focus. Using this Row index retrieve the data from the Matrix and set the values for the required edit fields.
<i>Remember to include event et_GOT_FOCUS in your EventFilters</i>
<b>Event Handeling Example:</b>
If pVal.BeforeAction = False Then
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_GOT_FOCUS Then
'IDH_MTR - Matrix Item
If pVal.ItemUID = "IDH_MTR" Then
Dim oMatrix As SAPbouiCOM.Matrix
oMatrix = oForm.Items.Item("IDH_MTR").Specific
'Work with the DataSources of the
'Edit Fields to avoid triggering the
'Focus events again.
' * ED1 and ED2 is the DataSources for the
' Edit Fields
' * Column(1) And Column(2) contains the data
' that will be copied to the edit fields
oForm.DataSources.UserDataSources.Item("ED1").Value = oMatrix.Columns.Item(1).Cells.Item(pVal.Row).Specific.Value
oForm.DataSources.UserDataSources.Item("ED2").Value = oMatrix.Columns.Item(2).Cells.Item(pVal.Row).Specific.Value
End If
End If
End If
I hope this will help -
Restricitng activity in a Matrix row
Good Afternoon
Experts:
I have spent a 1/2 day so far trying to figure out how to restrict any activity in a row based on a value in a cell of that row. Unfortunately, it appears I have met my match on this one.
<b>Application Scenario:</b>
1)Material Requisition Line gets converted to a PO
2)Status of that Line in the Matrix for that Material Requisition gets changed
to "Conv"
<b>Required Behavior:</b>
No activity can happen in a row that has a Status = "Conv"
I went through all of the Events that appeared like they may help...Got_Focus, Validate, Combo_Select etc. Then I sat back and thought...well I cannot afford to try and account for all possible activity intiation for all the cells of a row. I need
some "big picture" way to "disable"(I know there is no official row disable) a row if the status of the row = "Conv"
I suspect I may have to do it in the ItemEvent of the screen. In English, if ItemEvent is on the Item "mtxMat" and pVal.row Status = "Conv" then don't allow any changes. I tried that for a bit and the BeforeAction True/False was giving me trouble.
Does anyone see something that I can try?
Thanks,
EdGood Morning
After coming across a few posts about diasabling rows in a Matrix, I thought perhaps I was on to an idea. However, I am interested in documentation on how SAP processes EventTypes. For example, when someone clicks a cell or tabs into a row, what order of events are processed...Focus, Validate then Click?
How can I find out?
Thanks,
Ed -
How can i know which cell is focused on the matrix??
I know but if cell has focus, getting row will return row where is this cell selected, and ColUID will return column where is the cell, so if You use my code, it will work.
if (pVal->EventType==et_GOT_FOCUS && pVal->ItemUID== L"MatrixUID" && pVal->ColUID==L"ColUID")
long MyCell;
MyCell= pVal->Row;
SAPbouiCOM::IEditTexPtr edt;
edt = Matrix->Columns->Item(L"ColUID")->Cell->Item(MyCell)->GetSpecific();
By this code, You have handle in "edt" to the cell with focus.
Message was edited by: Kamil Wydra
Of course You must have handle to matrix.
Message was edited by: Kamil Wydra -
How to calculate a percentage in a Matrix row SSRS
HI All,
I have the following data in a SSRS Matrix. I want the data to reflect as 'B' but I constantly get data reflected as a total.(C)
I need the percentage per row and not the whole total value.
this is my expression =count(Fields!Rejection_Reason.Value)/sum(Fields!ClaimCount.Value, "DataSet1")
A
Dealer
Total Sold
VW
Mercrcedez
Honda
Dealer1
10
2
5
3
Dealer2
20
5
10
5
Dealer3
30
10
5
15
B
Dealer
Total Sold
VW
Mercedez
Honda
Dealer1
10
20.00%
50.00%
30.00%
Dealer2
20
25.00%
50.00%
25.00%
Dealer3
30
33.33%
16.67%
50.00%
C
Dealer
Total Sold
VW
Mercedez
Honda
Dealer1
10
3.33%
8.33%
5.00%
Dealer2
20
8.33%
16.67%
8.33%
Dealer3
30
16.67%
8.33%
25.00%
60
Thank you for your help.Hi Andrevw23,
Just as michlimes suggested, we should sum the value of ClaimCount field in the Dealer group region, other than the dataset. Because the sum function sum all non-null numeric values in the specified scope. So in your scenario, we can try to use the function
below to achieve your requirement (“Dealer” means the name of Dealer group):
=count(Fields!Rejection_Reason.Value)/sum(Fields!ClaimCount.Value, "Dealer")
If you have any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support
Maybe you are looking for
-
Communication problem with FP-2000 and Labview 7.1
I am using the FP-2000, DO-403 and TC-120 modules with Labview 7.1, being run on a host computer via an ethernet connection. The setup has operated flawlessly for ~2 years; recently, I have noticed that while a VI is running on my PC, connection to
-
Hi, I am using the same sapscript form to print checks using f-58 on 2 different versions of SAP. The problem is that in one version it prints only the 1st vendor invoice while in the other all the selected vendor invoices are printed. In the debug m
-
My FI (6248s) have 4 link-connections to IOM (2208XP) and the chassis discovery has been done. The above links are configured as server ports. So, do we leave them as individual server ports or do we use portchannel on the FI and IOM? In other words
-
Break Point in Smartforms.
Hi All, Please tell me how to put break point in Smartform using the break point statement. Thanks, Neethu.
-
Can I just isynch my phone numbers from my mobile without uploading?
Hi, i just want to download the phone numbers on my mobile as a backup, I don't want to upload all my contacts, is that possible? thanks