Hi experts,
I ask for your help on my following request in SAP Business One MS SQL:
For a stored procedure on goods receiprt (OIGN/IGN1) to block/prevent the reintegration into stock of serial numbers already out, through the production output (Issue for production) or just block return released SN.
I did this procedure but it also blocks new serial numbers never entered.
IF @transaction_type ='A' AND (@object_type = '59' )<br>BEGIN<br>IF Exists (select T0.LogEntry from OITL T0 inner join ITL1 T1<br>on T0.LogEntry=T1.LogEntry inner join<br>(select distinct T2.AbsEntry from OITL T0 inner join ITL1 T1<br>on T0.LogEntry=T1.LogEntry inner join OSRN T2 on T2.AbsEntry = T1.MdAbsEntry<br>where T0.DocType=59 and T0.ManagedBy=10000045<br> union all<br>select distinct T2.AbsEntry from OITL T0 inner join ITL1 T1<br>on T0.LogEntry=T1.LogEntry inner join OSRN T2 on T2.AbsEntry = T1.MdAbsEntry<br>where T0.DocType=59 and T0.DocEntry = @list_of_cols_val_tab_del and T0.ManagedBy=10000045 <br>)<br> TSR on T1.MdAbsEntry=TSR .AbsEntry<br>where T0.DocType=59 and T0.DocEntry = @list_of_cols_val_tab_del and T0.ManagedBy=10000045)<br>BEGIN<br>set @error = 001<br>set @error_message = 'You are not allowed to re-enintegrate this serial number, already manufactured and released'<br>END<br>END
Thank you for your suggestions
Kind regards
Hafid