on 03-27-2015 3:52 PM
Hi all,
I want a transaction notification in DELIVERY document.
The delivery should add only when item is in dispatch warehouse. If any other warehouse assigned to that item, it should give an error that "warehouse should be dispatch warehouse" and should not add delivery.
Thanks &Regards,
Saikrishna.
Hi,
Try this query:
IF @OBJECT_TYPE = '15'
AND @TRANSACTION_TYPE IN (
'A'
,'U'
)
BEGIN
IF EXISTS (
SELECT T0.docentry
FROM ODLN T0
INNER JOIN DLN1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
WHERE T1.[WhsCode] <> T2.[DfltWH]
AND T0.docentry = @list_of_cols_val_tab_del
)
BEGIN
SELECT @ERROR = 21
,@ERROR_MESSAGE = 'warehouse should be dispatch warehouse'
END
END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
use this
IF @OBJECT_TYPE = '15' AND @TRANSACTION_TYPE IN ('A', 'U')
BEGIN
IF EXISTS(
SELECT a.docentry FROM
ODLN a inner join dln1 b on a.docentry=b.docentry
where a.docentry=@list_of_cols_val_tab_del and a.series='3' and b.whscode<>'01')
Begin
SELECT @ERROR=21,@ERROR_MESSAGE='warehouse should be dispatch warehouse'
End
END
replace 3 with your series.
--Manish
Hi Sai Krishna,
In addition to the above suggestion provided by Manish, instead of hardcoding the warehouse code, what you can do is create a udf on whse master 'WhseType' where you can assign values FG, QC, SCRAP etc.
And by using the above notification, just modify the part where the udf value = FG, only in those cases delivery would be allowed else it would give error message. There would be no need to hardcode a particular warehouse. In case if you have more than 1 FG warehouse, it would be easier to update a udf value.
Ex: updated TN which was provided by Manish
IF @OBJECT_TYPE = '15' AND @TRANSACTION_TYPE IN ('A', 'U')
BEGIN
IF EXISTS(
SELECT a.docentry FROM
ODLN a inner join dln1 b on a.docentry=b.docentry
inner join owhs c on b.whscode = c.whscode
where a.docentry=@list_of_cols_val_tab_del and c.U_WhsType <>'FG')
Begin
SELECT @ERROR=21,@ERROR_MESSAGE='warehouse should be dispatch warehouse'
End
END
Thanks,
Joseph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try below TN
IF @OBJECT_TYPE = '15' AND @TRANSACTION_TYPE IN ('A', 'U')
BEGIN
IF EXISTS(
SELECT a.docentry FROM
ODLN a inner join dln1 b on a.docentry=b.docentry
where a.docentry=@list_of_cols_val_tab_del and b.whscode<>'01')
Begin
SELECT @ERROR=21,@ERROR_MESSAGE='warehouse should be dispatch warehouse'
End
END
replace 01 with your dispatch warehouse.
--Manish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
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.