Error with Opening Balances Internal Reconciliation SAP BusinessOne

Experiencing a challenge with an internal reconciliation function in SAP Business One, specifically when dealing with opening balances. The function below works well generally but throws an error when handling opening balances.

Internal error (-5001) occurred

Any help will be appreciated.
Best Regards

PS: Developing SAP BusinessOne Addon that allows us to automatically reconcile documents and post ex.rate differences, the addon is working perfectly with all SAP BusinessOne documents except for Opening Balances.

Code snippet:

    SAPbobsCOM.InternalReconciliationParams oParam;
    SAPbobsCOM.InternalReconciliationsService oReconService;
    SAPbobsCOM.InternalReconciliationOpenTrans oOposting;
    oReconService = (InternalReconciliationsService)GlobalVariables.oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.InternalReconciliationsService);
    oParam = (InternalReconciliationParams)oReconService.GetDataInterface(SAPbobsCOM.InternalReconciliationsServiceDataInterfaces.irsInternalReconciliationParams);
    oOposting = (InternalReconciliationOpenTrans)oReconService.GetDataInterface(SAPbobsCOM.InternalReconciliationsServiceDataInterfaces.irsInternalReconciliationOpenTrans);
    oOposting.CardOrAccount = CardOrAccountEnum.coaCard;
    int row = 0;

    oOposting.InternalReconciliationOpenTransRows.Add();
    oOposting.InternalReconciliationOpenTransRows.Item(row).Selected = SAPbobsCOM.BoYesNoEnum.tYES;
    oOposting.InternalReconciliationOpenTransRows.Item(row).TransId = 46;
    oOposting.InternalReconciliationOpenTransRows.Item(row).TransRowId = 0;
    oOposting.InternalReconciliationOpenTransRows.Item(row).ReconcileAmount = 400;
    oOposting.InternalReconciliationOpenTransRows.Add();
    row++;

    oOposting.InternalReconciliationOpenTransRows.Add();
    oOposting.InternalReconciliationOpenTransRows.Item(row).Selected = SAPbobsCOM.BoYesNoEnum.tYES;
    oOposting.InternalReconciliationOpenTransRows.Item(row).TransId = 47;
    oOposting.InternalReconciliationOpenTransRows.Item(row).TransRowId = 1;
    oOposting.InternalReconciliationOpenTransRows.Item(row).ReconcileAmount = 400;

    oParam = oReconService.Add(oOposting);

    return true;
} 
catch (Exception ex)
{
    throw;
}

  • What line does the error occur on? And do the objects / variables / properties in that line all contain the values you expect?

    – 

Leave a Comment