on 11-07-2014 5:46 PM
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.
Hola
creo que el error es que estás utilizando la línea 0, cuando ésta se genera automáticamente al crear el objeto.
Tienes que ejecutar lines.Add() cuando sea mayor que 0.
Un saludo
Agustín Marcos Cividanes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Buenas tardes
Creo que deberías preguntar primero si el status de la linea es "bost_open" o de lo contrario dará error.
Saludos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.