cancel
Showing results for 
Search instead for 
Did you mean: 

Project Code Mandatory in Purchase request & PO

Former Member
0 Kudos

Dear Experts,

I want to make Project mandatory field for Purchase request & Purchase Order Document. Please help me to provide SP_TN??

Regards

Mohamed Yousuf Ali M I

Accepted Solutions (1)

Accepted Solutions (1)

KennedyT21
Active Contributor
0 Kudos

Try This

IF @object_type = '1470000113'

         AND @transaction_type  in ( 'A' ,'U')

      BEGIN

          IF EXISTS (

                 SELECT t1.DocEntry

                 FROM   OPRQ t1

     INNER JOIN PRQ1 t2

                             ON  t1.DocEntry=t2.docentry

  

                 WHERE  @list_of_cols_val_tab_del = t1.DocEntry

                        AND 

                                ISNULL(t2.project, '') = ''

                                

                           

             )

          BEGIN

              SET @error = -2

             

              SET @error_message = 'Select the projects for the Purchase request'

          END

      END

IF @object_type = '22'

         AND @transaction_type  in ( 'A' ,'U')

      BEGIN

          IF EXISTS (

                 SELECT t1.DocEntry

                 FROM   opor t1

     INNER JOIN por1 t2

                             ON  t1.DocEntry=t2.docentry

  

                 WHERE  @list_of_cols_val_tab_del = t1.DocEntry

                        AND 

                                ISNULL(t2.project, '') = ''

                                

                           

             )

          BEGIN

              SET @error = -2

             

              SET @error_message = 'Select the projects for the Purchase order'

          END

      END

Regards

Kennedy

Former Member
0 Kudos

Hai Kennedy,

Thanks for kind post.

Its working fine.

Answers (1)

Answers (1)

former_member1269712
Active Contributor
0 Kudos

Hi

IF  @object_type = '22' AND (@transaction_type = N'A' OR @transaction_type = N'U')

BEGIN

                    IF ( SELECT opor.project from opor where opor.docentry=@list_of_cols_val_tab_del) is null

                    BEGIN

                                        SELECT @error = -5001

                                        SELECT @error_message = 'Please select project in project field'

                    END

END

For Purchase Request same just change object code and table name.

Regards,

Sachin

Former Member
0 Kudos

Hai Sachin,

First of all thanks for your post.

Your Above SP Not Working...