SAP B1 Error: (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT

266 Views Asked by At

I am getting an error when I open a SAP B1 form a second time, error is not thrown when I open the form the first time after running the addon.

Error message:

SAP B1 Error: (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT

This is a b1f form built through Visual Studio.

The error gets thrown here:

if (pVal.FormTypeEx == "ContinuousProduction.LaminationSFGReceipt" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_VISIBLE && pVal.BeforeAction == false)
{
    if (EditText3.Value == string.Empty)  <-- Error gets thrown here
    {
        Button3.Item.Visible = false;
    }
    else
    {
        Button3.Item.Visible = true;
    }
}

enter image description here

What can I do to resolve this issue?

1

There are 1 best solutions below

3
VonC On

Even though your error comes from the server, check first if some safeguard checks in your client code would be enough:

// Event handler for form visibility
if (pVal.FormTypeEx == "ContinuousProduction.LaminationSFGReceipt" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_VISIBLE && pVal.BeforeAction == false)
{
    // Check if EditText3 is not null to prevent null reference exception
    if (EditText3 != null)
    {
        // Check if EditText3's value is empty or null
        if (string.IsNullOrEmpty(EditText3.Value))
        {
            // Hide the button if EditText3 is empty
            Button3.Item.Visible = false;
        }
        else
        {
            // Show the button if EditText3 has a value
            Button3.Item.Visible = true;
        }
    }
    else
    {
        // Handle the case where EditText3 is null (e.g., log an error or take corrective action)
    }
}

You might at least capture the error on the client side.