cancel
Showing results for 
Search instead for 
Did you mean: 

SAP B1 8.8 Production Receipt DI-API

Former Member
0 Kudos

Can anyone show me how to report a production receipt for B1 8.8 via the DI-API? I have the following code but it doesn't report the production (it doesn't error out either):

SAPbobsCOM.Documents prodReceipt = (SAPbobsCOM.Documents)sapCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry);

SAPbobsCOM.Document_Lines prodReceiptLines = prodReceipt.Lines;

prodReceiptLines.BaseEntry = docEntry;

prodReceiptLines.Quantity = Convert.ToDouble(mainListView.Items<i>.SubItems[5].Text);

prodReceiptLines.Add();

Any help would be greatly appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Please see sample code below. Just an additional info, the reason you didn't get an error is because you probably created a Goods Receipt(Inventory >> Inventory Transaction >> Goods Receipt). Goods Receipt and Receipt from Production use the same database table in the back end database(tables OIGN and IGN1). The difference is in BaseType field in IGN1. BaseType of 202 means that it is a Receipt from Production. BaseType of -1 means it is Goods Receipt.

SAPbobsCOM.Documents ReceiptProd;
ReceiptProd = (SAPbobsCOM.Documents)(comp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry));
                
ReceiptProd.Lines.BaseEntry = ***DocEntry of the Production Order***  ;
ReceiptProd.Lines.BaseType = 202;
ReceiptProd.Lines.TransactionType = SAPbobsCOM.BoTransactionTypeEnum.botrntComplete;
ReceiptProd.Lines.Quantity = ***Completed Quantity****
ReceiptProd.Lines.Add();


ReceiptProd.Add();

Hope this helps

Krishnan

Former Member
0 Kudos

Thank you for your reply.

Still the same results. No error but no production receipt performed.

Any other ideas?

Former Member
0 Kudos

Please run this code below and let me know what you find.

Int Add_Error;

SAPbobsCOM.Documents ReceiptProd;
ReceiptProd = (SAPbobsCOM.Documents)(comp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry));
                
ReceiptProd.Lines.BaseEntry = ***DocEntry of the Production Order***  ;
ReceiptProd.Lines.BaseType = 202;
ReceiptProd.Lines.TransactionType = SAPbobsCOM.BoTransactionTypeEnum.botrntComplete;
ReceiptProd.Lines.Quantity = ***Completed Quantity****
ReceiptProd.Lines.Add();
 
 
Add_Error = ReceiptProd.Add();

if(Add_Error == 0)
{
	MessageBox.Show("Successfully Added Receipt From Production");
}
else
{
	MessageBox.Show("Receipt from Production failed with the following error." + "\nSAP Error Code: " +
                        comp.GetLastErrorCode().ToString() + "\n" + comp.GetLastErrorDescription());
}

Please reply with what you find.

Thanks,

Krishnan