cancel
Showing results for 
Search instead for 
Did you mean: 

SPTN for decimal

Former Member
0 Kudos

Hi Experts,

            In my Item Master Data, few Items are Discrete Products, like Computer, Laptop, Printers etc, So I maintain their inventory in Numbers/EACH.

          I have entered Purchase UoM, Sales UoM and Inventory UoM for those items as EACH.

          In my company , there are few users who made some transactions of SALES and PURCHASE of these items of Quantity with Decimal like SALES of 3.7 Computer, Purchase of 8.12 Laptop etc. and transaction had done successfully.

Which is practically wrong.

It has badly effected my Inventory. Now I want to block these type of transaction like if UoM is EACH/NO then user cant make transaction with Decimal values.

Please suggest any SPTN.

Thanking in Advance.

Ramesh Kumar

Accepted Solutions (0)

Answers (1)

Answers (1)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Try this SPTN for PO:

IF @transaction_type in ('A','U') AND (@OBJECT_TYPE='22')

BEGIN

If exists (select T0.DocEntry FROM OPOR T0  INNER JOIN POR1 T1 ON
T0.DocEntry = T1.DocEntry where T0.DocEntry =
@list_of_cols_val_tab_del and T1.[Quantity] <> cast(
T1.[Quantity]  as Int))

Begin

SET @error = 10
SET @error_message = 'Please enter correct qty'

End
End

For sales order:

IF @transaction_type in ('A','U') AND (@OBJECT_TYPE='17')

BEGIN

If exists (select T0.DocEntry FROM OPOR T0  INNER JOIN POR1 T1 ON
T0.DocEntry = T1.DocEntry where T0.DocEntry =
@list_of_cols_val_tab_del and T1.[Quantity] <> cast(
T1.[Quantity]  as Int))

Begin

SET @error = 10
SET @error_message = 'Please enter correct qty'

End
End

Thanks & Regards,

Nagarajan