cancel
Showing results for 
Search instead for 
Did you mean: 

Creation of mandatory UDF in A.R Invoice

Former Member
0 Kudos

Dear All,

I am facing the problem for mandatory field creation.

Even i write this below code when adding A.R Invoice it mandatory field is not working.

alter proc SBO_SP_TransactionNotification

@object_type nvarchar(20), -- SBO Object Type

@transaction_type nchar(1), -- [A]dd, <u>pdate, [D]elete, [C]ancel, C[L]ose

@num_of_cols_in_key int,

@list_of_key_cols_tab_del nvarchar(255),

@list_of_cols_val_tab_del nvarchar(255)

AS

begin

-- Return values

declare @error int -- Result (0 for no error)

declare @error_message nvarchar (200) -- Error string to be displayed

select @error = 0

select @error_message = N'Ok'

if @transaction_type = 'A' and @object_type = '13'

begin

if exists(select T0.docdate from OINV T0 where T0.docentry = @list_of_cols_val_tab_del and

T0.U_EnvUbTm = null )

begin

select @error = 100, @error_message = N'You need enter value to the UDF'

end

end

-- Select the return values

select @error, @error_message

end

Please help me.

Thanks in Advance.

Edited by: vivek.Y on May 18, 2011 1:57 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Vivek......

Try this one......

If @object_type='13' and @transaction_type='A'
BEGIN 

if exists(select T0.docdate from OINV T0 where T0.docentry = @list_of_cols_val_tab_del and
T0.U_EnvUbTm Is null )

BEGIN
Select @error = -1,
@error_message = 'You need enter value to the UDF'

End
End

Regards,

Rahul

Former Member
0 Kudos

Thank you Rahul,

It is working now.Now another problem is every time it is not working(like if i enter values into another udfs this is not working).Please tell me how to make it to work every time.And the important thing here is what field i want to make mandatory is linked with another table.

Is there any other way (other than SBO trnasaction type).

Edited by: vivek.Y on May 19, 2011 11:49 AM

K_Pauquet
Advisor
Advisor
0 Kudos

Hi Vivek,

could the bug referenced in the note below be the cause of your troubles:

1536182 - Mandatory UDF requires a default value

All the best,

Kerstin

Former Member
0 Kudos

Thanks Mr.Kerstin Pauquet,

Even i made this UDF as mandatory and i have given defalult value.

My user wants this field as mandatory.But when the default value is populating in this field(automatically when form loads) how can we make this field as mandatory.

Manually if delete that value from the field then only it is saying as mandatory field.

Former Member
0 Kudos

And i am using SAP B1 2007 B with PL14.

Edited by: vivek.Y on May 19, 2011 11:47 AM