cancel
Showing results for 
Search instead for 
Did you mean: 

TNotification in Delivery

former_member487237
Participant
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

kothandaraman_nagarajan
Active Contributor
0 Kudos

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



former_member487237
Participant
0 Kudos

HI All,

it is working fine but i want this to be work when only particular document series.

Ex. I have two document no. series 1) export 2)domestic

i want only for export.

Regards,

Sai.

former_member184146
Active Contributor
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

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

former_member184146
Active Contributor
0 Kudos

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