Skip to Content
0
Former Member
Feb 27, 2009 at 03:21 PM

ChooseFromList in B1DE

214 Views

dear all,

I have problems about how to handle choosefromlist under B1DE. What I have done is listed as follows.

First,I created an UDO containing two UDTs, including one document and one document rows.

And then I used the "SAP B1 Addon Wizard" of B1DE to build a project in vb.net 2005, and the necessary form, defined in XML, was automatically generated based on the UDO. The project runs fine where I can input data into the form and save data to the UDTs.

After that, I added an choosefromlist object to the form under Screen Painter and binded the choosefromlist to an edittext object. When I run the project, the choosefromlist form can be activated by pressing TAB, but the value selected in the choosefromlislt is not passed back to the edittext object.

I have studied the code sample In SDK and I know I have to handle the choosefromlist event to catch "pval" and write the value selected in choosefromlist back to the corresponding datasource. However, the way for handleing event in B1DE is different from SDK. So I tried to add a choosefromlist listener to the textedit object and the codes generated by B1DE are listed below.

After reading the codes, I guess the variable "edittext" is assigned to the edittext object which I want the value selected in choosefromlist will be shown. So I catch the selected value from pval and directly assign it to edittext variable. But it did not work quite well. Can someone tell me that the way I tried to do is right or wrong? Or I have to assign the selected value from choosefromlist to the datasource, like the code sample of SDK? How to correct the codes?

Thanks.

-


Public Class EditText__CYW_PR__9

Inherits B1Item

Public Sub New()

MyBase.New

FormType = "CYW_PR"

ItemUID = "9"

End Sub

<B1Listener(BoEventTypes.et_CHOOSE_FROM_LIST, False)> _

Public Overridable Sub OnAfterChooseFromList(ByVal pVal As ItemEvent)

Dim ActionSuccess As Boolean = pVal.ActionSuccess

Dim form As Form = B1Connections.theAppl.Forms.Item(pVal.FormUID)

Dim item As Item = form.Items.Item("9")

Dim edittext As EditText = CType(item.Specific, EditText)

'ADD YOUR ACTION CODE HERE ...

Dim oDataTable As SAPbouiCOM.DataTable

oDataTable = pVal.SelectedObjects

Dim val As String

Try

val = oDataTable.GetValue(0, 0)

Catch ex As Exception

End Try

edittext.Value = val

End Sub

End Class