Follow

DOC - Set FormSettings for a specific form via Function Button

Important Notes

The samples and information below is provided without a warranty of any kind. This post is for informational purposes and coresystems ag assumes no responsibility for errors or omissions in the information provided.


Purpose

You want to set form settings without loosing time searching in the configuration for specific values. You create a function button customize rule to be able to set some predefined form settings in one click


Requirements

The rule requires coresuite Version 3.40 or higher, and SAP Business One 8.8 or higher.


Procedure to use this small solution

  1. Download the attached cocu file SetFormSettings.cocu
  2. Import in SAP Business One via > Administration > Add-Ons > coresuite customize > Import / Export > Import rules. In the message box, select “All Active”. Click on “Import”.

To check the rule in action:

  1. Go to a Sales Order 
  2. Click on the Function button or Right Click on the form to trigger the update of all relevant items and choose "Set Form Settings".
  3. The settings "Bar Code" and "Mfr No." will be activated and the form will close 


Procedure to adjust this small solution

In order to add new settings add additional lines

oCheckBox = (SAPbouiCOM.CheckBox) oMatrix.Columns.Item("2").Cells.Item(7).Specific;
oCheckBox.Checked = true;

immediately after the comment

// @@ Add additional settings here @@

Preview Sample (Optimizer Rule C#):

try
{

SAPbouiCOM.CheckBox oCheckBox = null;

MenuClick("5890");
Form f = Form.GetFormFromUID(SwissAddonFramework.B1Connector.GetB1Connector().Application.Forms.ActiveForm.UniqueID);
Item.GetFromUID(f, "4").Click(SwissAddonFramework.UI.Components.Item.ClickType.Regular);


Matrix m = Matrix.GetFromUID(f, "11");
SAPbouiCOM.Matrix oMatrix = m.GetSapObject<SAPbouiCOM.Matrix>();

// set COLUMN 2, ROW 6
oCheckBox = (SAPbouiCOM.CheckBox) oMatrix.Columns.Item("2").Cells.Item(6).Specific;
oCheckBox.Checked = true;

// set COLUMN 2, ROW 7
oCheckBox = (SAPbouiCOM.CheckBox) oMatrix.Columns.Item("2").Cells.Item(7).Specific;
oCheckBox.Checked = true;

// @@ Add additional settings here @@

Item.GetFromUID(f, "1").Click(SwissAddonFramework.UI.Components.Item.ClickType.Regular);

}
catch (Exception ex)
{
StatusBar.WriteError("An error occurred in: " + pVal.RuleInfo.RuleName + ", " + ex.Message);
}

 

 

**** Preview : ****

 SetFormSettings.png

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.