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

"Return Components" In Receipt from Production

Hi Experts,

i need to make entry of "Return Components" In Receipt From Production through SDK code. I have written the following code but it gives error.

10000111 - The field should be empty if the document is referenced to a production order. [IGN1.ItemCode][line: 0]

string Warehouse = ldna_Rec.Fields.Item("wareHouse").Value;

Int32 DocNum = Convert.ToInt32(oForm.Items.Item("edtCode").Specific.Value);

SAPbobsCOM.Documents oreceipt;

oreceipt = clsAddOn.LDNA_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry);

oreceipt.DocDate = TrnDate;

oreceipt.UserFields.Fields.Item("U_MortNum").Value = DocNum;

oreceipt.Comments = "Receipt From Production created based on Prodution order " + DocNum_ProdOrder + " , Daily Transaction " + oForm.Items.Item("edtCode").Specific.Value;

if (oChk.Checked == true && FeedinBlow > 0)

{

// oreceipt.Lines.WarehouseCode = Warehouse;

SAPbobsCOM.Recordset ldna_RecFeed = clsAddOn.LDNA_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

string strFeed = "select TOP(1) T1.U_Code 'FeedCode' from [@CBF_ODYT] T0 Inner join [@CBF_DYT2] T1 on t0.DocEntry = t1.DocEntry Where T0.U_BatchNo = '" + BatchDetail + "' and T0.Canceled != 'Y' and t1.U_Code is not null order by T0.U_Age desc";

ldna_RecFeed.DoQuery(strFeed);

string FeedCode = ldna_RecFeed.Fields.Item("FeedCode").Value;

oreceipt.Lines.BaseType = 202;

oreceipt.Lines.BaseEntry = ProductionOrder;

oreceipt.Lines.ItemCode = FeedCode;

oreceipt.Lines.Quantity = FeedinBlow;

SAPbobsCOM.Items oItemFeed;

oItemFeed = clsAddOn.LDNA_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems);

oItemFeed.GetByKey(FeedCode);

if (oItemFeed.ManageBatchNumbers == SAPbobsCOM.BoYesNoEnum.tYES)

{

ldna_Rec1 = clsAddOn.LDNA_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

string strBatch = "select BatchNum 'Batch Number', SUM( Quantity) 'Quantity' from IBT1 where BaseEntry In (select DocEntry from IGE1 where IGE1.BaseType = 202 and IGE1.BaseEntry = " + ProductionOrder + " and ItemCode = '" + FeedCode + "') and BaseType=60 and ItemCode = '" + FeedCode + "' group by BatchNum";

ldna_Rec1.DoQuery(strBatch);

double Qty = FeedinBlow;

int iBatchLine = 0; //Updated Here

while (!ldna_Rec1.EoF && Qty > 0)

{

string BatchNo = ldna_Rec1.Fields.Item("Batch Number").Value;

if (BatchNo.Length > 0)

{

if (iBatchLine > 0) oreceipt.Lines.BatchNumbers.Add(); //Updated Here

oreceipt.Lines.BatchNumbers.BatchNumber = ldna_Rec1.Fields.Item("Batch Number").Value;

double BatchQty = 0;

if (Qty > ldna_Rec1.Fields.Item("Quantity").Value)

BatchQty = ldna_Rec1.Fields.Item("Quantity").Value;

else

BatchQty = Qty;

oreceipt.Lines.BatchNumbers.Quantity = BatchQty;

Qty = Qty - BatchQty;

oreceipt.Lines.BinAllocations.BinAbsEntry = binAbsI;

SAPbobsCOM.DocumentLinesBinAllocations binI = oreceipt.Lines.BinAllocations;

binI.SerialAndBatchNumbersBaseLine = iBatchLine; //Updated Here

binI.BinAbsEntry = binAbsI;

binI.Quantity = BatchQty; //qty

binI.Add();

ldna_Rec1.MoveNext();

if (Qty <= 0)

break;

iBatchLine++; //Updated Here

}

}

}

oreceipt.Lines.Add();

}

if (oreceipt.Add() == 0)

{

clsAddOn.LDNA_Application.StatusBar.SetText("Receipt Form Production created Sucessfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Success);

//oForm.Items.Item("edtJRmk").Specific.Value = "Rceipt for Production";

}

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2014 at 06:06 AM

    Hi Vikas,

    Try this

    http://scn.sap.com/thread/1129824

    Thanks and Regards.

    Pradeep khodke From KARAD. 😊

    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.