cancel
Showing results for 
Search instead for 
Did you mean: 

mandatory Fields Help

thobenjo1
Explorer
0 Kudos
148

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.

View Entire Topic
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