on 01-11-2016 8:03 AM
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??
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nabil,
You can do that through SP_Transaction Notification.
Thanks,
Harshal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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'
User | Count |
---|---|
99 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.