Quantcast
Channel: SCN : All Content - SAP Business One (Español)
Viewing all articles
Browse latest Browse all 982

Copiar cotización a Pedido vía Di APi

$
0
0

Estoy tratando de copiar una cotización a pedido con este código:

 

 

SAPbobsCOM.Documents cotizacion = (SAPbobsCOM.Documents)SesionActual.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oQuotations);

 

 

                if (!cotizacion.GetByKey(docEntry))

                    return false;

 

 

                SAPbobsCOM.Documents pedido = (SAPbobsCOM.Documents)SesionActual.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);

 

 

                pedido.Series = 6;

                pedido.CardCode = cotizacion.CardCode;

                pedido.DocDate = DateTime.Today;   

                pedido.TaxDate = DateTime.Today;

                pedido.Confirmed = SAPbobsCOM.BoYesNoEnum.tYES;               

                pedido.TransportationCode = cotizacion.TransportationCode;

                pedido.ShipToCode = cotizacion.ShipToCode;

                pedido.SalesPersonCode = cotizacion.SalesPersonCode;

                pedido.NumAtCard = cotizacion.NumAtCard;

                pedido.ContactPersonCode = cotizacion.ContactPersonCode;

                for (int i = 0; i < cotizacion.Lines.Count; i++)

                {

                    cotizacion.Lines.SetCurrentLine(i);

                    pedido.Lines.BaseEntry = cotizacion.DocEntry;

                    pedido.Lines.BaseLine = i;

                    pedido.Lines.BaseType = (int)SAPbobsCOM.BoObjectTypes.oQuotations;

                    pedido.Lines.Add();

                }

 

 

                pedido.DocDueDate = DateTime.Today;               

                int res = pedido.Add();

                if (res != 0)

                {

                    String msgError = "";

                    int msgClave = 0;

                    SesionActual.oCompany.GetLastError(out msgClave, out msgError);

                }

 

Pero al añadir el pedido me regresa el siguiente error:

 


Internal error (-2010) occurred


No sé que pueda ser, tengo comentado el transaction notification y aún así me da el error en algunos pedidos, en otros si los copia bien.


Viewing all articles
Browse latest Browse all 982

Trending Articles



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