cancel
Showing results for 
Search instead for 
Did you mean: 

Purchase Order approval based on condition

MukeshSingh
Participant
0 Kudos

Hi Expert,

We need approval Query for purchase order

Condition:

If any supplier not belong to same country and other than local currency and UDF attachment is not null then going for approval.


Can any one suggest.


Thanks in advance


Mukesh Singh

Accepted Solutions (1)

Accepted Solutions (1)

KennedyT21
Active Contributor
0 Kudos

Have you tried this..

SELECT DISTINCT 'True'

FROM   OPOR t0

       INNER JOIN OCRD t1

            ON  t0.CardCode = t1.CardCode

WHERE  t1.Currency <> 'INR'

       AND t1.country <> 'IN'

       AND ISNULL(t0.U_APInvAttc, '') = ''

       AND t0.docnum = $[OPOR.docnum]

Rgds

Answers (1)

Answers (1)

KennedyT21
Active Contributor
0 Kudos

Try This

If $[OPOR.doccur] <>'INR'

  or $[OPOR.AtcEntry] IS null

   Select 'False'

else

   Select 'True'

Change the INr to your local currency...

Hope helpful

Regards

Kennedy

MukeshSingh
Participant
0 Kudos

Hi Kennedy,


I try but it's working for all supplier our condition is not working.


Select Distinct 'True'

         from OPOR t0 inner join OCRD t1 on t0.CardCode=t1.CardCode

         where  t1.Currency<>'INR' and t1.country<> 'IN' and isnull($[OPOR.U_APInvAttc],'')=''

Please assist.

Regards,

Mukesh


former_member212181
Active Contributor
0 Kudos

Hi Mukesh,

Please try below query for approval procedure

---------------

declare @Loccur Varchar (3), @Country Varchar (2)

Set @Loccur = 'INR'

Set @Country = 'IN'

Select Distinct Case When $[$63.0.0] <> @Loccur then 'True'

  When T1.Country <> @Country then 'True'

                        When isnull($[OPOR.U_APInvAttc],'')='' then 'True'

  Else 'False' end

From OCRD T1 where T1.CardCode =$[$4.0.0]

-------

Thanks

Unnikrishnan

KennedyT21
Active Contributor
0 Kudos

Try This

SELECT DISTINCT 'True'

FROM   OPOR t0

       INNER JOIN OCRD t1

            ON  t0.CardCode = t1.CardCode

WHERE  t1.Currency <> 'INR'

       AND t1.country <> 'IN'

       AND ISNULL(t0.U_APInvAttc, '') = ''

       AND t0.docnum = $[OPOR.docnum]

Rgds

Kennedy

MukeshSingh
Participant
0 Kudos

Hi Unnikrishnan,

Your approval query is working but can you change small more

Our requirement If currency, country and udf attachment three condition are not matching then goes for approval.

former_member212181
Active Contributor
0 Kudos

Hi Mukesh,

I don't understand.

Please convey your exact requirement.

Thanks

Unnikrishnan