cancel
Showing results for 
Search instead for 
Did you mean: 

SAP B1 Error: "Data Table - invalid Unique Id [66000-138]"

kinyanjuikamau
Explorer
0 Kudos

I am making a SAP B1 version 10 addon.

I have a form with a matrix embedded. One column for itemcode I have a choose from list.

When I run the addon, the first time I open the form, I am able to add data with no problem. When I close the form and open it again, and select an itemcode from the CFL, I get the error message: "Data Table - invalid Unique Id [66000-138]". What could be causing this?

if (pVal.FormTypeEx == "ContinuousProduction.TapelineGoodsIssue" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST && pVal.ColUID == "Col_0" && pVal.BeforeAction == false)
{
SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
oCFLEvento = ((SAPbouiCOM.IChooseFromListEvent)(pVal));
string sCFL_ID = null;
sCFL_ID = oCFLEvento.ChooseFromListUID;
oForm = Application.SBO_Application.Forms.Item(FormUID);

SAPbouiCOM.ChooseFromList oCFL = null;
oCFL = oForm.ChooseFromLists.Item(sCFL_ID);

if (oCFLEvento.BeforeAction == false)
{
SAPbouiCOM.DataTable oDataTable = null;
oDataTable = oCFLEvento.SelectedObjects;

oForm.Freeze(true);
if (oDataTable.IsEmpty == false)
{
string itemCode = null;
string itemName = null;
string inStock = null;
string factor = null;

if (oDataTable.UniqueID == "CFL_Item")
{
itemCode = System.Convert.ToString(oDataTable.GetValue(0, 0), null);

oRecordSet.DoQuery("SELECT T0.\"ItemName\", T0.\"IWeight1\" FROM OITM T0 WHERE T0.\"ItemCode\" = '" + itemCode + "'");
oRecordSet.MoveFirst();

if (oRecordSet.RecordCount > 0)
{
itemName = oRecordSet.Fields.Item("ItemName").Value.ToString();
factor = oRecordSet.Fields.Item("IWeight1").Value.ToString();
}

oRecordSet.DoQuery("SELECT T0.\"OnHand\" FROM OITW T0 WHERE T0.\"ItemCode\" = '" + itemCode + "' AND T0.\"WhsCode\" = '" + ComboBox1.Value + "'");
oRecordSet.MoveFirst();

if (oRecordSet.RecordCount > 0)
inStock = oRecordSet.Fields.Item("OnHand").Value.ToString();

((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_0").Cells.Item(pVal.Row).Specific).Value = itemCode;
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_1").Cells.Item(pVal.Row).Specific).Value = itemName;
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_2").Cells.Item(pVal.Row).Specific).Value = inStock;
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_4").Cells.Item(pVal.Row).Specific).Value = ComboBox1.Value;
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_5").Cells.Item(pVal.Row).Specific).Value = factor;

//oDataTable.Rows.Clear();
}
}
oForm.Freeze(false);
}
}

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

nidhisingh14
Product and Topic Expert
Product and Topic Expert

Hi kinyanjuikamau 
Please check below mentioned similar thread:

https://community.sap.com/t5/enterprise-resource-planning-q-a/data-table-duplicate-unique-id-66000-1...

Kind Regards
Nidhi Singh
SAP Business One Support

Answers (0)