cancel
Showing results for 
Search instead for 
Did you mean: 

mandatory Fields Help

thobenjo1
Explorer
0 Kudos
145

Dear Experts,

I want to make U_BRD AND U_Category in Sales order mandatory in stored procedure, can you please let me know the wuery for this.

Accepted Solutions (0)

Answers (2)

Answers (2)

SonTran
Active Contributor
0 Kudos

Hi,

You can tick Mandatory when add/update an UDF, refer the screenshot

Hope this helps,

Son Tran

thobenjo1
Explorer
0 Kudos

I tried doing this but it will affect all the marketing documents

SonTran
Active Contributor
0 Kudos

Hi,

If this causes any issue on other transactions, so notification is a better solution.

SonTran
Active Contributor
0 Kudos

Try this,

IF :object_type = '17' and (:transaction_type = 'A' or :transaction_type ='U') 

THEN
BEGIN

IF EXISTS (
select T0."DocEntry" from ORDR T0
where T0."DocEntry" = :list_of_cols_val_tab_del
and (ifnull(T0."U_BRD",'')='' or ifnull(T0."U_Category",'')='')
)
THEN
BEGIN
error := 1701;
error_message := N'BRD or Category can not be null, please check again.';
END;
END IF;
END IF;

Hope this helps,

Son Tran

mgregur
Active Contributor
0 Kudos

Hi,

declare order_cnt int and try this:

IF :object_type = N'17' AND (:transaction_type = N'A' OR :transaction_type = N'U') THEN
SELECT IFNULL(COUNT(*),0) INTO order_cnt
FROM ORDR T0
   WHERE T0."DocEntry"= :list_of_cols_val_tab_del 
   AND ((IFNULL(T0."U_BRD",'') <> '') OR(IFNULL(T0."U_Category", '') <> '')) ;

   if :order_cnt > 0 THEN
               begin
               error := 1;
               error_message := N'Fields BRD and Category are mandatory';
               end;
   end if;
end if;

order_cnt:= 0;

BR,

Matija

thobenjo1
Explorer
0 Kudos

Thank you for the response but I am getting an error

Msg 102, Level 15, State 1, Procedure SBO_SP_TransactionNotification, Line 534 [Batch Start Line 7]

Incorrect syntax near ':'.

Msg 195, Level 15, State 10, Procedure SBO_SP_TransactionNotification, Line 535 [Batch Start Line 7]

'IfNULL' is not a recognized built-in function name.

mgregur
Active Contributor
0 Kudos

Hi,

I wrote it on HANA, if you are using SQL then IFNULL needs to be changed to ISNULL. SQL and HANA statements are somewhat different.

BR,

Matija