Skip to Content
0

Move user defined filed to system form programmatically

Nov 08, 2017 at 03:24 PM

61

avatar image

Hello, I'm trying to modify a system form programmatically.

Is there a way to move a user defined field from User-Defined-Fields tab to the main document form.

For example I want to move a user defined field "Opis zlecena" to an 'I/R Invoice' form. I can do it using sap B1 "Edit UI..." option as visible in the attached screenshots.

Is it possible to do the same thing programmatically? It's important for me to hide the field from the that I add to the main form from the User-Defined_fields tab.

I'am using code to manipulate system forms in on load event. I can add new items that correspond to user defined fields, but the user defined fields are then visible in two places User-Defined_fields tab and main form.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

ANKIT CHAUHAN
Nov 08, 2017 at 04:35 PM
1

Hi,

Yes, you can do it by following way:

NewForm = this.SBO_Application.Forms.GetForm(pVal.FormType.ToString(), pVal.FormTypeCount);
SAPbouiCOM.StaticText oStaticNew;
SAPbouiCOM.Item oItemExist = (Item)NewForm.Items.Item("230"); // This is an existing item on the form.
SAPbouiCOM.Item oItem1New = (Item)NewForm.Items.Add("DOCRMRK", SAPbouiCOM.BoFormItemTypes.it_STATIC);
oItem1New.Top = oItemExist.Top + 30;
oItem1New.Left = oItemExist.Left;
oItem1New.Width = oItemExist.Width;
oItem1New.Height = oItemExist.Height;
oItem1New.Enabled = true;
oStaticNew = (SAPbouiCOM.StaticText)oItem1New.Specific;
oStaticNew.Caption = "Document Remarks";


SAPbouiCOM.EditText oEditNew;
SAPbouiCOM.Item Exist1 = (Item)NewForm.Items.Item("222");
SAPbouiCOM.Item New1 = (Item)NewForm.Items.Add("DOCRMRKS", SAPbouiCOM.BoFormItemTypes.it_EDIT);
New1.Top = Exist1.Top + 30;
New1.Width = Exist1.Width;
New1.Height = Exist1.Height;
New1.Left = Exist1.Left;
New1.FromPane = 0;
New1.ToPane = 0;
New1.LinkTo = "DOCRMRK";
oItem1New.LinkTo = "DOCRMRKS";
New1.Enabled = false;
New1.Visible = true;
oEditNew = (SAPbouiCOM.EditText)New1.Specific;
oEditNew.DataBind.SetBound(true, "OPCH", "U_DocRemarks");

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP SME Support

Share
10 |10000 characters needed characters left characters exceeded
Michal Bronkowski Nov 09, 2017 at 11:38 AM
0

Thanks for the tip that. But what you have shown we did already. We have two problems with that approach.

1. The filed is still visible in the User-Defined_fields tab, we want to control the enabled property of this field and we don't wan't it displayed there

2. When we try to change form width on form load and then place the new control in the free space that gets created, corrupts the layout. System doesn't respect the left property value that is assigned by us, it updates the new field coordinates. It works as if we added field earlier and then changed the width not vice versa. The outcome is something like this: ("Dodatkowe uwagi" field)

In the picture below form width is set to: 1500, and left property of "dodatkowe uwagi" label is set to 400. It is automatically updated by the system when the form is drawn.


Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi,

1. UDFs can be managed using the following option:

2. You need to set the "LinkTo" property correctly. Also all other properties should be based on existing item's properties.

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP SME Support

udf-settings.jpg (212.3 kB)
0
Michal Bronkowski Nov 09, 2017 at 01:30 PM
0

Indeed i can use it to hide some user fields from the tab, but is there a way to access this settings programmatically?

Share
10 |10000 characters needed characters left characters exceeded