cancel
Showing results for 
Search instead for 
Did you mean: 

Block GRPO Based On Items Group

Former Member
0 Kudos

How to block adding GRPO Based on the Items Group.My exact Requirement is to block GTPOs for items whose  Group is "PVS Resin" ie SELECT T0.[ItmsGrpNam], T0.[ItmsGrpCod], T1.[ItemName], T1.[ItemCode] FROM OITB T0  INNER JOIN OITM T1 ON T0.ItmsGrpCod = T1.ItmsGrpCod WHERE T0.[ItmsGrpNam] =  'PVC Resin' I need to block adding GRPO of items as per the above query.How van i do this??Is it possible through approval procedure??

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Nabil,

try below SP, just change the T2.ItmsGrpCode according to your Item group code.

IF @transaction_type IN (N'A', N'U')

   AND (@object_type = '20')

BEGIN

    IF   EXISTS(

           SELECT T0.DocEntry

           FROM   OPDN T0

                  INNER JOIN PDN1 T1

                       ON  T0.DocEntry = T1.DocEntry

                  INNER JOIN OITM T2

                       ON  T1.itemcode = T2.Itemcode

           WHERE  T0.DocEntry = @list_of_cols_val_tab_del AND T2.ItmsGrpCod = '100'

       )

    BEGIN

        SELECT @Error = 13                                                   

        SELECT @error_message = 'Error, Pls change Item group'

    END

END

Thanks,

Harshal

Former Member
0 Kudos

Harshal , It will block GRPOs with itmsgrpcode 100 ,and one more thing is, I need to create an approval procedure using this SP.After the GRPO window is locked i also need to approve that GRPO to be added by the user only after my approval

Former Member
0 Kudos

Hi Nabil,

I am not sure but pls try with this query. may be it works for you.

replace T2.ItmsGrpCod value according to your value.

SELECT DISTINCT 'TRUE' FROM OPDN T0 INNER JOIN PDN1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode

WHERE T2.ItmsGrpCod  = '100' AND T0.DocNum = $[$8.0.0]

Thanks,

Harshal

Former Member
0 Kudos

Harshal, It isn't working.I can update grpo without asking any approval.

Rafaee_Mustafa
Active Contributor
0 Kudos

please refer your this thread

Former Member
0 Kudos

Hi Nabil,

Try this

IF @transaction_type IN (N'A', N'U')

   AND (@object_type = '20')

BEGIN

    IF   EXISTS(

           SELECT T0.DocEntry

           FROM   OPDN T0

                  INNER JOIN PDN1 T1

                       ON  T0.DocEntry = T1.DocEntry

                  INNER JOIN OITM T2

                       ON  T1.itemcode = T2.Itemcode inner join OITB T3  ON T2.ItmsGrpCod = T3.ItmsGrpCod

           WHERE  T0.DocEntry = @list_of_cols_val_tab_del AND T3.[ItmsGrpNam] =  'PVC Resin'

       )

    BEGIN

        SELECT @Error = 13                                                  

        SELECT @error_message = 'Error, Pls change Item group'

    END

END

Former Member
0 Kudos

Bharathiraja , Is it an SP??How can i create SP using this code??Please help i am a newbie to this.Do this work as an approval procedure?

Rafaee_Mustafa
Active Contributor
0 Kudos

Dear Nabil,

you can refer this post for adding SP

Regards,

Rafaee M

Former Member
0 Kudos

Mustafa , This SP will not work .This is not the solution I want.Request You to Please see the exact requirement .Please refer this thread of mine.This is the exact requirement. http://scn.sap.com/message/16460166#16460166

Rafaee_Mustafa
Active Contributor
0 Kudos

Dear Nabil,

i have replied there Please closed this thread

Answers (2)

Answers (2)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

It is not possible to block by approval procedure. You have to above stored procedure at SQL Server management studio under Transaction notification.

Please search in this forum to work with transaction notification.

Thanks

Former Member
0 Kudos

Hi Nabil,

You can do that through SP_Transaction Notification.

Thanks,

Harshal

Former Member
0 Kudos

Harshal , How can i do this ? I've created an approval procedure with the following query ,I don't know if it is working or not.Also please share me the SP to achieve this.I'm not sure about my method. SELECT T0.[DocNum], T1.[Dscription], T1.[ItemCode], T2.[ItmsGrpNam] FROM OPDN T0  INNER JOIN PDN1 T1 ON T0.DocEntry = T1.DocEntry, OITB T2 WHERE T2.[ItmsGrpNam]  ='PVC Resin'