Select SerialNumbers from UD Table

We are using Landed Costs and Container Receipts. When a landed costs container is created and “Shipped” it basically stages the receipt with everything it needs other than Serial Numbers. I was planning on having the Buyers who created the landed costs container upload the Serial Number along with PackSlip, PONum,POLine, PORel, VendorNum, PurPoint.

When the Receiver goes into Container Receipt and “saves” a RcvDtl Line, I want to trigger a Data Directive to query UD24 to get the SerialNumbers associated with that container line and populate them for the user.

Essentially all they would have to do is save the line and then click Receive all

I did some traces and found a number of the BO I need to call to replicate what Epicor is doing when the receiver creates the Serial Numbers manually.

  1. ERP.Proxy.BO.ReceiptImpl GetSelectSerailNumberParams

  2. ERP.Proxy.BO.SelectSerialNumbersImpl GetSerialNumFormat

  3. ERP.Proxy.BO.SelectedSerialNumbersImpl GetNextSN

  4. ERP.Proxy.BO.SelectedSerialNumbersImpl CreateSerailNum

Repeat for total number of Serial Numbers = ContainerShipQTY

x) ERP.Proxy.BO.SelectedSerialNumbersImpl GetNextSN

xi) ERP.Proxy.BO.SelectedSerialNumbersImpl CreateSerailNum

 .

 .

 .
  1. ERP.Proxy.BO.ReceiptImpl ReceiveContainerUpdateUsingArriveDate

  2. ERP.Proxy.BO.ReceiptImpl ReceiveContainer

I basically tried to create a Standard Data Directive on RcvDtl looking for an added line to RcvDtl that has a container ID populated.

Then I began to Invoke BO Methods and define associated TableSets for

Ice.UD24.GetRows Filling a UD24TableSet Variable

  • EPR.Receipt.GetSelectedSerialNumberParams Filling SelectedSerialNumbersParamsTableSet variable

  • Erp.SelectedSerailNaumbers.GetSerialNumFormat Filling a SelectedSerailNumbersTableSet variable

  • Erp.SelectedSerailNaumbers.GetNextSN Filling a SelectedSerailNumbersTableSet variable

  • Erp.SelectedSerailNaumbers.GetSerialNumFormat Filling a SelectedSerailNumbersTableSet variable

  • Erp.SelectedSerailNaumbers.CreateSerialNum Filling a SelectedSerailNumbersTableSet variable

I didn’t get much passed that as none of it seemed to work

Initially I got the Error that ‘SelectSerialNumbersParamsTableset’ exists in both 'Erp.Contracts.BO.Receipt and 'Erp.Contracts.BO.SelectedSerialNumbers

I removed the connections from all the BO I invoked other than the UD24 and added an Email notification to see what id the UD24 variable I created and attempted to populate. This the Error I got when I saved the Container Receipt

Business Layer Exception

The table ttRcvDtl has more than one record

Exception caught in: Epicor.ServiceModel

Error Detail

============

Correlation ID: 4bd336ba-75cc-4a48-b841-445178cf4426

Description: The table ttRcvDtl has more than one record

Program: Epicor.Customization.dll

Method: GetSingleRow

Line Number: 73

Column Number: 17

Table: ttRcvDtl

Client Stack Trace

==================

at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets)

at Erp.Proxy.BO.ReceiptImpl.ReceiveContainerUpdateUsingArriveDate(ReceiptDataSet ds, Int32 inContainerID, Nullable`1 ipArrivedDate, String inCreateNewPoRels, Boolean& outEshReceived, Boolean& outPartialReceipt, Boolean& outReceiveAll)

at Erp.Adapters.ReceiptAdapter.ReceiveContainerUpdateUsingArriveDate(Int32 inContainerID, Nullable`1 ipArrivedDate, String inCreateNewPoRels, Boolean& outEshReceived, Boolean& outPartialReceipt, Boolean& outReceiveAll)

at Erp.UI.App.ContainerReceipts.Transaction.Update()

So yeah…am I going about this the wrong way?

Just to get this out of the way: Your specific BO error happens when you try to update multiple rows when the system is expecting to update one row at a time. The various modules in the system (and even the methods within a module) can be inconsistent on this. Some are fine with you dumping a whole table in. Others freak out like this. Usually wrapping your object in a foreach and running update on each item fixes that issue.

Before you just do that, though, make sure the BO method hasn’t returned the original row plus the new/chnaged row. Sometimes it does that and you need to loop through the modified data only.

Personally, I’d probably create the serial numbers before the receipt occurs. Like, I’d put a pre proc BPM on UD24.Update that goes out and creates an unassigned serial number. That SN will then be in the available list to pull into the receipt. Doing it at that stage will let you validate your input, and might even let you avoid touching receipt entry in the first place. Everything should just be “there” for your people.

Having said that, I’ve never tried to do anything like this. I’m not sure what pitfalls are of my approach.

Not sure how to loop this. I created a TableSet variable for UD24 and configured the Where clause to fill it. It should be populated 6 rows into the tableSet variable. Rather than filling it throws 6 errors saying there is more than 1 row.

I moved my initial trigger to a Standard Data Directive on RcvDtl that looks for a changed row that has a ContainID. It then goes straight into a function that tried to Query UD24 and load the SerialNumber in to a UD24 TableSet variable. From there I am attempting to create the SerialNumbers (GetSNFormat, GetNextSN,CreateSN).

Business Layer Exception

The table UD24.UD24 has more than one record
The table UD24.UD24 has more than one record
The table UD24.UD24 has more than one record
The table UD24.UD24 has more than one record
The table UD24.UD24 has more than one record
The table UD24.UD24 has more than one record

Exception caught in: Epicor.ServiceModel

Error Detail

Correlation ID: 7b5dbee4-1ece-49af-940a-f5f5631439e1
Message No.: 1
Description: The table UD24.UD24 has more than one record
Program: Epicor.Customization.dll
Method: GetSingleRow
Line Number: 73
Column Number: 17
Table: UD24.UD24
Message No.: 2
Description: The table UD24.UD24 has more than one record
Program: Epicor.Customization.dll
Method: GetSingleRow
Line Number: 73
Column Number: 17
Table: UD24.UD24
Message No.: 3
Description: The table UD24.UD24 has more than one record
Program: Epicor.Customization.dll
Method: GetSingleRow
Line Number: 73
Column Number: 17
Table: UD24.UD24
Message No.: 4
Description: The table UD24.UD24 has more than one record
Program: Epicor.Customization.dll
Method: GetSingleRow
Line Number: 73
Column Number: 17
Table: UD24.UD24
Message No.: 5
Description: The table UD24.UD24 has more than one record
Program: Epicor.Customization.dll
Method: GetSingleRow
Line Number: 73
Column Number: 17
Table: UD24.UD24
Message No.: 6
Description: The table UD24.UD24 has more than one record
Program: Epicor.Customization.dll
Method: GetSingleRow
Line Number: 73
Column Number: 17
Table: UD24.UD24

Client Stack Trace

at Epicor.ServiceModel.Channels.ImplBase1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets) at Erp.Proxy.BO.ReceiptImpl.ReceiveContainerUpdateUsingArriveDate(ReceiptDataSet ds, Int32 inContainerID, Nullable1 ipArrivedDate, String inCreateNewPoRels, Boolean& outEshReceived, Boolean& outPartialReceipt, Boolean& outReceiveAll)
at Erp.Adapters.ReceiptAdapter.ReceiveContainerUpdateUsingArriveDate(Int32 inContainerID, Nullable`1 ipArrivedDate, String inCreateNewPoRels, Boolean& outEshReceived, Boolean& outPartialReceipt, Boolean& outReceiveAll)
at Erp.UI.App.ContainerReceipts.Transaction.Update()

Is that the only BO call you have so far? Usually GetRows only craps out if the WhereClause is improperly formatted.

No, I have other Serial Number calls after it but it fails before it gets to them. Basically the DataDirective on RcvDtl is calling a function, and the UD24 GetRows is the first call from the Function.

I removed all the other calls after the UD24 GetRows and was able to output the results to a message box. I think the issue is when I want to use the Serial Number in those rows in CreateSerialNumber call it doesn’t know how to loop though them?

I think this is where the issue is

That makes more sense. You can’t really loop through BO calls using Widgets. You’ll have to use a code widget to foreach through your UD24TableSet.