cancel
Showing results for 
Search instead for 
Did you mean: 

SP for block discount at GRPO

former_member224367
Participant
0 Kudos

Dear Expert,

Need your help how to control GRN user from to do adjustment/changes on the total discount field using store procedure.

Thanks,

Saufil

View Entire Topic
KennedyT21
Active Contributor
0 Kudos

Hi

Can you explain little more, the discount always should be 0 or should not edit the value which is copied from the PO.

Cheers

former_member224367
Participant
0 Kudos

Hi,


Our company process are copied from PO for GRPO, if the PO have discount the amount will be carried together. The issue is user will change it to match with supplier DO/invoice amount, by right they can't change it.

Thanks,

Saufil

KennedyT21
Active Contributor
0 Kudos

try this 

IF @object_type = '20'

         AND @transaction_type IN ('A', 'u')

      BEGIN

          IF EXISTS(

                 SELECT t1.docentry

                 FROM   opdn t1

                        INNER JOIN pdn1 t2

                             ON  t1.docentry = t2.docentry

  inner join opor c on t2.BaseEntry=c.docentry

                 WHERE  @list_of_cols_val_tab_del = t1.docentry

                     and T1.DiscSum <> c.DiscSum

             )

          BEGIN

              SET @error = -1

            

              SET @error_message = 'You Cannot change the discount'

          END

      END

former_member224367
Participant
0 Kudos

Hi Kennedy,

Thanks for your feedback, your SP is working if no changes on the quantity.

Let say user did the changes on the quantity at line the message "You cannot change the discount" will be appear and we can't proceed.

Thanks,

Saufil

KennedyT21
Active Contributor
0 Kudos

try this

IF @object_type = '20'

         AND @transaction_type IN ('A', 'u')

      BEGIN

          IF EXISTS(

                 SELECT t1.docentry

                 FROM   opdn t1

                        INNER JOIN pdn1 t2

                             ON  t1.docentry = t2.docentry

  inner join opor c on t2.BaseEntry=c.docentry

                 WHERE  @list_of_cols_val_tab_del = t1.docentry

                     and T1.DiscPrcnt<> c.DiscPrcnt

             )

          BEGIN

              SET @error = -1

           

              SET @error_message = 'You Cannot change the discount'

          END

      END