on 2021 Dec 09 11:58 AM
Hi,
I am trying to update more than 500 Delivery documents but I am getting RPC error. It's working on the sap b1 server but not working on the workstation. I am using SAP B1 v10 FP2105.
This is the error.
System.Runtime.InteropServices.COMException (0x80010105): The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)) at SAPbobsCOM.IDocuments.Update()
This is my code. I noticed that the memory is increasing every time it loops. I don't know why because I am releasing the object every loop.
oCompany.StartTransaction();
String newCost = oForm.DataSources.UserDataSources.Item("dsCost").Value.ToString();
var updateErrorCode=0;
for (int i = 0; i < dtData.Rows.Count; i++)
{
if (dtData.Rows[i]["CheckBox"].ToString() == "Y")
{
SAPbobsCOM.Documents oDeliveryNote;
SAPbobsCOM.Document_Lines oLines;
oDeliveryNote = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes);
oApp.SetStatusBarMessage("Updating Delivery No. " + dtData.Rows[i]["DocNum"].ToString(), SAPbouiCOM.BoMessageTime.bmt_Short, false);
if (oDeliveryNote.GetByKey(Int32.Parse(dtData.Rows[i]["DocEntry"].ToString())))
{
SAPbobsCOM.Field f1 = oDeliveryNote.UserFields.Fields.Item("U_UPDATED");
f1.Value = "YES";
oLines = oDeliveryNote.Lines;
for (int x = 0; x < oLines.Count; x++)
{
oLines.SetCurrentLine(x);
if (oLines.ItemCode == dtData.Rows[i]["ItemCode"].ToString())
{
oLines.GrossBuyPrice = Double.Parse(oForm.DataSources.UserDataSources.Item("dsCost").Value);
}
}
updateErrorCode =oDeliveryNote.Update();
System.Runtime.InteropServices.Marshal.ReleaseComObject(oDeliveryNote);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oLines);
System.Runtime.InteropServices.Marshal.ReleaseComObject(f1);
oDeliveryNote = null;
oLines = null;
f1 = null;
GC.Collect();a
}
}
}
oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit);<br>
Thank you.
Regards,
Raphael
Request clarification before answering.
i was also facing the same issue. kindly check whether this solution works for you or not
https://www.linkedin.com/feed/update/urn:li:activity:7166391771059482624
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
i think the transaction crashed the system. you can try without transaction..
Or you can execute the program with only 1 user login the system.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, did u solve this? i'm facing the same situation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
122 | |
10 | |
8 | |
5 | |
4 | |
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.