on 07-20-2016 11:25 AM
Hi All
A customer has a number of numbering series. When they do a sales order for example for a specific series and copy to a delivery it defaults to the primary series (standard sap business one behaviour).
To prevent users from making mistakes we want to add a stored proc to block them if the base doc numbering series is different from the doc being added.
this is my stored proc: but it blocks the delivery if the sales order has the same numbering series.
IF (@transaction_type = 'A' or @transaction_type = 'U') AND @Object_type = '15'
BEGIN
IF EXISTS (Select T1.BaseEntry
From ODLN T0 inner join DLN1 T1 on T0.DocEntry = T1.DocEntry
inner join RDR1 T2 on T1.BaseEntry = T2.DocEntry
inner join ORDR T3 on T3.DocEntry = T2.DocEntry
where (T0.DocEntry = @LIST_OF_COLS_VAL_TAB_DEL) and (T0.Series <> T3.Series))
BEGIN
SET @ERROR = -1
SET @ERROR_MESSAGE = 'Series does not match'
END
END
What am i missing?
Thank you.
Jerusha
Hi Jerusha,
Try this
IF @transaction_type = ('A', 'U') AND @Object_type = '15'
BEGIN
IF EXISTS (Select T0.DocEntry From ODLN T0
inner join DLN1 T1 on T0.DocEntry = T1.DocEntry
inner join NNM1 T4 on t0.Series=t4.Series
inner join RDR1 T2 on T1.BaseEntry = T2.DocEntry AND T1.BaseLine = T2.LineNum
inner join ORDR T3 on T3.DocEntry = T2.DocEntry
inner join NNM1 T5 on t3.Series=T5.Series
where T4.SeriesName <> T5.SeriesName and T0.DocEntry=@LIST_OF_COLS_VAL_TAB_DEL)
BEGIN SET @ERROR = -1
SET @ERROR_MESSAGE = 'Series does not match'
END
END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jerusha,
Try below:
IF (@transaction_type = 'A' or @transaction_type = 'U') AND @Object_type = '15'
BEGIN
IF EXISTS (Select T0.DocEntry
From ODLN T0
inner join DLN1 T1 on T0.DocEntry = T1.DocEntry
inner join RDR1 T2 on T1.BaseEntry = T2.DocEntry AND T1.BaseLine = T2.LineNum
inner join ORDR T3 on T3.DocEntry = T2.DocEntry
where T0.Series <> T3.Series and T0.DocEntry = @LIST_OF_COLS_VAL_TAB_DEL)
BEGIN
SET @ERROR = -1
SET @ERROR_MESSAGE = 'Series does not match'
END
END
Hope this helps
Thanks'
--
--
Regards::::
Atul Chakraborty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
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.