cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble Adding a String to a system Edit Text box

Former Member
0 Kudos

On the Service Call form, I would like to fill in the "Subject" edit text box using code.

Here's my code:


Dim objForm1 As SAPbouiCOM.Form
Dim objFormItem1 As SAPbouiCOM.Item
Dim objEditText1 As SAPbouiCOM.EditText


objForm1 = objSboApp.Forms.Item(<FormUID>)
objFormItem1 = objForm1.Items.Item("6")
objEditText1 = objFormItem1.Specific

objEditText1.Value = "Some Text"

Prior to this I am also setting the ActiveItem to the "Mfr Serial No." field.

When this code runs, it sends an error:

-3031

Bad Value

...and it brings up a Customer Equipment Card List window. It also places my string, "Some Text" into the 'Find' field in the Customer Equipment Card List window. The 'Find' field also happens to have a UID of "6".

I get the same error if I try to first set the ActiveItem to "6" (objForm1.ActiveItem = "6") and also the same error on (objEditText1.Active = True)

Any ideas?

Thanks!

Message was edited by:

Paul Madden

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Is ur EditText bound to UserDataSource or DBDataSource if Yes,then give ur code of binding the datasource.I will try to solve ur problem.

Regards,

Lalit Narayan

Answers (6)

Answers (6)

Former Member
0 Kudos

To Add Value, from CFL in System Form UDF. Please Check your code

In header table udf is located at left side of system form, user Defined values (Ctrl + Shift + U)

pVal.FormUID carry the System Form only.

oForm.Items.item(pVal.ItemUID).Specific.Value = val

throws error 3031 and 7076 Form-Bad value, Item is not user defined item.

Solution:-


oform = oAPPlication.forms.Item(pVal.FormUID)

Dim oUDFForm As SAPbouicom.Form

oUDFForm = oAPPlication.forms.Item(oform.UDFFormUID)


oUDFForm.Items.Item(pVal.ItemID).Specific.Value = val

Former Member
0 Kudos

Hi,

Check whether the datatype of the edittext is Alphanumeric or numeric.

regards,

varma

Edited by: varma varma on Dec 28, 2007 8:01 AM

Former Member
0 Kudos

Paul,

I am having this same problem, except using a different form (Sales Order form), and am trying to update the cardcode field. How did you manage to get passed this error?

TIA,

Anthony Mann

Former Member
0 Kudos

I don't remember all the reasoning behind it since it was a couple months ago. But here is what I ended up with:

objForm = objSboApp.Forms.Item(<form_uid>)

objFormItem = objForm.Items.Item(<item_uid>)

objEditText = objFormItem.Specific

If objFormItem.Enabled = False Then

objFormItem.Enabled = True

objEditText.String = "Your Data Here"

objFormItem.Enabled = False

Else

objEditText.String = "Your Data Here"

End If

Don't forget to Dim the Form, FormItem, and EditText if you haven't already. Also, my naming convention is a little different than the SDK samples.

barend_morkel2
Active Contributor
0 Kudos

Hi All,

Just a note (according to the SDK Help Files AND my experience)

1. When there is a DataSource - always use the DataSource to get/set values.

2. When assigning values to an item always use .String (.Value works sometimes BUT not all of the time).

Former Member
0 Kudos

Hi Paul,

You try like this, Its work here.

oForm.Items.Item("8").Specific.Value = Trim(pono)

Regards,

G.Suresh.

Former Member
0 Kudos

Hi,

Have you tried this? Also try assigning to data source

objEditText1.String = "Some Text"

Ravi Shankar B