cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

DI API Round Issue in Goods Receipt Form: Cannot add row without complete batch

former_member209954
Participant
0 Kudos
1,353

Hi Everyone!!!

I have a problem and I was wondering if someone may share some light about it. It is a rounding error while populating a Goods Receipt PO Form with multiple batch numbers using the DI API for SAP 9.2. Most likely, I should round the total quantity received to a particular number of digits, but I don't know what it could be.

To elaborate, I created an application that Automates SAP Business One 9.2 using the DI API. The user identifies the Purchase Order being received and then he enters the received batches and quantities. Once all batches are entered, the application creates a Goods Receipt PO form and posts it. The application works. However, every now and then, the user gets an error after receiving around a dozen batch numbers or so on the same form:

"Error -4014: Cannot add row without complete selection of batch/serial numbers".

I asked the user if he could please receive the provided batches one at a time. The user was kind enough to try one, two and three at a time and everything works. When he tried to receive four at a time, the application received the error previously mentioned.

This behaviour leads me to suspect that this is a rounding issue, where SAP and my application are not using the same number of digits to compute the total quantity received. It would be really helpful to know how many digits should I take into consideration so this scenario does not happen.

Any help is greatly appreciated!!!

Manuel

Accepted Solutions (1)

Accepted Solutions (1)

former_member209954
Participant
0 Kudos

So, we have concluded that this is an SAP data architecture drawback and the cause of this problem is because the Batch Quantity, the Line Quantity and the Units per Measure Factor are rounded to a number of digits (in our case is 4 decimals), in such a way that sporadically the DI API will fail to receive inventory when receiving three or more batches of the same item on the same Goods Receipt Form when the Purchasing Unit of Measure is different than the Inventory Unit of Measure, throwing the following error: "(Error -4014) Cannot add row without complete selection of batch/serial numbers".

To work-around this limitation, we are "massaging" the value of the "Quantity" property of the DI API's DocumentLines object before adding the form in the SAP DI API, in such a way that the conversion of the received quantity from the Purchasing UoM to the Inventory UoM (which is what goes on the "Quantity" property of the BatchNumbers object) gives the number of digits that SAP handles.

The following is the function that we are using to work around this limitation:


Declare @dblFunctionResult float

Set @dblFunctionResult = @dblQuantity

If (1 < @dblUMFactor)
Begin
Set @dblFunctionResult = Round( (@dblQuantity * @dblUMFactor), 4)
Set @dblFunctionResult = Round( (@dblFunctionResult / @dblUMFactor), 6)
End

Return(@dblFunctionResult)


Where @dblQuantity is the received quantity in Purchase Unit of Measure and @dblUMFactor is the UnitsPerMeasure specified in the SAP's Purcahse Order.

We are using this function for every batch received, so the Quantity property of the SAP's DocumentLines object, rounded by the DI API to four digits now matches the sum of the Quantity field of the BatchNumbers object, which uses the Inventory Unit of Measure, also rounded individually by the DI API to four digits.

I hope this helps.

Manuel

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

PO, GRPO AND batch number are default feature also PO to GRPO is automated just by clicking copy to and selecting batches.

Why do you need an extra application to do these things ?

just wanted to know !!!

Thanks

former_member209954
Participant
0 Kudos

Hi Ranu!!

Thanks!!! This custom application runs on an Android industrial handheld, with all the RFID and barcode scanning goods that come with it. That is why they cannot use SAP's UI.

Best Regards,

Manuel