Skip to Content
0
Former Member
Nov 29, 2009 at 11:50 AM

How To Add Delivery Note Based On A/R Reserve Invoice Number

194 Views

I Need To Add Delivery Note Based On A/R Reserve Invoice Number is 94 Ho Can I Do This Pls Help Me.

Error Message Will Return "-5002 This field is not supported in this document [ODLN.isIns][line: 1]"

This Is My Code.

string objCode = "", errMsg = "";

string ErrorMessage = "";

int retCode, errCode = 0;

var oCompany = CommonSAP.CommonSAP_Company();

Documents oDeleveryNote;

oCompany.GetNewObjectCode(out objCode);

oDeleveryNote = (Documents)oCompany.GetBusinessObject(BoObjectTypes.oDeliveryNotes);

oResInvoice.ReserveInvoice = BoYesNoEnum.tYES;

oDeleveryNote.DocType = BoDocumentTypes.dDocument_Items;

oDeleveryNote.CardCode = shipEntryHeader.CustomerCode;

oDeleveryNote.ReserveInvoice = BoYesNoEnum.tYES;

oDeleveryNote.TaxDate = DateTime.Now;

oDeleveryNote.DocDueDate = DateTime.Now;

oDeleveryNote.DocDate = DateTime.Now;

oDeleveryNote.Comments = shipEntryHeader.Comments;

#region line charges

foreach (var item in shipEntryDetailList)

{

oDeleveryNote.Lines.BaseEntry = System.Convert.ToInt32(94);

oDeleveryNote.Lines.BaseLine =0;

oDeleveryNote.Lines.BaseType = System.Convert.ToInt32(SAPbobsCOM.BoObjectTypes.oInvoices);

oDeleveryNote.Lines.TaxCode = item.TaxCode;

oDeleveryNote.Lines.Add();

}

#endregion

retCode = oDeleveryNote.Add();

if (retCode != 0)

{

//error occured

oCompany.GetLastError(out errCode, out errMsg);

ErrorMessage = errCode + " " + errMsg;

throw new Exception(ErrorMessage);

}

Edited by: Ranil Prasanna De Silva on Nov 29, 2009 5:20 PM