on 04-18-2018 3:33 PM
Good day experts, I have the following code that creates a sale offer (quotation) within SAP through the DI API in a web page:
private void CrearDocumento()
{
if (oCompany == null || !oCompany.Connected)
this.ConectarCompany();
Documents Cotizacion = oCompany.GetBusinessObject(BoObjectTypes.oQuotations);
Cotizacion.CardCode = txtCodigoCliente.Text.ToString();
Cotizacion.DocDate = DateTime.Now;
Cotizacion.DocDueDate = DateTime.Now.AddMonths(1);
Cotizacion.Series = 13;
Cotizacion.DocCurrency = ddlMoneda.SelectedItem.Text.ToString();
//Líneas
Cotizacion.Lines.SetCurrentLine(0);
Cotizacion.Lines.ItemCode = txtArticulo.Text.ToString();
Cotizacion.Lines.Quantity = double.Parse(txtCantidadArticulo.Text.ToString());
Cotizacion.Lines.Price = double.Parse(txtPrecioArticulo.Text.ToString());
Cotizacion.Lines.DiscountPercent = double.Parse(txtDescuentoArticulo.Text.ToString());
Cotizacion.Lines.UoMEntry = Convert.ToInt32(ddlUoM.SelectedValue.ToString());
if (Convert.ToInt32(ddlUoM.SelectedValue.ToString()) != -1)
Cotizacion.Lines.UseBaseUnits = BoYesNoEnum.tNO;
else
Cotizacion.Lines.UseBaseUnits = BoYesNoEnum.tYES;
Cotizacion.Lines.TaxCode = "A4";
Cotizacion.Lines.WarehouseCode = "MTY";
Cotizacion.Lines.ProjectCode = "01MTY";
Cotizacion.Comments = "Comentarios..";
//Crear cotización
int iret = Cotizacion.Add();
}
I have two doubts about this, the first is if there is a way that through the DI API, I can bring the total cost ($) of the line of the article, that is, when I select an article code I have to execute a query which brings me the units of measure, the price, etc., but I must do it "manually", I wanted to ask if the DI API has any option to do this.
And the second and most important, I was looking for topics related to the memory consumption of the DI API and I found this post:
Could you support me by checking my code and checking if it is written in the correct way ?, or if it is required to do some type of "cleaning" elements (eg Garbage Collector, Dispose, return everything to NULL, etc.) .
I thank you in advance for any support, example, comment or guidance that you can give me. Best regards.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.