cancel
Showing results for 
Search instead for 
Did you mean: 

A/R invoice (making udf mandatory)

Former Member
0 Kudos

Hi All Experts,

I am trying to make some UDF mandatory in A/R Invoice as object_type '13' and transaction_type 'A' and 'U'.The problem is it not at all working and this invoice is sent for financial approval ,i am trying this which is wrong query as

IF @transaction_type = 'A' AND @object_type = '13' 
BEGIN    
if exists (Select T0.cardcode from oinv T0 where T0.U_Region is null and T0.DocEntry=@list_of_cols_val_tab_del)
	begin
		SET @error = 10
		SET @error_message = N'Enter Region'
	end
END

Can any one guide me with right query in repect to the approval process.

Regards,

Inder

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

seen already fro those i had cleared all other notificaton and tried it alone its still enter into Draft.

Regards,

Inder

former_member204969
Active Contributor
0 Kudos

When an approval procedure is activated, the transaction is stored as a draft in the ODRF table. And the object type passed to the procedure is 112 !

So you should write different code to manage the draft documents. For example for an invoice you should start your code with something like this:

IF @transaction_type = 'A' AND @object_type = '112' 
 And  (Select ObjType From ODRF
       Where DocEntry = @list_of_cols_val_tab_del)='13' --. 

Answers (13)

Answers (13)

Former Member
0 Kudos

Hi,

Ok

Thanks and Regards,

Inder

Former Member
0 Kudos

Here is the code

IF @transaction_type = 'A' AND @object_type = '112' 
BEGIN    
if exists (Select T0.docentry from ODRF T0 where (T0.U_Region is null or T0.U_Region = '') and T0.DocEntry=@list_of_cols_val_tab_del)
	begin
		SET @error = 10
		SET @error_message = N'Enter Region'
	end
END

former_member204969
Active Contributor
0 Kudos

Pay attention!

You should insert the condition

and T0.ObjType=u201913u2019

to avoid rejecting other type draft transactions. (Every draft transaction is stored with 112 object type into the ODRF table!)

Former Member
0 Kudos

Hi István K#rös,

you are right ...it solved my problem...thanks..

Thanks & Regards

Inder

Former Member
0 Kudos

hi,

OK,its the cause what should be the query under this condition.

Regards

Inder

Former Member
0 Kudos

Hi,

Is any other detail required to solve this one??

help???

Regards,

Inder

Former Member
0 Kudos

Hi,

Its nvarchar(MAX) in DB

Regards,

Inder

former_member204969
Active Contributor
0 Kudos

Then I can imagine only two things:

1. you placed your code in the SP in a place where it is not executed

2. or you defined a default value for the UDF.

former_member204969
Active Contributor
0 Kudos

Your original code is working with a numeri/alphanumeric type field without default value. (With @transaction_type In ('A','U') modification for update transactions).

What is your field type?

Former Member
0 Kudos

Now. what to do?

Former Member
0 Kudos

Yes,

Former Member
0 Kudos

Thanga Raj K,

Yes, i am doing it SBO_SP_TransactionNotification procedure..

There are different validations too.but those are working.. but this one is a only one not working .

i am trying all this in test DB.

Regards,

Inder

Former Member
0 Kudos

Hi!

is that a udf in oinv header ?

Former Member
0 Kudos

Hi Thanga Raj K,

Same no response from the invoice i am confused it is not displaying any thing from this query's. and yes, It do have and approval window attached to it .Do i need to check draft also..?

Regards,

Inder.

Former Member
0 Kudos

Hi!

Where do u execute the query ?

It is a Stored Procedure, not a Approval Query .

You have to run this query in the SP_TransNotification SP.

    • Please try all this in TEST DB.

Former Member
0 Kudos

Hi!

Try this

IF @transaction_type = 'A' AND @object_type = '13' 
BEGIN    
if exists (Select T0.docentry from oinv T0 where (T0.U_Region is null or T0.U_Region = '') and T0.DocEntry=@list_of_cols_val_tab_del)
	begin
		SET @error = 10
		SET @error_message = N'Enter Region'
	end
END

Former Member
0 Kudos

Hi,

any one