cancel
Showing results for 
Search instead for 
Did you mean: 

Bind data to UDF

Former Member
0 Kudos

Hi All,

I am trying to create a user defined form using SAP B1 Studio for VS. I am able to load the form and add and find data using UDO. I want to display the next document number on the form when the form is loaded. But I am getting Invalid Item error.

            oForm = ((SAPbouiCOM.Form)(Application.SBO_Application.Forms.ActiveForm));

            oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            oRecordSet.DoQuery("SELECT ISNULL(MAX(CAST(Code AS Numeric)),0) as Code FROM [@V_CALLBACKS]");

            string Code = Convert.ToString(oRecordSet.Fields.Item("Code").Value);

            int Code1 = Convert.ToInt32(Code) + 1;

            oEditText = (SAPbouiCOM.EditText)oForm.Items.Item("Item_14").Specific;    <------Error in this line.

            oEditText.DataBind.SetBound(true, "@V_CALLBACKS", "U_Code");

            oEditText.Value = Code1.ToString();

Can anyone help me to resolve this issue please.

Thanks

Varun.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try to assign the oForm using this:

oForm = ((SAPbouiCOM.Form)(Application.SBO_Application.Forms.Item(pVal.FormUID));

Beni.

Former Member
0 Kudos

Hi Guys,

Thanks for your help.

varun.

Answers (1)

Answers (1)

Former Member
0 Kudos

hi.

Have checked  Item_14  is available or not...

edy_simon
Active Contributor
0 Kudos

Hi,

Just to add Srinivas' comment

Note that Item UIDs are case sensitive.

Regards

Edy