---
# System prepended metadata

title: grpo?

---

```csharp=
// Start a new Goods Receipt PO
SAPbobsCOM.Documents oGRPO = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes);

// Set header properties
oGRPO.CardCode = "CardCode";  // Replace 'CardCode' with the actual CardCode
oGRPO.DocDate = DateTime.Today;
oGRPO.DocDueDate = DateTime.Today;

// Set line properties
oGRPO.Lines.ItemCode = "ItemCode";  // Replace 'ItemCode' with the actual ItemCode
oGRPO.Lines.Quantity = 1;
oGRPO.Lines.Price = 10; // Replace with actual price

// Set batch numbers
if (oGRPO.Lines.BatchNumbers.SetCurrentLine(0))
{
    oGRPO.Lines.BatchNumbers.BatchNumber = "Batch001"; // Replace with actual Batch Number
    oGRPO.Lines.BatchNumbers.Quantity = 1;
    oGRPO.Lines.BatchNumbers.AddmisionDate = DateTime.Today;
    oGRPO.Lines.BatchNumbers.Add();
}

// Add the document
int addResult = oGRPO.Add();

if (addResult == 0)
{
    Console.WriteLine("Successfully created GRPO.");
}
else
{
    int errorCode;
    string errorDescription;
    oCompany.GetLastError(out errorCode, out errorDescription);
    Console.WriteLine($"Failed to create GRPO. Error {errorCode}: {errorDescription}");
}

// Clean up the COM object
System.Runtime.InteropServices.Marshal.ReleaseComObject(oGRPO);
oGRPO = null;

```