Skip to Content
author's profile photo Former Member
Former Member

creating goods receipt programmatically

I've been busy trying since a while now to create a goods receipt out of c#

I've come up. with the following code i.e. works but doesn't really fill in a valid record to db.

What do also I have to fill ? and how?

/// <summary>

/// Creates the new assembly supply.

/// </summary>

/// <param name="_iProdSupply_Lines">returns the docentry</param>

/// <returns></returns>

private int CreateNewAssemblySupply(IProdSupply _iProdSupply,int _nProductionOrder)


this.m_oInventoryGenExit.Reference2 = "PPS";

this.m_oInventoryGenExit.CardCode = "C1000";

this.m_oInventoryGenExit.Address = null;

this.m_oInventoryGenExit.Comments = null;

this.m_oInventoryGenExit.SalesPersonCode = -1;

this.m_oInventoryGenExit.TransportationCode = -1;

//this.m_oInventoryGenExit.DataSource = null;

//this.m_oInventoryGenExit.VatFirst = null;

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



if (i != 0)


this.m_oInventoryGenExit.Lines.BaseLine = i;

this.m_oInventoryGenExit.Lines.ItemCode = _iProdSupply.Lines.ItemCode;

this.m_oInventoryGenExit.Lines.WarehouseCode = _iProdSupply.Lines.WarehouseTo;

this.m_oInventoryGenExit.Lines.Quantity = _iProdSupply.Lines.Quantity;

this.m_oInventoryGenExit.Lines.BaseType = 0;


//this.m_oInventoryGenExit.Lines.BaseEntry = _nProductionOrder;


int nResult = this.m_oInventoryGenExit.Add();

if (nResult != 0)


string sTest = this.Singleton.SBO.Company.GetLastErrorDescription();



return this.m_oInventoryGenExit.DocEntry;

return -1;

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2007 at 02:13 PM

    Hi Holger,

    In the end of you code what you should do is

    return int.Parse(Singleton.SBO.Company.GetNewObjectKey());

    instead of

    return this.m_oInventoryGenExit.DocEntry;

    The DocEntry property is not filled automatically after you add the document.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.