cancel
Showing results for 
Search instead for 
Did you mean: 

Error trying to use multiple lines from a PO in a Goods Receipt PO

Former Member
0 Kudos

I get the following error when I try to add 2 lines from a PO to a single Goods Receipt PO (code below):

-5002 One of the base documents has already been closed [PDN1.BaseEntry][line: 1]

I can create the Goods Receipt PO if I use 1 line or lines from multiple PO's???


			SAPbobsCOM.Documents poReceipt2 = (SAPbobsCOM.Documents)_diApi.SboCompany.GetBusinessObject(BoObjectTypes.oPurchaseDeliveryNotes);
			poReceipt2.CardCode = "ALL";
			poReceipt2.DocDueDate = DateTime.Now;
			poReceipt2.Lines.Quantity = 5;
			poReceipt2.Lines.ItemCode = "HAMSHA";
			poReceipt2.Lines.BaseEntry = 11;
			poReceipt2.Lines.BaseLine = 0;
			poReceipt2.Lines.BaseType = 22;
			poReceipt2.Lines.Add();
			poReceipt2.Lines.Quantity = 5;
			poReceipt2.Lines.ItemCode = "LAMFIL";
			poReceipt2.Lines.BaseEntry = 11;
			poReceipt2.Lines.BaseLine = 1;
			poReceipt2.Lines.BaseType = 22;
			poReceipt2.Add();

Any help is appreciated!

Thanks,

Daniel

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184566
Active Contributor
0 Kudos

Hi Daniel

It's basically saying that the document you are basing it on (PO), that line is already close or used on another Goods Reciept PO. Check that.Also remember that baseentry refers to the docentry and not the docnum of the PO.

Hope this helps

Former Member
0 Kudos

Hi Louis, thanks for the post...

However the PO document that I am refercing definately has both lines open, if I use 1 of those lines it works fine, but the error occurs if I use 2 lines from the same PO. I am also definately using the docentry not the docnum for the GetByKey() method.

Can anyone run the same basic logic through the DI API? That is create a PO with 2 lines on it, then run the code as above to make a Goods Receipt PO and reference the 2 lines from the 1 PO document? (It works if I add multiple lines referncing lines from multiple PO docs??)

Thanks,

Dan

Message was edited by: Daniel Archer

Former Member
0 Kudos

Hello Daniel,

I have tried your code (with my data, but same structure), it works fine.

Could you please try to create a new Purchase Order and run the code again?

Best Regrads,

Nick

Former Member
0 Kudos

Hi Nick thanks for confirming that runs for me, on closer inspection my real code wasn't setting the BaseLine property!

Cheers,

Dan

Former Member
0 Kudos

Hello Dan,

In my testing, I have set the BaseLine.

HTH,

Nick