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.
Attached is one customize optimizer rule which fills the project column with the value from the value from the document header or the previous row whenever selecting a new item. The rule is valid for all Sales and Purchasing documents.
For many business processes it is important to define the correct project for all rows in the documents. In many cases the project should be the same in all rows so this rule helps to save time and data quality by automatically filling in the values.
The sample requires coresuite Version 3.50 or higher, and SAP Business One 8.8 or higher.
Procedure to use this small solution
- Download the attached file FAQ_10156_Auto-fill_matrix_with_projects.cocu
- 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”.
- Open any new Sales or Purchasing Document, for example Sales Order.
- Enter Business Partner and BP Project (Accounting Folder)
- Make sure the project column is visible (SAP Standard not coresuite time project)
- Add a new item in the first row and select tabulator key
- Check the value for the Project and see that the field is filled automatically with the value from the BP Project
- Adjust the project to a different project
- Add Item in second row and select tabulator key
- Check the value for the Project in the second row and see that the value is automatically filled wit the project entered in the first row.
Procedure to adjust this small solution
If you want to copy the value of a different column to the next row adjust the parameter "columnUID" with the id of the corresponding column and make sure to handle the first row accordingly.
Preview Sample (Optimizer Rule C#):
// Here Project Code (ColumnUid = 31), adjust this if you need to copy a the value of a different column to the next row
string columnUID = "31";
string ruleName = pVal.RuleInfo.RuleName.ToString();
string errorMessage = "Error in Optimizer Rule '" + ruleName + "'";
string project = "";
Matrix oMatrix = Matrix.GetFromUID(pVal.Form, "38");
int currentRow = pVal.Row - 1;
if (currentRow == 0)
// Get the value from the BP Project under Accounting folder
project = TextEdit.GetFromUID(pVal.Form, "157").Value;
// Get the value from the previous row
project = oMatrix.GetValue(columnUID, currentRow - 1);
oMatrix.SetValue(columnUID, currentRow, project);
StatusBar.WriteError(errorMessage + ": " + ex.Message);
Debug.WriteMessage(errorMessage + ": " + ex.Message, Debug.DebugLevel.Exception);