cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the value in a matrix...

RamBilasYadav
Participant
0 Kudos

Hi,

I want to update the price field in the Sales Order matrix. This I want to do as soon as the user selects the Item from the choose window. I trapped the ItemEvent of the SAPSBOUIApplication. But after getting the control of the matrix I am unable to see or edit the value in it. Please guide me how to do it? More better it would be if any one can explain me with one sample on how to insert our own logic in the existing flow of any transaction and modify values as per our new logics.

Thanx in advance.

With Regards,

Ram.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184566
Active Contributor
0 Kudos

Hi Ram Bilas Yadav

You want an example, an example you will get, try the following, it will work on a AR invoice, once you have selected a value in the choose from list for itemcode it will then assign a value in the price column.

If pVal.FormType = "133" Then 'And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED Then

If pVal.ColUID = 1 And pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS And pVal.BeforeAction = False Then

Try

Dim omatrix As SAPbouiCOM.Matrix

Dim oColumn As SAPbouiCOM.Column

Dim oColumns As SAPbouiCOM.Columns

omatrix = SBO_Application.Forms.Item(FormUID).Items.Item("38").Specific

oColumns = omatrix.Columns

Dim oEdit As SAPbouiCOM.EditText

oEdit = oColumns.Item("17").Cells.Item(pVal.Row).Specific

oEdit.Value = 12

Catch ex As Exception

MsgBox(ex.Message)

End Try

End If

End If

Hope this helps

RamBilasYadav
Participant
0 Kudos

Hi Louis,

Thank you so much for the code. I checked it, its working. Can this be done as soon as I have clicked the Choose button from the Choose window list. Because, currently since your code is using the lost_focus event it gets executed only after the user clicks on any other column.

With Regards,

Ram.

former_member184566
Active Contributor
0 Kudos

Hi

You most probably could, you would have to check for both the click on choose or the double click on the matrix. Could become tedious. id suggest doing it on lose focus because in my experience many users will type the code in sometimes especailly if it is something they frequently sell. So this way take care of both scenarios.

Hope this helps

RamBilasYadav
Participant
0 Kudos

I am getting the following error in VB.

Err Number = -3006

Err Description = 'Form - Invalid Form Item'

The following is the code I am using for trapping the sales order form (139)

Case et_LOST_FOCUS:

If pVal.ColUID = "1" And pVal.FormType = 139 Then

Set sMat = SBO_Application.Forms.Item(FormUID).Items.Item("38").Specific

Set sCol = sMat.Columns

Set sEdt = sCol.Item(16).Cells.Item(pVal.Row).Specific

sEdt.Value = 99

End If

-


What could be the reason? where am I going wrong ???? when I tried ur code for AR Invoice, its working fine, but when I am running the above for Sales order form its throwing error while the line sEdt.Value = 99 is being executed.

Regards,

Ram.

barend_morkel2
Active Contributor
0 Kudos

Ram,

Each form has a unique type

Sales Order is 139

But Invoice is 133

You have to check and apply the logic to each form you are interested in.

To check the form type go to View - Debug information in the SBO client... (the form type will be displayed in the status bar at the bottom of the screen)

RamBilasYadav
Participant
0 Kudos

Barend,

The unique type for sales order is 139 only.

RamBilasYadav
Participant
0 Kudos

I checked the 'Editable' property of the Price Column in (column no 16), its 'False'. I think thats why its giving me the error. What can be the work around in this case.

barend_morkel2
Active Contributor
0 Kudos

Ram,

You can set the editable property to True and then try and fill the values into that column