Undo the total amount round / A/R invoice - document total, field cannot be updated (odbc -1029) SAP B1

1k views Asked by At

I am trying to undo the automatic total amount round in A/R RESERVEI NVOICE b1 on an add on extension.

The error throws after:

txtDocTotalAfterDiscountFreightCharge.Active = true;
txtDocTotalAfterDiscountFreightCharge.String = total.ToString();

with this error: Only if I undo the round on A/R RESERVEI NVOICE.

A/R invoice - document total, field cannot be updated (odbc -1029)

for A/R INVOICE it is working well.

[BasicSapForm(Consts.FORM_RESERVE_INVOICE)]
[BasicSapForm(Consts.FORM_INVOICE)]
 class OinvListener : SapDocumentsForm
    {
        public OinvListener(string uniqueId, object extraInfo)
            : base(uniqueId, extraInfo)
        {
        }


        public override void Init()
        {
        }


        [BasicSapEvent(SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE, "", true)]
        [BasicSapEvent(SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD, "", true)]
        private bool BeforeFormAdd(SAPbouiCOM.BusinessObjectInfo pVal)
        {
            if (MO_ModuleManager.Common.B1Starter.userModules.ContainsKey(ModuleInfo.Code))
            {
                if (MO_ModuleManager.Common.B1Starter.userModules.ContainsKey(ModuleInfo.SubCode2))
                {
                    di.BusinessPartners diBp = SapUtils.GetDiObjectByFormTypeAndKey                            (Consts.FORM_BP, txtCardCode.String) as di.BusinessPartners;
                    if (diBp.UserFields.Fields.Item("U_RoundAum").Value.ToString() == "N")
                    {
                        double total = TypeUtils.ExtractDouble
(txtDocTotalAfterDiscountFreightCharge.String);
                        ui.EditText txtDisc = mForm.Items.Item("42").Specific as ui.EditText;
                        if (false == string.IsNullOrEmpty(txtDisc.String))
                            total += TypeUtils.ExtractDouble(txtDisc.String);
                        try
                        {
                            txtDocTotalAfterDiscountFreightCharge.Active = true;
                            txtDocTotalAfterDiscountFreightCharge.String = total.ToString();
                        }
                       catch {  }
                    }
                }
            }
            return true;
        }
    }
0

There are 0 answers