cancel
Showing results for 
Search instead for 
Did you mean: 

Production Issue and Production Receipt C# Code sample, please.

0 Kudos

Hello everyone, I’m trying to code a solution for shop floor that involves Issue to Production and receipt to production, but the SAP objects for that doesn’t exist, or can't find it.

Can you please help me with a sample for this transaction?

This is the SAP object that I want to affect:

Accepted Solutions (0)

Answers (3)

Answers (3)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Dear fitt,

In order to get Order No. and Row No., you need to use something like this:

oDoc.Lines.BaseType = 202; //Production Order Object Type
oDoc.Lines.BaseEntry = 30; // Production Order DocEntry
oDoc.Lines.BaseLine = 1; //Line No. from Production Order

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

0 Kudos

Thanks for the recommendation but still my code is not generating any new Issue to production, even I put some validations to check if the information is getting some error or something but no error and just don’t generate. Could you please check my code and see if something is not correct?

if (!oCompany.InTransaction)

oCompany.StartTransaction();

SAPbobsCOM.Documents oDoc = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenExit);

oDoc.Lines.BaseType = 202; //Production Order Object Type

oDoc.Lines.BaseEntry = 152;

oDoc.Lines.BaseLine = 1; //Line No. from Production Order

//oDoc.Lines.BatchNumbers.Quantity = 100;

//oDoc.Lines.BatchNumbers.BatchNumber = "MP-MP-MP";

//oDoc.Lines.BatchNumbers.ManufacturerSerialNumber = "MP-MP-MP";

//oDoc.Lines.BatchNumbers.InternalSerialNumber = "MP-MP-MP";

oDoc.Lines.Quantity = 100;

//oDoc.Lines.ItemCode = "828282";

//oDoc.Lines.BinAllocations.Quantity = 1200;

//oDoc.Lines.WarehouseCode = "MP";

//oDoc.Lines.BinAllocations.BinAbsEntry = 1;

//oDoc.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;

//oDoc.Lines.FreeText = "Test";

//oDoc.GetByKey(41);

oDoc.Comments = "Prueba";

int ret1 = oDoc.Add();

string res1 = oDoc + ":" + oCompany.GetLastErrorDescription();

TextBox1.Text = Convert.ToString(oDoc.Add());

if (ret1 == 0)

{

lblNoOrden.Visible = true;

if (oCompany.InTransaction)

oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack);

}

else

if (oCompany.InTransaction)

oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack);

if (res1.Length > 1)

lblProceso.Visible = true;

}

}

catch

{

lblProYaReg.Visible = true;

}

}

}

}

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Dear fitt,

Kindly check the Documents object under SDK Help File which should help you:

  • oInventoryGenExit (For Issue for Production)
  • oInventoryGenEntry (For Receipt from Production)

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

0 Kudos

Thanks for the answer ANKIT, indeed the objects that you mentioned are the one that has to be used to achieve the DI, but I'm still facing some trouble about getting to those specific fields that I show on the attached image.

Let me share you me code:

oCompany.StartTransaction();

SAPbobsCOM.Documents oDoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry); oDoc.Comments = "Test";

oDoc.Lines.ItemCode = "8200103";

oDoc.Lines.Quantity = 2000;

oDoc.Lines.FreeText = "Test";

Cannot find the "Order No" Field, the "Row. No." and I think I got quantity.

Do you have any code that you can share to get these fields?

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dear fitt,

The following code works fine for me:

SAPbobsCOM.Documents oIssueForProduction = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenExit);
oIssueForProduction.Lines.BaseEntry = 155;
oIssueForProduction.Lines.BaseType = 202;
oIssueForProduction.Lines.BaseLine = 0;
oIssueForProduction.Lines.Quantity = 5;
int AIFP = oIssueForProduction.Add();

The Issue Method on Production Order for my Item is Manual.

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP Business One Support