cancel
Showing results for 
Search instead for 
Did you mean: 

validation

0 Kudos
287

in sale order i created one udf feild, in udf feild there are two drop down (sapre and set) if i choose sapre the docnum is must start in 30000 otherwise entry dont allowed

Accepted Solutions (0)

Answers (2)

Answers (2)

SonTran
Active Contributor
0 Kudos

Hi,

I suggest to use Document Numbering to achieve your requirement. You don't need to create UDF, FMS or SPTN to control user action. Once user choose specific series (sapre/set), document numbering is followed to your definition.

You can refer the below screenshot

Hope this helps,

Son Tran

mgregur
Active Contributor
0 Kudos

Hi,

if you need to have an automatic selection of the Numbering series , you need to set up a formatted search on that field. Syntax would be approx (note that I do not know your field naming or values):

SELECT
CASE WHEN $[$U_UDF.0] = 'sapre' THEN T0."Numbering series wanted"
ELSE T0."Other numbering series"
END
FROM NNM1 T0

Change the respective field names and values.

If you want a block in case someone selected the wrong Numbering series, you need a Stored Procedure (TransactionNotification). Add the variable block_cnt (int) to the list and add this code:

IF :object_type = N'17' AND (:transaction_type = N'A') THEN
SELECT IFNULL(COUNT(*),0) INTO block_cnt
FROM ORDR T0
WHERE T0."DocEntry"= :list_of_cols_val_tab_del 
AND ((T0."U_UDF" = 'sapre' AND T0."Series" = 'Set numbering series') OR (T0."U_UDF" = 'set' AND T0."Series" = 'Sapre numbering series'));
IF :block_cnt > 0 THEN BEGIN error := 1; error_message := N'Wrong numbering series selected'; END; END IF; END IF;

BR,

Matija