on 05-17-2006 1:48 PM
Hi,
I would like to default the tax code field in the matrix on the right side of the BP addresses tab when the user clicks the "define new" option on the left matrix for a ship to address. The user wants the value to default to the entry they enter most commonly.
Select Case pVal.EventType
Case Is = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
Select Case pVal.ItemUID
Case Is = "69"
'Detect user pressed "Define new" - shipping address
If pVal.ColUID = "20" And pVal.Row = 5 And Not pVal.BeforeAction And _
pVal.ActionSuccess Then
Dim oitem As SAPbouiCOM.Item
'g_SBOFORM is class that encapsulates SBO system form
oitem = g_SBOForm.Items.Item("178")
Dim oMatrix As SAPbouiCOM.Matrix = oitem.Specific
Dim oEdit As SAPbouiCOM.EditText
oEdit = oMatrix.Columns.Item("12").Cells.Item.(1).Specific
oEdit.String = "0" 'tax code (exempt)
Problem 1: I the "define new" constant that B1 provides
will not always be column 20, since many addresses may appear above it. How do I determine if the column they press is "Define New" for ship-to's?
Problem 2: the update of oEdit.String fails with a message that says the item is not editable. Am I hitting the wrong field, or am I really not able to default ANY of the address information when a new ship-to is about to be added?
I'm very grateful for any help you can offer!
Hi Jhon,
For problem 1, column is allways the same, but you can´t determine which row is the "define new" one. I think you should use the String value to compare it with "Define New". Something like:
If pVal.ColUID = "20" And And Not pVal.BeforeAction And _
pVal.ActionSuccess Then
'Supposing oItem is item 69.
Dim oMatrix As SAPbouiCOM.Matrix = oitem.Specific
Dim oEdit As SAPbouiCOM.EditText
oEdit = oMatrix.Columns.Item("20").Cells.Item.(pVal.Row).Specific
If oEdit.String = "Define New"
'Do what you need.
Endif
Endif
For problem 2, I don´t know what field you are talking about. We haven´t got any tax field in the BP addresses right side (2004A). Isn´t it a user defined field??
Regards,
Ibai Peñ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Update on this problem:
The tax code field (or any of the fields on the right-hand matrix where ship-to/bill-to addresses) can not be altered by a program or the user until the name field has had something entered into it. If I wait until the name field lose focus then I can load any of the fields.
The question now is, how do I determine which column in matrix 69 on the address pane represents the "Define New" for the ship-to group?
I'm trying to loop through the cell objects & display the titles, but it seems to be showing the titles for the right-hand matrix (item 178).
oitem = g_SBOForm.Items.Item("69")
Dim oMatrix As SAPbouiCOM.Matrix = oitem.Specific
Dim ocol As SAPbouiCOM.Column
For x As Short = 0 To oMatrix.Columns.Count - 1
Try
ocol = oMatrix.Columns.Item(x)
Dim ocell As SAPbouiCOM.Cell = ocol.Cells.Item(1)
Console.WriteLine("title: " & ocol.Title.ToString)
Console.WriteLine("title object: " & ocol.TitleObject.Caption.ToString)
Catch ex As Exception
End Try
Next
any ideas
Hi John,
The only visible column for the 69 matrix is the 20th one. So your code is not OK. Should be something like:
oitem = g_SBOForm.Items.Item("69")
Dim oMatrix As SAPbouiCOM.Matrix = oitem.Specific
Dim ocol As SAPbouiCOM.Column
ocol = oMatrix.Columns.Item(20)
For x As Short = 0 To ocol.Cells.Count - 1
Try
Dim ocell As SAPbouiCOM.Cell = ocol.Cells.Item(1)
'Do what you need.
Catch ex As Exception
End Try
Next
Hope helps,
Ibai Peñ
User | Count |
---|---|
103 | |
14 | |
10 | |
5 | |
4 | |
3 | |
3 | |
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.