cancel
Showing results for 
Search instead for 
Did you mean: 

Restrict to close Production Order If Issue & Receipt Not done both are mandatory. SAP B1 10.0

Kiransonawane
Explorer
0 Kudos

I Want to Restrict users to close Production Order If Issue for Production is not completed even of  Receipt for production is Not done both are mandatory.

Below is my SP_Transaction Notification

IF (@object_type = '202' AND @transaction_type= 'U')

BEGIN

if exists (

SELECT T0.[DocNum]

FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
WHERE T0.[CmpltQty] =0
and T1.[PlannedQty] > T1.[IssuedQty]
and T0.[Status] = 'L' and T0.DocEntry = @List_of_cols_val_tab_del)

Begin

set @error =1

set @error_message = 'Production Order can not be Closed,until issue and receipt done'

End

END

View Entire Topic
narayanis
Active Contributor
0 Kudos

Hi,

Just a bracket issue. Check with this.

SELECT T0.[DocNum]

FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
WHERE (T0.[CmpltQty] =0
or T1.[PlannedQty] > T1.[IssuedQty])
and T0.[Status] = 'L' and T0.DocEntry = @List_of_cols_val_tab_del)

Kiransonawane
Explorer
0 Kudos
query is working only if production order is in Release mode and issue for production is not completed. query is not restricted to close if receipt of production after issue for production is done