cancel
Showing results for 
Search instead for 
Did you mean: 

UI oForms Item Edit with search

Former Member
0 Kudos

Hi All,

I haven't found anything on search to a related Field....

I add a Field

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

oItem.Left = 10 + StatWidth;

oItem.Width = StatWidth;

oItem.Top = 40;

oItem.Height = StatHight;

oEdit = ((SAPbouiCOM.EditText)(oItem.Specific));

oEdit.DataBind.SetBound(true, "@MyUserTable", "U_SCardCode");

then add a linked Button

oItem = oForm.Items.Add("CardCode", SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON);

oLinkBtn = (SAPbouiCOM.LinkedButton)oForm.Items.Item("CardCode").Specific;

oLinkBtn.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_BusinessPartner;

oItem.Left = StatWidth - 10;

oItem.Top = 40;

oItem.LinkTo = "LCardCode";

Like the CardCode Filed in BusinessPartner...

Any Ideas?

Best Regards

Oliver

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Ok I Found the solution in ChoosfromList.

Know I don't know the correct way of setting the Value back to my Form.

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

oItem.Left = 10 + StatWidth;

oItem.Width = StatWidth;

oItem.Top = 40;

oItem.Height = StatHight;

oEdit = ((SAPbouiCOM.EditText)(oItem.Specific));

oEdit.DataBind.SetBound(true, "@MyUserTable", "U_SCardCode");

oEdit.ChooseFromListUID = "List";

oEdit.ChooseFromListAlias = "CardCode";

I Add an EventHandler

and I try to set the EditItem

SAPbouiCOM.EditText EditText = null;

EditText = (SAPbouiCOM.EditText)oForm.Items.Item("LCardCode").Specific;

EditText.Value = val;

but I get an Exeption, no Focus for this Object...

and writing to DB at this time is not the best Idea...

What its the best way of doing this?

Regards

Oliver

pedro_magueija
Active Contributor
0 Kudos

Hi Oliver,

The correct way would be to write the value on the datasource and not on the item.

Get the DBDatasource from the form and write to the appropriate column:

DbDatasource myDatasource = oForm.Datasources.DBDatasource.Item("@MyUserTable");

myDatasource.SetValue("U_SCardCode", 0, val);

Note that this only works on user defined forms/datasources.


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

Former Member
0 Kudos

Hi Pedro,

ok. This works but the status of the form is still "ok" how should I update the status of the Form?

Regards

Oliver

pedro_magueija
Active Contributor
0 Kudos

Hi Oliver,

Try this:

oForm.Mode = BoFormMode.fm_UPDATE_MODE;


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

Former Member
0 Kudos

Hi Pedro,

Thank you very much,

Best Regards

Oliver

Answers (0)