on 10-10-2008 7:56 AM
hi,
When ever i try to set value in itemcode in Purchase order it gives me a error saying
Item- Can,t set value on item because the item can't get focus[66000-153]
This is the code that i pass
GOD_Matrix.Columns.Item("1").Cells.Item(mc).Specific.value = CStr(rs.Fields.Item(0).Value)
Does any body know abt this error
Edited by: Pavana Punja on Oct 10, 2008 8:59 AM
This was because i was getting the data form cfl and trying to place it in Po but then po was not the active form cfl was the active form
so while placing data just ensure that this is the active form
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Before You write any values in the matrix cells, make sure that you have set value for Vendor in header part of PO.
first set the value for Vendor in edit text and try to write into matrix.
Sandeep.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi..
Use this code.
GOD_Matrix.Columns.Item("1").Cells.Item(mc).click(SAPbouiCOM.BoCellClickType.ct_Regular)
GOD_Matrix.Columns.Item("1").Cells.Item(mc).Specific.value = CStr(rs.Fields.Item(0).Value)
Regards,
Mahendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
In the case when you have this error: "Item- Can,t set value on item because the item can't get focus66000-153"
you need to put the focus to other cell, enabled cell.
Something what is ...
oForm.ActiveItem = "other_enabled_colum"
Or, try to enable column, set value, disable column.
This shoud work.
Regards
Sierdna S.
P.S. Founded of forum:
Matrix UID = 38
Column UID = 1 (ItemCode)
oForm.Items.Item("38").Specific.Columns.Item("1").Editable = True
oForm.Items.Item("38").Specific.Columns.Item("1").Cells.Item(i).Specific.Value
oForm.Items.Item("38").Specific.Columns.Item("1").Editable = False
Edited by: Sierdna S on Oct 10, 2008 10:13 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Place your code.
Regards
Sierdna S.
P.S. Working example:
Private Sub MakePricesForClient( _
ByRef pVal As SAPbouiCOM.MenuEvent, _
ByRef BubbleEvent As Boolean _
)
Dim oForm As SAPbouiCOM.Form
Dim oFormUDF As SAPbouiCOM.Form
Dim oMatrix As SAPbouiCOM.Matrix
Dim oEdit As SAPbouiCOM.EditText
Dim oColumn As SAPbouiCOM.Column
Dim oCell As SAPbouiCOM.Cell
Dim sSCardCode As String = ""
Dim sCCardCode As String = ""
Dim sItemCode As String = ""
Dim oRS As SAPbobsCOM.Recordset
Dim sPrice As String = ""
Dim sActive As String = ""
Try
oForm = SBOApp.Forms.ActiveForm
oForm.Freeze(True)
' ++++++++++++++++++++++++++++++++++++++++++++++
' Reading Parameters
' ++++++++++++++++++++++++++++++++++++++++++++++
' Supplier +++
oEdit = oForm.Items.Item("4").Specific
sSCardCode = oEdit.String
oEdit = Nothing
If sSCardCode.Equals("") Then _
Throw New Exception("Supplier code missing.")
' Client (UDF) +++
oFormUDF = SBOApp.Forms.GetForm("-142", 0)
oEdit = oFormUDF.Items.Item("U_CodCliDest").Specific
sCCardCode = oEdit.String
oEdit = Nothing
If sCCardCode.Equals("") Then _
Throw New Exception("Client code missing.")
oMatrix = oForm.Items.Item("38").Specific
' Check if matrix have rows...
If Not oMatrix.VisualRowCount > 0 Then Throw New Exception("Matrix is empty.")
' Search the prices
Dim i As Integer = 0
For i = 1 To oMatrix.VisualRowCount
' Item Code +++
Try
oColumn = oMatrix.Columns.Item("1")
oCell = oColumn.Cells.Item(i)
oEdit = oCell.Specific
sItemCode = oEdit.String
Catch ex As Exception
sItemCode = ""
Finally
oEdit = Nothing
oCell = Nothing
oColumn = Nothing
End Try
' Sql per la select +++
Dim sSQL As String = ""
sPrice = "0"
sActive = "N"
sSQL = " SELECT U_Price, U_Active " & _
" FROM [@MYPRCTABLE] " & _
" WHERE U_CODS = '" & sSCardCode.Trim & "'" & _
" AND U_CODI = '" & sItemCode.Trim & "'" & _
" AND U_CODC = '" & sCCardCode.Trim & "'"
oRS = SBOCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oRS.DoQuery(sSQL)
If oRS.RecordCount > 0 Then
oRS.MoveFirst()
If Not oRS.Fields.Item(0).Value Is Nothing Then
sPrice = oRS.Fields.Item(0).Value
sActive = oRS.Fields.Item(1).Value
End If
End If
If Not sActive.Equals("Y") Then sPrice = "0"
Try
oMatrix.GetLineData(i)
oEdit = oMatrix.Columns.Item("14").Cells.Item(i).Specific
oEdit.Value = sPrice
Catch ex As Exception
End Try
NEXT_LINE:
Next
Catch ex As Exception
' log exception
Finally
If Not oRS Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oRS)
oRS = Nothing
End If
oForm.Freeze(False)
System.GC.Collect() 'Release the handle to the table
End Try
End Sub
Hi
Verify if you added the rows...and for every row set all required values.
Try to call this function with many code lines and fix only what you need to check:
Private Sub Do_CheckIfWork( _
ByRef pVal As SAPbouiCOM.MenuEvent, _
ByRef BubbleEvent As Boolean _
)
Dim oForm As SAPbouiCOM.Form
Dim oMatrix As SAPbouiCOM.Matrix
Dim oEdit As SAPbouiCOM.EditText
Dim oColumn As SAPbouiCOM.Column
Dim oCell As SAPbouiCOM.Cell
Dim sPrice As String = ""
Try
sPrice = "100"
oForm = SBOApp.Forms.ActiveForm
'oForm.Freeze(True)
' CHANGE MATRIX UID (my is 38)
oMatrix = oForm.Items.Item("38").Specific
' Check if matrix have rows...
If Not oMatrix.VisualRowCount > 0 Then Throw New Exception("Matrix is empty.")
Dim i As Integer = 0
For i = 1 To oMatrix.VisualRowCount
Try
oMatrix.GetLineData(i)
' CHANGE COLUMN UID (my is 14)
oEdit = oMatrix.Columns.Item("14").Cells.Item(i).Specific
oEdit.Value = sPrice
Catch ex As Exception
End Try
Next
Catch ex As Exception
' log exception
Finally
'oForm.Freeze(False)
System.GC.Collect() 'Release the handle to the table
End Try
End Sub
Regards
Sierdna S.
Hi
Do you solved your problem with Items?
For your question...
I maked 2 screens and you can see what tax calculation comes automaticaluy:
- [Before applying the prices.|http://img352.imageshack.us/my.php?image=example01beforezu7.jpg]
- [After the application of prices.|http://img357.imageshack.us/my.php?image=example02afterlm7.jpg]
Best Regards
Sierdna S.
Hi Sierdna,
Thank for the time and effort
My problem is that i want all the item info to come from my code except tax amt which i want sap b1 to calculate.
I tried to put item code manually and taxcode by coding in this case the tax amt is calculated automatically but when item code,desc,whse code,qty,rate and taxcode comes from coding it does not calculate i tried removing the taxcode and again select the same taxcode manually in that case taxamt comes automatically and then saves it gives an error saying itemcode is not there even though itemcode exist I think that in the dbdatasource it is not updating
Hi Pavana Punja
I'm make a probe to add rows from vb code... It's work.
You only need to add the columns what do you think to set values: EditText, ComboBox, CheckBox,...
So.
I launch this code from context menu on Purchase Order and it is only an example.
this code don't give errors.
oForm.Freeze(True)
...
oMatrix = oForm.Items.Item("38").Specific
If do_test(oMatrix) Then
oForm.Refresh()
End If
...
oForm.Freeze(False)
Private Function do_test(ByVal oMatrix As SAPbouiCOM.Matrix) As Boolean
Dim oEdit As SAPbouiCOM.EditText
'Dim oColumn As SAPbouiCOM.Column
'Dim oCell As SAPbouiCOM.Cell
Try
Dim k As Integer = 0
For k = 1 To 3
oMatrix.AddRow()
Dim i As Integer = oMatrix.RowCount - 1
' Item Code
oEdit = oMatrix.Columns.Item("1").Cells.Item(i).Specific
oEdit.Value = "0320035030"
' Qty
oEdit = oMatrix.Columns.Item("11").Cells.Item(i).Specific
oEdit.Value = 23 + k
' Price
oEdit = oMatrix.Columns.Item("14").Cells.Item(i).Specific
oEdit.Value = 2 + k
' Discount
oEdit = oMatrix.Columns.Item("15").Cells.Item(i).Specific
oEdit.Value = 10 + k
Next
Return True
Catch ex As Exception
Dim s As String = ex.Message
Return False
Finally
oEdit = Nothing
End Try
End Function
Regards
Sierdna S.
Hi..
I face same problem,this not a error no need to worry
follow this way
Try
dim stsr as string
oEdit = oMatrix.Columns.Item("Column-ID").Cells.Item(i).Specific
oedit1.Value = stsr
Catch ex As Exception
end try
Regards...
Billa 2007
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
97 | |
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.