cancel
Showing results for 
Search instead for 
Did you mean: 

Want A Modification in TN that blocks to add PO....

former_member225732
Contributor
0 Kudos

Hello Expert,

     I created one TN to block to add Purchase order if 6 PO for the particular vendor is open.

     The following TN is working fine if we do not given any Approval template to it.

     The TN is as follows:-

  IF @object_type = '22' AND @transaction_type IN ('A')

      BEGIN

         IF ((SELECT Count(t1.docentry) FROM OPOR t1

              where CardCode=(Select Cardcode from OPOR where docentry=@list_of_cols_val_tab_del ))) > 6

          BEGIN

              SET @error = -2

              SET @error_message = ' You Cannot Perform this Action Because this vendor already 6 or greater that 6 Purchase Order Open'

          END

      END




Now I want modification in the TN is as follows:

Now i applies Approval Procedure then,


1) if for a particular vendor if 6 PO is opened then next PO will not be added,

2) As well as no draft document will be added in the system.


Regards,

Sandesh

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Sandesh,

TN and approval can't be co-exist. You have to decide only using one of them. If approval is needed for any PO that opened more than 6 for a vendor, go for approval by termed condition. TN will be no need.

Thanks,

Gordon

former_member186712
Active Contributor
0 Kudos

Hi Sandesh,

1. I think that you need other test in the where clause because if the customer has more than 6 PO closed the TN will not allow the user to add other PO.

2. Please post the query that you use in the Approval.

Regards,

Augusto

former_member225732
Contributor
0 Kudos

Sir,

   I dont written in Approval Procedure. I selected always....

Regards,

Sandesh

former_member225732
Contributor
0 Kudos

Hello sir,

Given TN is working fine when I not used approval procedure.

But when I added approval procedure,it stored that PO in draft until I not approve it and add that PO.if i used above TN, it give permission to add draft,after i approve it and try to add PO then it gives me Block msg error.

I need it to block to add draft in this case if 6 PO is open in the system for the specified vendor....

Regards,

sandesh

former_member186712
Active Contributor
0 Kudos

Hi Sandesh,

The problem is if you send alwaus to approval, always will be saved as a draft.

You need to create a query and only send to approval if the PO has less than 6 open documents.

Regards,

Augusto

former_member225732
Contributor
0 Kudos

Hello Sir,

  How can i do it...??

  And i want to block it if for a vendor 6 PO is open....

Regards,

Sandesh

former_member225732
Contributor
0 Kudos

How can i found there is 6 PO is open for the particular vendor,how can i write query...??

former_member186712
Active Contributor
0 Kudos

Hi,

1. In your TN you have to add

where T1.DocStatus = 'O' and CardCode .. (and the rest that you have)

2. You need to create a query more or less like this:

SELECT 'True' from OCRD T0  Where T0.[CardCode] =$[OPOR.CardCode] and (SELECT Count(t1.docentry) FROM OPOR t1 

              where T1.CardCode=(Select T1.DocStatus = 'O' and Cardcode from OPOR ))) < 6

3. In the approval you have to remove the always and select "When The Following Applies"

4. in the query name you have to select the query that you created in 2.

Hope it helps,

Augusto

former_member225732
Contributor
0 Kudos

helllo sir,

   means i also add to TN and query for approval or only query for appoval ??

regards,

sandesh

former_member186712
Active Contributor
0 Kudos

Hi,

The TN is to avoid the user to add a document if the customer has more than 6 open orders,

The approval I don't know why you need it but if you need other user to approve the PO, you need the approval.

If you just want to avoid the user to add a PO if the customers has more than 6 open PO you just need the TN.

I hope it helps,

Regards,

Augusto

former_member225732
Contributor
0 Kudos

Hello Sir,

     I want approval becoz if manager approve PO then only user can add PO.

Regards,

Sandesh

former_member186712
Active Contributor
0 Kudos

Ok.

You need both.

If you feel that this question was answered please close the thread by marking helpful answer/Correct answer.

Of course if you have any other question, just let me know.

Regards,

Augusto

former_member225732
Contributor
0 Kudos

Hello Sir,

  

SELECT 'True' from OCRD T0  Where T0.[CardCode] =$[OPOR.CardCode] and (SELECT Count(t1.docentry) FROM OPOR t1 

              where T1.CardCode=(Select T1.DocStatus = 'O' and Cardcode from OPOR ))) < 6


this query is working fine.....


Regards,

Sandesh

former_member186712
Active Contributor
0 Kudos

Nice

former_member225732
Contributor
0 Kudos

Hello Sir,

  

SELECT 'True' from OCRD T0  Where T0.[CardCode] =$[OPOR.CardCode] and (SELECT Count(t1.docentry) FROM OPOR t1 

              where T1.CardCode=(Select T1.DocStatus = 'O' and Cardcode from OPOR ))) < 6


this query is not working fine.....


Regards,

Sandesh

former_member186712
Active Contributor
0 Kudos


Try this

SELECT 'True' from OCRD T0  Where T0.[CardCode] =$[OPOR.CardCode] and (SELECT Count(t1.docentry) FROM OPOR t1 

              where T1.CardCode= $[OPOR.CardCode] and T1.DocStatus = 'O' ) < 6

former_member186712
Active Contributor
0 Kudos

Hi Sandesh,

Did you try this query?

former_member225732
Contributor
0 Kudos

Hello Expert,

    Please give me solution....

Regards,

Sandesh