Skip to Content
0
Former Member
Sep 09, 2005 at 02:21 PM

return value from ChooseFromList

349 Views

Hello

I use the example code of UI API\17.ChooseFromList

When the user select a row in the list, there are these line code for set the value in the EditBox:

oForm.DataSources.UserDataSources.Item("EditDS").ValueEx = val

My question is this:

The edit box is on form udo, then the edit box is binding with a dbds, not with a uds

m_Dbds = m_sboForm.DataSources.DBDataSources.Add("@IDE_UDOT")

m_Dbds.SetValue(pVal.ItemUID, 0, Val)

I have this error: Form - Reserved / Illegal form Unique ID

This error occur problably because the form ChooseFromList is modal and is (in this event et_CHOOSE_FROM_LIST ) visible!

Then I try to use this code, with graphics access:

Dim l_sboTxt As SAPbouiCOM.EditText = m_sboForm.Items.Item(pVal.ItemUID).Specific

l_sboTxt.Value = Val

But I have this error:

General Failure

There is error, but the value is returned

Question:

Must I use only UserDataSources, and I can't use DBDataSources?

Complete code:

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent

If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then

Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent

oCFLEvento = pVal

Dim sCFL_ID As String

sCFL_ID = oCFLEvento.ChooseFromListUID

Dim oForm As SAPbouiCOM.Form

oForm = SBO_Application.Forms.Item(FormUID)

Dim oCFL As SAPbouiCOM.ChooseFromList

oCFL = oForm.ChooseFromLists.Item(sCFL_ID)

If oCFLEvento.BeforeAction = False Then

Dim oDataTable As SAPbouiCOM.DataTable

oDataTable = oCFLEvento.SelectedObjects

Dim val As String

Try

val = oDataTable.GetValue(0, 0)

Catch ex As Exception

End Try

If (pVal.ItemUID = "EditTxt") Or (pVal.ItemUID = "Button") Then

<b>oForm.DataSources.UserDataSources.Item("EditDS").ValueEx = val</b>

End If

End If

End If

....

End Sub

Thanks,

Andrea Moschetto