on 05-24-2017 10:38 AM - last edited on 02-03-2024 10:57 PM by postmig_api_4
Dears,
Wish you can help me.
I have created a UDO, Masterdata type ( header and 4 row tables), I added a matrix and then I added a CFL to the first column of each matrix and used this code to get the values by catch the "ItemEvent":
if (pVal.ColUID == "ItemCode")
{
string code = oDataTable.GetValue(0, 0).ToString();
string name = oDataTable.GetValue(1, 0).ToString();
((SAPbouiCOM.EditText)mtxSItems.Columns.Item("ItemName").Cells.Item(pVal.Row).Specific).Value = name;
((SAPbouiCOM.EditText)mtxSItems.Columns.Item("ItemCode").Cells.Item(pVal.Row).Specific).Value = code;
if (((SAPbouiCOM.EditText)mtxSItems.Columns.Item("ItemCode").Cells.Item(mtxSItems.RowCount).Specific).Value != "")
{
mtxSItems.AddRow(1, -1);
}
}
sometimes when I click update to save a single value i receive an error of
sometiems it saves, this make me confused.
But when I try to paste mutli-rows from excel this error always shows up
maybe there is something I make wrong.
Hi,
Since, I do not have the running project at the moment, could you please try something like below:
oMatrixItem.FlushToDataSource();
SetRowNumber();
oMatrixItem.LoadFromDataSource();
Where method SetRowNumber() should be defined as below:
private void SetRowNumber()
{
SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix)m_SBO_Form.Items.Item(enControlName.Matrix).Specific;
try
{
if (oMatrix.VisualRowCount > 0)
{
oMatrix.FlushToDataSource();
int count = _dBDataSourceChild.Size;
for (int i = 0; i <= count-1; i++)
{
this.m_SBO_Form.DataSources.DBDataSources.Item("@TableName").SetValue("U_LineNum", i, (i + 1).ToString());
}
oMatrix.LoadFromDataSource();
}
}
catch
{
throw;
}
}
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP SME Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Ankit,
Thank you so much, I was missing the idea of binding the column "#" in the matrix. I appreciate your help
When I bind it the column "#" it took values automatically then there will be no conflict
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Ankit,
Thanks for your response, but I dont know where to include that code.
I have created a master data table with 4 master data lines tables, then created the object by this code :
private void Create_UDO()
{
GC.Collect();
SAPbobsCOM.UserObjectsMD oUserObjectMD = null;
SAPbobsCOM.UserObjectMD_FormColumns oUDOForm = null;
oUserObjectMD = (SAPbobsCOM.UserObjectsMD)Connection.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD);
oUDOForm = oUserObjectMD.FormColumns;
oUserObjectMD.Code = "CMSNSTNG";
oUserObjectMD.Name = "Settings";
oUserObjectMD.TableName = "Settings";
oUserObjectMD.ChildTables.Add();
oUserObjectMD.ChildTables.TableName = "SitemsLines";
oUserObjectMD.ChildTables.Add();
oUserObjectMD.ChildTables.TableName = "Sitemgrpslines";
oUserObjectMD.ChildTables.Add();
oUserObjectMD.ChildTables.TableName = "DitemsLines";
oUserObjectMD.ChildTables.Add();
oUserObjectMD.ChildTables.TableName = "Ditemgrpslines";
oUserObjectMD.ObjectType = SAPbobsCOM.BoUDOObjType.boud_MasterData;
oUserObjectMD.CanFind = SAPbobsCOM.BoYesNoEnum.tNO;
oUserObjectMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tNO;
oUserObjectMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tNO;
oUserObjectMD.CanClose = SAPbobsCOM.BoYesNoEnum.tNO;
oUserObjectMD.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tNO;
oUserObjectMD.CanLog = SAPbobsCOM.BoYesNoEnum.tNO;
oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tNO;
oUserObjectMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES;
oUserObjectMD.EnableEnhancedForm = SAPbobsCOM.BoYesNoEnum.tYES;
oUserObjectMD.MenuItem = SAPbobsCOM.BoYesNoEnum.tNO;
oUserObjectMD.UseUniqueFormType = SAPbobsCOM.BoYesNoEnum.tYES;
//==============
lRetCode = oUserObjectMD.Add();
// check for errors in the process
if (lRetCode != 0)
{
Connection.oCompany.GetLastError(out lRetCode, out sErrMsg);
Application.SBO_Application.MessageBox("" + lRetCode + " " + sErrMsg);
}
GC.Collect(); // Release the handle to the table
System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserObjectMD);
}
then I have created a user from then I added some edittexts,datasources,tabs,matrix,CFLs and buttons, I gave a button itemUID = 1 so it can save automatically to the data source new and updates.
but I have a big problem when using a matrix with CFL
so could you please be more specific so I can keep up with you
Thanks a lot
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.