cancel
Showing results for 
Search instead for 
Did you mean: 

SP01: UI 2005SP1 PL2: problems enabling UDF

Former Member
0 Kudos

Hi,

i'm trying to enable and disable an UDF Editbox field via UI sdk.

i succeed in disable the editbox UDF but can not enable it anymore, the error i receive is:

Error - Item - The item is not a user-defined item [66000-8]

i succeed doind anable and diasble successfully to a Combobox UDF.

someone ever encountered this?

thanks

Moty

Accepted Solutions (0)

Answers (1)

Answers (1)

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Moty,

I have tried to reproduce your problem with 2005 SP01 Path3 but I haven't suceeded. Maybe I'm not doing the same thing as you.

What I do is:

1. I create an EditText linked to my UDF

2. I create a button

3. When I load the BPs form I add my EditText and my Button

4. When I click on my button I enable/disable the EditText by doing

oItem.Enabled = True or oItem.Enable = False

Are you doing the same thing?

My code is inside ItemEvent method:

If (pVal.FormTypeEx = "134") Then ' BP form

If (pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD And Not pVal.BeforeAction) Then

oForm = SBO_Application.Forms.Item(pVal.FormUID)

' Add edit text

oSItem = oForm.Items.Item("222")

oItem = oForm.Items.Add("UserEd", SAPbouiCOM.BoFormItemTypes.it_EDIT)

oItem.Left = oSItem.Left

oItem.Top = oSItem.Top + 20

oItem.Width = oSItem.Width

oItem.Height = oSItem.Height

oEdit = oItem.Specific()

oEdit.DataBind.SetBound(True, "OCRD", "U_TB1300")

' Add user button at form load

oSItem = oForm.Items.Item("271")

oItem = oForm.Items.Add("UserBut", SAPbouiCOM.BoFormItemTypes.it_BUTTON)

oItem.Left = oSItem.Left - 150

oItem.Top = oSItem.Top

oItem.Width = oSItem.Width - 50

oItem.Height = oSItem.Height

oButton = oItem.Specific()

oButton.Caption = "My Button"

ElseIf (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And _

pVal.ItemUID = "UserBut") Then

oForm = SBO_Application.Forms.Item(pVal.FormUID)

If (pVal.Before_Action = False) Then

If (oForm.Items.Item("UserEd").Enabled) Then

oForm.Items.Item("UserEd").Enabled = False

Else

oForm.Items.Item("UserEd").Enabled = True

End If

End If

End If

End If

Regards

Trinidad.

Former Member
0 Kudos

Hi Trinidad,

thanks for your reply,

i'm trying to disable and enable a UDF in the UDF form that is attached to the document form. this UDF was created in B1 via the manage user define fields.

i have no problem with UDF created by UI

thanks

Moty

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Mushin,

I have tried to enable/disable the EditText automatically created for a UDF (in the form attached to the main one, same type with "-" prefix) and I have no problems with it.

I have tried with the BusinessPartners form, can you please try with this one and see if it works for you?

The code I have tested is:

I have added a button in the BPs form, in the ItemPressed event of my button I have the following code working fine:

Dim oFormUDF As SAPbouiCOM.Form = SBO_Application.Forms.GetForm("-134", 1)

If (oFormUDF.Items.Item("U_TB1300").Enabled) Then

oFormUDF.Items.Item("U_TB1300").Enabled = False

Else

oFormUDF.Items.Item("U_TB1300").Enabled = True

End If

I'm using Patch 3, maybe you should upgrade also to Patch 3 to avoid working in a bug already fixed in Patch 3.

Regards

Trinidad.

Former Member
0 Kudos

Hi Trinidad,

thanks for your help,

i upgraded to PL3 and i receive the same error:

Item - The item is not a user-defined item [66000-8]

the first time i disable the item it works, when i try to enable the item i receive the above error.

i used the exact same code you are using.

Dim oSideForm As SAPbouiCOM.Form = SBO_Application.Forms.GetForm("-149", 1)

If (oSideForm.Items.Item("U_" + cUDinit.udfMdH_Ap1U).Enabled) Then

oSideForm.Items.Item("U_" + cUDinit.udfMdH_Ap1U).Enabled = False

Else

oSideForm.Items.Item("U_" + cUDinit.udfMdH_Ap1U).Enabled = True

End If

the only difference from you is that i'm doing it on the Quote Document.

thanks

Moty

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I have tried with the form 149 and it works fine, strange...

Please define a UDF called KitNo and copy paste my code in your project ItemEvent method, then please let me know if it works or not in your case.

If (pVal.FormTypeEx = "149") Then ' BP form

If (pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD And Not pVal.BeforeAction) Then

oForm = SBO_Application.Forms.Item(pVal.FormUID)

' Add edit text

oSItem = oForm.Items.Item("222")

oItem = oForm.Items.Add("UserEd", SAPbouiCOM.BoFormItemTypes.it_EDIT)

oItem.Left = oSItem.Left

oItem.Top = oSItem.Top + 20

oItem.Width = oSItem.Width

oItem.Height = oSItem.Height

oEdit = oItem.Specific()

oEdit.DataBind.SetBound(True, "OQUT", "U_KitNo")

' Add user button at form load

oSItem = oForm.Items.Item("2")

oItem = oForm.Items.Add("UserBut", SAPbouiCOM.BoFormItemTypes.it_BUTTON)

oItem.Left = oSItem.Left + 300

oItem.Top = oSItem.Top

oItem.Width = oSItem.Width

oItem.Height = oSItem.Height

oButton = oItem.Specific()

oButton.Caption = "My Button"

ElseIf (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And _

pVal.ItemUID = "UserBut") Then

oForm = SBO_Application.Forms.Item(pVal.FormUID)

If (pVal.Before_Action = False) Then

If (oForm.Items.Item("UserEd").Enabled) Then

oForm.Items.Item("UserEd").Enabled = False

Else

oForm.Items.Item("UserEd").Enabled = True

End If

Dim oFormUDF As SAPbouiCOM.Form = SBO_Application.Forms.GetForm("-149", 1)

If (oFormUDF.Items.Item("U_KitNo").Enabled) Then

oFormUDF.Items.Item("U_KitNo").Enabled = False

Else

oFormUDF.Items.Item("U_KitNo").Enabled = True

End If

End If

End If

End If

Regards

Trinidad.

Former Member
0 Kudos

Hi Trinidad,

thanks you for the help

please try this:

(i used your code to reproduce this)

run your code, then click on the button, making the UDF disabled. then click cancel on the form to close the form.

now reopen the form and try to enable or disable the UDF.

you will receive the same error i received.

the only way to enable the field again will be by going to Tools-> User Defined Fileds->Setting and enable the UDF.

can you reproduce the error?

Thanks

Moty

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Moshin,

I finally reproduced your problem, thanks for all your explanations!

It only happens if you leave the edit text disabled just before closing the form. If the edit text is enabled before closing the form then when you open it one more time you can continue using the button to enable/disable the edit text.

I will report the problem to development and I will let you know as soon as I have an answer.

In the meanwhile I propose you to create the EditText for your UDF in the main form or make the one created by B1 not visible and add your instead, this way you will be able to enable/disable it.

Thanks for giving us feekback

Regards

Trinidad.