Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3363

Añadir/Actualizar materiales en orden de produccion con DI api v 9.0

$
0
0

Hola  amigos

si  alguien me  pudiera ayudar soy nuevo en el desarrollo sap

 

tengo una orden de producción y estoy tratando de añadirle materiales nuevos o actulizar los que ya existen y lo que me hace siempre es modificar el primero y si hay mas solo  deja uno

 

el  problema ocurre en

 

oProductionOrder.Lines.Add();

ValRet = oProductionOrder.Update();

 

 

 

este  es el codigo  completo

 

        

                SAPbobsCOM.ProductionOrders oProductionOrder = null;

                SAPbobsCOM.Recordset oRs = null;

 

                    oRs = (SAPbobsCOM.Recordset)SBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

 

 

                    oProductionOrder = SBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductionOrders);

                    oProductionOrder.GetByKey(DocEntry);

                    oProductionOrder.Lines.Warehouse = Warehouse;

 

 

                    QtyIss = QtyIssued(SBOCompany, DocEntry);

 

 

                        oRs.DoQuery("SELECT VisOrder, LineNum FROM WOR1 WHERE DocEntry = " + DocEntry.ToString() + " AND ItemCode = '" + ItemCode + "'");

 

 

                        if (oRs.RecordCount != 0)

                        {

                            oProductionOrder.Lines.SetCurrentLine(oRs.Fields.Item("VisOrder").Value);

                            if ((RealQuantity + QtyIss) > oProductionOrder.Lines.PlannedQuantity)

                            {

                                oProductionOrder.Lines.PlannedQuantity = RealQuantity + QtyIss ;

                                oProductionOrder.Lines.Add();

                                ValRet = oProductionOrder.Update();

 

 

                                #region Validates if there was an error Updating Production Order

                                if (ValRet != 0)

                                {

                                    SBOCompany.GetLastError(out ValRet, out sErrMsg);

                                }

                                #endregion Validates if there was an error Updating Production Order

                            }

                           

                            BaseLine = oRs.Fields.Item("LineNum").Value;

                           

                           

                        }

                        else

                        {

                            if ((RealQuantity + QtyIss) > oProductionOrder.Lines.PlannedQuantity)

                            {

                           

                               

                                oProductionOrder.Lines.PlannedQuantity = RealQuantity + QtyIss;

                                oProductionOrder.Lines.ItemNo = ItemCode;                             

                                oProductionOrder.Lines.Add();

                                ValRet = oProductionOrder.Update();

 

 

                                #region Validates if there was an error Updating Production Order

                                if (ValRet != 0)

                                {

                                    SBOCompany.GetLastError(out ValRet, out sErrMsg);

                                }

                                #endregion Validates if there was an error Updating Production Order

                            }

 

 

                        }


Viewing all articles
Browse latest Browse all 3363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>