OE Shipment Issue using Accpac Advantage DLL.

Hi, 

I used below code to generate OE Shipment using Accapc Advantage DLL. Using below code Shipment Entry is creating successfully with Lot Info but Lot Available Qty is not deducting.

I hope using ComAPI DLL it will work but i want to achieve this using Accapc Advantage DLL.

session.Init("", "XY", "XY1000", settings.SageVersion);
                session.Open(settings.SageUser, settings.SagePwd, settings.SageDB, DateTime.Today, 0);
                DBLink mDBLinkCmpRW;
                mDBLinkCmpRW = session.OpenDBLink(DBLinkType.Company, DBLinkFlags.ReadWrite);//dblinks
                View OESHI1header, OESHI1detail1, OESHI1detail2, OESHI1detail3, OESHI1detail4, OESHI1detail5, OESHI1detail6, OESHI1detail7, OESHI1detail8, OESHI1detail9, OESHI1detail10, OESHI1detail11, OESHI1detail12;//EntryView
                OESHI1header = mDBLinkCmpRW.OpenView("OE0692");
                OESHI1detail1 = mDBLinkCmpRW.OpenView("OE0691");
                OESHI1detail2 = mDBLinkCmpRW.OpenView("OE0745");
                OESHI1detail3 = mDBLinkCmpRW.OpenView("OE0190");
                OESHI1detail4 = mDBLinkCmpRW.OpenView("OE0694");
                OESHI1detail5 = mDBLinkCmpRW.OpenView("OE0704");
                OESHI1detail6 = mDBLinkCmpRW.OpenView("OE0708");
                OESHI1detail7 = mDBLinkCmpRW.OpenView("OE0709");
                OESHI1detail8 = mDBLinkCmpRW.OpenView("OE0702");
                OESHI1detail9 = mDBLinkCmpRW.OpenView("OE0703");
                OESHI1detail10 = mDBLinkCmpRW.OpenView("OE0706");
                OESHI1detail11 = mDBLinkCmpRW.OpenView("OE0707");
                OESHI1detail12 = mDBLinkCmpRW.OpenView("OE0705");

                // Compose the Batch, Header and Detail views together.
                OESHI1header.Compose(new View[] { OESHI1detail1, null, OESHI1detail3, OESHI1detail2, OESHI1detail4, OESHI1detail5 });
                OESHI1detail1.Compose(new View[] { OESHI1header, null, OESHI1detail8, OESHI1detail12, OESHI1detail9, OESHI1detail7, OESHI1detail6 });
                OESHI1detail2.Compose(new View[] { OESHI1header });
                OESHI1detail3.Compose(new View[] { OESHI1header, OESHI1detail1 });
                OESHI1detail4.Compose(new View[] { OESHI1header });
                OESHI1detail5.Compose(new View[] { OESHI1header });
                OESHI1detail6.Compose(new View[] { OESHI1detail1, null });
                OESHI1detail7.Compose(new View[] { OESHI1detail1, null });
                OESHI1detail8.Compose(new View[] { OESHI1detail1 });
                OESHI1detail9.Compose(new View[] { OESHI1detail1, OESHI1detail10, null, OESHI1detail11 });
                OESHI1detail10.Compose(new View[] { OESHI1detail9, null });
                OESHI1detail11.Compose(new View[] { OESHI1detail9, null });
                OESHI1detail12.Compose(new View[] { OESHI1detail1 });
                

                try
                {
                    // bool temp;
                    OESHI1header.RecordCreate(ViewRecordCreate.NoInsert);
                    OESHI1header.Fields.FieldByName("SHINUMBER").SetValue(shpHdr.ShipmentNo, false);
                    OESHI1header.Fields.FieldByName("CUSTOMER").SetValue(shpHdr.CustomerCode, false);
                    OESHI1header.Fields.FieldByName("PROCESSCMD").SetValue(1, false);
                    OESHI1header.Fields.FieldByName("SHIDATE").SetValue(shpHdr.ShipmentDate, true);
                    OESHI1header.Fields.FieldByName("DESC").SetValue(shpHdr.ShipmentDesc, false);
                    OESHI1header.Fields.FieldByName("REFERENCE").SetValue(shpHdr.Reference, false);

                    OESHI1detail5.RecordCreate(ViewRecordCreate.NoInsert);
                    OESHI1detail5.Fields.FieldByName("OPTFIELD").SetValue("PO04", false);
                    //OESHI1detail5.Read(false);
                    OESHI1detail5.Fields.FieldByName("VALIFTEXT").SetValue(shpHdr.ChallanNo, false);
                    OESHI1detail5.Insert();
                    //
                    OESHI1detail5.RecordCreate(ViewRecordCreate.NoInsert);
                    OESHI1detail5.Fields.FieldByName("OPTFIELD").SetValue("ZAUDIT", false);
                    //OESHI1detail5.Read(false);
                    OESHI1detail5.Fields.FieldByName("VALIFTEXT").SetValue(shpHdr.AuditUser, false);
                    OESHI1detail5.Insert();
                    OESHI1header.Process();
                  
                    foreach(var det in shpDet)
                    {

                        OESHI1detail1.RecordCreate(ViewRecordCreate.NoInsert);
                        OESHI1detail1.Fields.FieldByName("LINETYPE").SetValue(1, true);
                        OESHI1detail1.Fields.FieldByName("ITEM").SetValue(det.ItemCode, true);
                        OESHI1detail1.Fields.FieldByName("LOCATION").SetValue(det.ItemLoc, true);
                        OESHI1detail1.Fields.FieldByName("QTYSHIPPED").SetValue(det.ShipQty, true);
                        OESHI1detail1.Fields.FieldByName("PROCESSCMD").SetValue("29",true);
                        OESHI1detail1.Process();
                        foreach (var lots in det.ShipLotInfo)
                        {
                            //OESHI1detail6.Read(true);
                            OESHI1detail6.RecordCreate(ViewRecordCreate.NoInsert);
                            OESHI1detail6.Fields.FieldByName("LOTNUMF").SetValue(lots.LotNumber, false);
                            OESHI1detail6.Fields.FieldByName("QTY").SetValue(lots.LotQty, false);
                            OESHI1detail6.Insert();
                            OESHI1detail6.Read(true);
                        }
                        OESHI1detail1.Fields.FieldByName("PRIUNTPRC").SetValue(det.UnitCost, true);
                        OESHI1detail1.Fields.FieldByName("SHIPTRACK").SetValue(det.TrackingNo, true);
                        
                        OESHI1detail1.Insert();
                        OESHI1detail1.Read(true);
                    }

                    OESHI1header.Fields.FieldByName("OECOMMAND").SetValue(4, false);
                    OESHI1header.Insert();

This Issue is sorted.