cancel
Showing results for 
Search instead for 
Did you mean: 

Approval Procedure

Former Member
0 Kudos

Hi Experts,

I need query for approval procedure to block sale order if a UDF field in BP master is null.

Thanks and regards,

Bharathiraja

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try this:

SELECT distinct 'TRUE'

FROM OCRD T0

INNER JOIN ORDR T1 ON T0.CardCode = T1.CardCode

WHERE T0.CardCode=$[$4.0.0] and T0.[U_UDF] is null

Regards,

Former Member
0 Kudos

Hi MS,

Thank you for your reply, Sale order is adding even though  the UDF field is null

former_member184146
Active Contributor
0 Kudos

Hi,

try this

SELECT distinct 'TRUE'

FROM OCRD T0

INNER JOIN ORDR T1 ON T0.CardCode = T1.CardCode

WHERE T0.CardCode=$[ORDR.CardCode] and isnull(T0.[U_UDF],'0')='0'



--Manish

Former Member
0 Kudos

Try this,

SELECT distinct 'TRUE'

FROM OCRD T0

INNER JOIN ORDR T1 ON T0.CardCode = T1.CardCode

WHERE T0.CardCode=$[$4.0.0] and isnull(T0.[U_UDF],0)=0

Regards,

frank_wang6
Active Contributor
Former Member
0 Kudos

Hi MG,

Its working fine when the UDF is null, but when the UDF is not null means i'm getting the following error message.

Could not commit transaction: Error -1 detected during transaction 'G/L Accounts' (OACT)

Former Member
0 Kudos

Hi,

Can you post some screenshots?

the approval is working perfect on me.

Regards,

former_member212181
Active Contributor
0 Kudos

Hi Bharathiraja,

Please try below query.

I made small change in MG S's query and its working fine in my system.

SELECT distinct 'TRUE'

FROM OCRD T0

INNER JOIN ORDR T1 ON T0.CardCode = T1.CardCode

WHERE T0.CardCode= $[$4.0.0] and Len(isnull(T0.U_CL,''))=0

Thanks

Unnikrishnan

Former Member
0 Kudos

Hi,


I know where the error is coming. When I tried putting alphanumeric characters on the UDF, I also encountered same as you.


Unnikrishanan's query will be perfect for you.


Regards,


Answers (1)

Answers (1)

frank_wang6
Active Contributor
0 Kudos

TN will be better.

IF @object_type = '17' AND @transaction_type = 'A'

BEGIN

  IF (SELECT T1.U_TEST FROM ORDR T0 INNER JOIN OCRD T1 ON T0.CARDCODE = T1.CARDCODE AND T0.DOCENTRY = @list_of_cols_val_tab_del) IS NULL

  BEGIN

  SET @error = -5001;

  SET @error_message = N'U_TEST ON BP MUST NOT BE NULL';

  END

END

Frank

Former Member
0 Kudos

Hi Frank,

If i apply TN, then document will be blocked. In my case document should go for approval. So TN will not fulfill my requirement.