Hi,
I am trying to add a new column in the Matrix which is displayed in the Sales Order form. When I run this addon, I get the error Add-on 9000016 failed with exception; Event Type 16.
My code is:
private void SBO_Application_ItemEvent( string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent ) {
BubbleEvent = true;
if ( ( ( pVal.FormType == 139 & pVal.EventType != SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD ) & ( pVal.Before_Action == true ) ) ) {
// get the event sending form
oOrderForm = SBO_Application.Forms.GetFormByTypeAndCount( pVal.FormType, pVal.FormTypeCount );
if ( ( ( pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD ) & ( pVal.Before_Action == true ) ) ) {
SAPbouiCOM.Item formItem = null;
//Get the Matrix
formItem = oOrderForm.Items.Item("38");
SAPbouiCOM.IMatrix oMatrix = (SAPbouiCOM.IMatrix)formItem.Specific;
SAPbouiCOM.IColumn col1 = null;
SAPbouiCOM.IColumn colItem = null;
col1 = oMatrix.Columns.Add("RKMatrix001", SAPbouiCOM.BoFormItemTypes.it_EDIT);
col1.TitleObject.Caption = "RKColCaption";
col1.Description = "RKColDesc";
col1.Width = 30;
col1.DisplayDesc = true;
//"5" is for Mfr Serial No.
//col1.DataBind.SetBound(true, oMatrix.Columns.Item("5").DataBind.TableName, oMatrix.Columns.Item("5").DataBind.Alias);
SAPbouiCOM.UserDataSource oUserDataSource = oOrderForm.DataSources.UserDataSources.Add("RK_DS01", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20);
col1.DataBind.SetBound(true, "", "RK_DS01");
oUserDataSource.Value = "TEST VALUE";
col1.Editable = true;
MessageBox.Show("Column added successfully"); |
}
}
}
What am I doing wrong?
Thanks.