cancel
Showing results for 
Search instead for 
Did you mean: 

Set Value in Itemcode in Purchase Order Form

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi

So it's work

I thought that the list of items is taken from a list of sampling.

Ok

Regards

Sierdna S.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Mahendra,

Ths is not working i have tried it earlier also

Regards,

Pavana Punja

Former Member
0 Kudos

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

Former Member
0 Kudos

hi

Its not working that way

Regards,

Pavana Punja

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi i require 1 help

Can u check this with taxcode in po and see whether the tax calculation comes automatically

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi

I know this solution but then in this case it does not set the item desc automatically

Former Member
0 Kudos

Hi..

Bind column(data bound=True)

Regards...

Billa 2007

Edited by: Billa 2007 on Oct 10, 2008 12:56 PM

Former Member
0 Kudos

hi

I am trying in Item Code in matrix

actually in item code i can even set the item desc manually

because if i get itemcode i can know desc also but when i try to set tax code i what it to calculate tax amt automatically because i can't get tax amt to set it manually

Former Member
0 Kudos

hi

can u give me the code of how to bind po matrix itemcode

Former Member
0 Kudos

Hi...

ur using system form or userdefined form

Regards...

Billa 2007

Former Member
0 Kudos

hi

I am using system form purchase Order

Former Member
0 Kudos

Hi..

system form tax calculation take from automatically.

Regards...

Billa 007

Former Member
0 Kudos

Hi

when i try to set tax code through my code it gives the same error

item -Can't set value on item because the item can't get the focus [66000-153]

when i try to put try and catch it set the tax code but then the tax amt is not calculated automatically

this is the problem

Regards,

Pavana Punja