cancel
Showing results for 
Search instead for 
Did you mean: 

How I Create Choose From List By Use UDF Table

Former Member
0 Kudos

How I Create Choose From List By Use UDF Table

Does it possible to make ?

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Please Post example code when Bind CLF with UserTable

Former Member
0 Kudos

Hi,

I am facing the same requirement as u.

I am new with SAPB1.

If u have solved ur problem pls send me some clue of it so that I will solve it.

have a good day

thnks in advance

Former Member
0 Kudos

Thank For your Ans. But I mean i use user defind table i can not set This Code

' Adding 2 CFL, one for the button and one for the edit text.

oCFLCreationParams.MultiSelection = False

oCFLCreationParams.ObjectType = "2"

oCFLCreationParams.UniqueID = "CFL1"

      • This code use for common table in b1

How i connect UDF Table or myself table

Former Member
0 Kudos

Hi dde sung,

Just follow this code. first write the function called AddChooseFromList() and then call this one in menu event and then copy the 2nd one code below that and then copy the 3rd one in item event. just change the formuid to ur formid and the control UID also.

'*************************************************************************************************

'1st One

'******************************************************************************************************

Private Sub AddChooseFromList()

Try

Dim oCFLs As SAPbouiCOM.ChooseFromListCollection

Dim oCons As SAPbouiCOM.Conditions

Dim oCon As SAPbouiCOM.Condition

Dim f As SAPbouiCOM.Form

f = SBO_Application.Forms.Item("PUR_REQ")

oCFLs = f.ChooseFromLists

Dim oCFL As SAPbouiCOM.ChooseFromList

Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams

oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)

' Adding 2 CFL, one for the button and one for the edit text.

oCFLCreationParams.MultiSelection = False

oCFLCreationParams.ObjectType = "2"

oCFLCreationParams.UniqueID = "CFL1"

oCFL = oCFLs.Add(oCFLCreationParams)

' Adding Conditions to CFL1

oCons = oCFL.GetConditions()

oCon = oCons.Add()

oCon.Alias = "CardType"

oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL

oCon.CondVal = "C"

oCFL.SetConditions(oCons)

oCFLCreationParams.UniqueID = "CFL2"

oCFL = oCFLs.Add(oCFLCreationParams)

Catch

MsgBox(Err.Description)

End Try

End Sub

'***************************************************************************************************

'2nd One

'***************************************************************************************************

Dim i2 As SAPbouiCOM.Item

i2 = f.Items.Item("4")

oEdit = i2.Specific

f.DataSources.UserDataSources.Add("EditDS", SAPbouiCOM.BoDataType.dt_SHORT_TEXT)

oEdit.DataBind.SetBound(True, "", "EditDS")

' Adding 2 Choose From List Object, ONE FOR EDIT TEXT AND ONE FOR BUTTON.

oEdit.ChooseFromListUID = "CFL1"

'We set the alias only after the UID is set, the alias is the field in the database

'It compares the value in the edit text and narrows the CFL accrodingly

oEdit.ChooseFromListAlias = "CardCode"

oButton.ChooseFromListUID = "CFL2

"'**************************************************************************************************

'3rd One

'***************************************************************************************************

If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then

'If pVal.FormType = "2000142142" 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

Dim val1 As String

Dim val2 As String

Dim val3, skd As String

Try

Try

val = oDataTable.GetValue(0, 0)

Catch ex As Exception

Exit Sub 'For Exception raised for Cancel Button

End Try

val1 = oDataTable.GetValue(1, 0)

val2 = Date.Today.ToShortDateString

skd = Convert.ToDateTime(val2).ToShortDateString()

skd = Convert.ToDateTime(skd).ToString("dd/MM/yy")

Dim oitem2 As SAPbouiCOM.Item

If val = "" Then

oitem2 = oForm.Items.Item("80")

oitem2.Enabled = False

Else

oitem2 = oForm.Items.Item("80")

oitem2.Enabled = True

End If

Catch ex As Exception

'Exit Sub

SBO_Application.MessageBox(ex.Message)

End Try

If (pVal.ItemUID = "67") Or (pVal.ItemUID = "1") Then

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

oForm.DataSources.UserDataSources.Item("EditDS1").ValueEx = val1

oForm.DataSources.UserDataSources.Item("EditDS2").ValueEx = skd

endif

endif

'*************************************************************************************************

contact me if u need any help.

Jayanth

Former Member
0 Kudos

Hi Jayanth,

I used the codes you mentioned in this thread and I modified for my requirement for CFL . When we select the item from CFL and it is filling in the required field in the form. But the data is not storing in the table for that field.

If you tell the solution It would be appreciated.

Venkatesan G.

Former Member
0 Kudos

You must first to create the User data table and then a UDO and asociate the UDF with the UDO.