cancel
Showing results for 
Search instead for 
Did you mean: 

how to add new tab folder to system forms(Business Partner Master) and add items in it?

Former Member
0 Kudos

Hello,

          I want to add a new tab folder in Business Partner Master Data and also add some specific items in that folder.I am new to sdk so I don't know.

Anybody who knows please help me.

Accepted Solutions (1)

Accepted Solutions (1)

edy_simon
Active Contributor
0 Kudos

Hi,

You need to catch the After Form Load event of the form 134 (BP Form) and then execute this code,

Dim oFolder As SAPbouiCOM.Folder = Nothing

Dim oItem As SAPbouiCOM.Item

Dim oItemRef As SAPbouiCOM.Item = Nothing

Dim iMaxPane As Integer = 0

oItemRef = form.Items.Item("9")

oItem = form.Items.Add("MyFld", BoFormItemTypes.it_FOLDER)

oItem.Top = oItemRef.Top

oItem.Height = oItemRef.Height

oItem.Left = oItemRef.Left + oItemRef.Width

oItem.Width = oItemRef.Width

oItem.Visible = True

oFolder = oItem.Specific

oFolder.Caption = "My Folder"

oFolder.GroupWith(oItemRef.UniqueID)

oFolder.Pane = 11

'Create a matrix on the folder

oItem = form.Items.Add("MyMtx", BoFormItemTypes.it_MATRIX)

oItem.FromPane = 11

oItem.ToPane = 11

oItemRef = form.Items.Item("21")

oItem.Top = oItemRef.Top

oItem.Left = 10

oItem.Width = form.Width - 200

oItem.Height = 270

The code should add a folder and a matrix inside it.

For more information on handling system form, you should check out SAP sample in your  C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\11.SystemFormManipulation

Regards
Edy

Former Member
0 Kudos

I don't know vb.net so I am doing coding in C#.I have converted your code to C# and tried but it is giving some sort of errror.

And I want to add Textbox and labels fields in the newly created tab folder.Is it possible?If yes then how?

edy_simon
Active Contributor

Hi

Translated in C#

            SAPbouiCOM.Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);

            SAPbouiCOM.Folder oFolder  = null;

            SAPbouiCOM.Item oItem = null;

            SAPbouiCOM.Item oItemRef =null;

            oItemRef = form.Items.Item("9") ;

            oItem = form.Items.Add("MyFld", BoFormItemTypes.it_FOLDER)  ;

            oItem.Top = oItemRef.Top  ;

            oItem.Height = oItemRef.Height  ;

            oItem.Left = oItemRef.Left + oItemRef.Width  ;

            oItem.Width = oItemRef.Width  ;

            oItem.Visible = true  ;

            oFolder = (SAPbouiCOM.Folder)oItem.Specific; 

            oFolder.Caption = "My Folder"  ;

            oFolder.GroupWith(oItemRef.UniqueID)  ;

            oFolder.Pane = 99  ;

            //Create a label on the folder 

            oItem = form.Items.Add("MyLabel", BoFormItemTypes.it_STATIC)  ;

            oItem.FromPane = 99  ;

            oItem.ToPane = 99   ;

            oItemRef = form.Items.Item("21")  ;

            oItem.Top = oItemRef.Top  ;

            oItem.Left = 10  ;

            SAPbouiCOM.StaticText oLbl = (SAPbouiCOM.StaticText)oItem.Specific;

            oLbl.Caption = "MyLabel";

            //Create a label on the folder 

            oItem = form.Items.Add("MyEdit", BoFormItemTypes.it_EDIT);

            oItem.FromPane = 99;

            oItem.ToPane = 99;

            oItemRef = form.Items.Item("MyLabel");

            oItem.Top = oItemRef.Top;

            oItem.Left = oItemRef.Left + oItemRef.Width + 10;

You have to catch another event to switch your pane level also :

In your After Item Pressed event for form 134 put this codes :

            SAPbouiCOM.Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);

            switch (pVal.FormTypeEx)

            {

                case "134":

                    if (pVal.ItemUID == "MyFld" && pVal.BeforeAction==false)

                        form.PaneLevel = 99;

                    break;

            }

Note that I modified the PaneLevel to 99 in C# codes, in SBO 88 above, pane 11 is used for attachment screen.

Regards

Edy

Former Member
0 Kudos

Thanks Edy,

                     This code is working, textbox and label is seen on the newly created folder.But how to pass values of these user defined fields to Business One Database i.e. how to attach these UDF to Database?

Thanks & Regards

Kunika

edy_simon
Active Contributor
0 Kudos

Hi Kunika,

You need to create a UDF for the BP Master Data,

I will assume that a UDF has been created with the UID = TestBP

Then you just bind the 'txtMyEdit' with the UDF.

Add these Lines after the EditText creation :

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

            oEdit.DataBind.SetBound(true, "OCRD", "U_TestBP");

Please close this discussion as answered, if you are done.

Thanks,

Edy

Former Member
0 Kudos

Hi Edy,

              I got my answer.

Thanks & Regards,

Kunika

Former Member
0 Kudos

This is a good answer; I was looking how to add custom buttons to system forms as well and this is the valid answer.

Former Member
0 Kudos

Hi Edy I checked this code for adding a tab folder to "Item Master Data" form. I don't see any attribute such as pane for object of SAPbouiCOM.Folder. How can I set the pane?

Answers (1)

Answers (1)

Former Member
0 Kudos