on 09-16-2008 1:36 PM
hi,
when selecting vendor i set the vendor code and vendor name like purchase order using CFL but i getting error-
Item - Can't set value on item because the item can't get focus. [66000-153]
Awaiting soon reply
Rajkumar Gupta
Hello Rajkumar Gupta ,
Your message is not very clear to understand, maybe you could post some sourcecode.
I think the focus is not on the item or is on the other (CFL) form...
or maybe your item isn't enabled...
Post some code to get better answers
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
maybe you try to set the EditText.Value or .String on the CFL-Event?
This is what I do on a CFL-Event "Not BeforeAction" (also a DbDataSource and on a User defined form(!)) :
'### ChooseFromLists
'#
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
Dim oCflEvent As SAPbouiCOM.IChooseFromListEvent
Dim oCfl As SAPbouiCOM.ChooseFromList
Dim oDataTable As SAPbouiCOM.DataTable
Dim cflID As String
Dim cflValBefore As String = ""
oCflEvent = pVal
cflID = oCflEvent.ChooseFromListUID
'Dim oForm As SAPbouiCOM.Form
'oForm = SboConnection.SboUI.Forms.Item(FormUID)
oCfl = oForm.ChooseFromLists.Item(cflID)
If Not oCflEvent.BeforeAction Then
oDataTable = oCflEvent.SelectedObjects
If oDataTable Is Nothing Then Exit Sub
If cflID = "CFL_BPNO" Or cflID = "CFL_BPNOB" Then ' Bus.-partner - for both: CFL-EditText and CFL-Button
'### Setting the selected values in the form:
'#
cflValBefore = oDbDs.GetValue("U_CardCode", oDbDs.Offset)
oDbDs.SetValue("U_CardCode", oDbDs.Offset, oDataTable.GetValue("CardCode", 0))
'# setting additional fields:
oUds.Item("UDS_BPNAME").ValueEx = oDataTable.GetValue("CardName", 0)
' Set the DBDataSource (not EditTextValue - but this does not change the FormMode if needed):
oDbDs.SetValue("U_SlpCode", oDbDs.Offset, oDataTable.GetValue("SlpCode", 0))
' Set the FormMode by code but I don t wanna UpdateMode when the same BP is selected again:
If oForm.Mode != SAPbouiCOM.BoFormMode.fm_ADD_MODE Then _
If cflValBefore != oDbDs.GetValue("U_CardCode", oDbDs.Offset) Then oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
'#
'###
ElseIf cflID = "CFL_SLPCOD" Then ' SlpCode - only a CFL-Button for the SlpCode-Combo
cflValBefore = oDbDs.GetValue("U_SlpCode", oDbDs.Offset)
oDbDs.SetValue("U_SlpCode", oDbDs.Offset, oDataTable.GetValue("SlpCode", 0))
If oForm.Mode != SAPbouiCOM.BoFormMode.fm_ADD_MODE Then _
If cflValBefore != oDbDs.GetValue("U_SlpCode", oDbDs.Offset) Then oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
End If
End If
End If
'#
'####
Edit: Changed < and > to "!=" because "<>" it is not visible in this forum
Maybe replace "!=" with less and greater symbol
Edited by: Roland Toschek on Sep 17, 2008 3:01 PM
Hi Rajkumar Gupta,
my problem is that it's difficult for me to find a simple example because I've wrapped many standard-SDK-things (like CFL...) into my own standard functions.
In the following example the MTX-Columns are bound to UserDataSources:
Adding the CFL to a MTX-column is the same as for an EditText - just replace the EditText-Object with your CFL-Column
The CFL-EventHandler is the same as above. Just adapt the bottom If..then construction. In principle the only difference is that you must additionally evaluate the oCflEvent.Row-property.
The AddServiceItem-Sub is a little bit oversized for an example but I can't find anything better at the moment:
If cflID = "CFL_ITNO1" Or cflID = "CFL_ITNO2" Then
AddServiceItem(oDataTable.GetValue("ItemCode", 0), oCflEvent.Row, 1.0)
End If
'### Handling for MTX_SRV (Service-Matrix)
'#
'### Adds an item to MTX_SRV (at (not before) CFL)
Private Shared Sub AddServiceItem(ByVal ItemCode As String, ByVal MtxRow As Integer, ByVal Quantity As Double)
Try
'Dim Quantity As Double = 1.0
Dim oItm As SAPbobsCOM.Items = SboCon.SboDI.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)
'Dim oPl As SAPbobsCOM.PriceLists = SboCon.SboDI.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPriceLists)
If Not oItm.GetByKey(ItemCode) Then Throw New Exception("Item not found")
oMtxSrv.GetLineData(MtxRow)
oUds.Item("UDS_SRV1").ValueEx = oItm.ItemCode
oUds.Item("UDS_SRV2").ValueEx = oItm.ItemName
oUds.Item("UDS_SRV3").ValueEx = CVTools.Dbl2DbStr(Quantity)
oItm.PriceList.SetCurrentLine(0) ' more detailed use of PriceLists will come...
oUds.Item("UDS_SRV4").ValueEx = CVTools.Dbl2DbStr(oItm.PriceList.Price)
oUds.Item("UDS_SRV5").ValueEx = _
CVTools.Dbl2DbStr( _
Math.Round( _
oItm.PriceList.Price / exRate, _
2, MidpointRounding.AwayFromZero _
) _
)
oUds.Item("UDS_SRV7").ValueEx = oItm.SalesItemsPerUnit
oUds.Item("UDS_SRV8").ValueEx = oItm.SalesUnit
oUds.Item("UDS_SRV9").ValueEx = _
CVTools.Dbl2DbStr( _
Math.Round( _
Quantity * oItm.PriceList.Price / exRate, _
2, MidpointRounding.AwayFromZero _
) _
)
oMtxSrv.SetLineData(MtxRow)
If MtxRow = oMtxSrv.RowCount Then
AddEmptyMtxRowSrv(False)
End If
CalculateSumService()
oMtxSrv.AutoResizeColumns()
Catch e As Exception
Throw New Exception(className & ".AddServiceItem()" & vbCrLf & "Exception:" & vbCrLf & e.Message.ToString)
End Try
End Sub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
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.