on 2007 Dec 13 10:02 PM
We want to create a mandatory UDF to identify invoice order line quantites with quantity of specified inventory items are not between ranges identified per each item in user defined fields. We have created a UDF with the following formatted search to accomplish this:
SELECT ' '
WHERE
( $[$38.11.NUMBER] NOT BETWEEN
$[$38.U_RWeightMin.NUMBER] AND $[$38.U_RWeightMax.NUMBER])
When we use this query, instead of blanking out the fields for items that meet the criteria, it blanks out every quantity per each line of the invoice.
Any ideas on what we are doing wrong?
Thanks for your help
Stephanie,
Is this the same scenario like the requirement of creating an Approval Procedure that we discussed earlier.
I might have a different solution if you would be interested.
Suda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where are these two user fields U_RWeightMin and U_RWeightMax.
Are they in the Item Master too.
Please add the following Code to your SBO_SP_TransactionNotification stored proc and it should do the trick. I am presuming the above two user fields are in Item Master. If your field names are different change the names according in my code below.
IF @object_type = '13' AND @transaction_type = 'A'
BEGIN
IF EXISTS (SELECT @status = 'T' FROM [DBO].[OINV] T0 INNER JOIN [DBO].[INV1] T1 ON T0.DOCENTRY = T1.DOCENTRY
INNER JOIN [DBO].[OITM] T2 ON T2.ITEMCODE = T1.ITEMCODE
WHERE (T1.QUANTITY NOT BETWEEN T2.U_RWeightMin AND U_RWeightMax) AND T0.DOCENTRY = @list_of_cols_val_tab_del )
BEGIN
SELECT @Error = 1, @error_message = 'Quantity not in Min Max range'
END
END
Regards
Suda
> Where are these two user fields U_RWeightMin and
> U_RWeightMax.
>
> Are they in the Item Master too.
>
> Please add the following Code to your
> SBO_SP_TransactionNotification stored proc and it
> should do the trick. I am presuming the above two
> user fields are in Item Master. If your field names
> are different change the names according in my code
> below.
>
> IF @object_type = '13' AND @transaction_type = 'A'
> BEGIN
> IF EXISTS (SELECT @status = 'T' FROM [DBO].[OINV] T0
> INNER JOIN [DBO].[INV1] T1 ON T0.DOCENTRY =
> T1.DOCENTRY
> INNER JOIN [DBO].[OITM] T2 ON T2.ITEMCODE =
> T1.ITEMCODE
> WHERE (T1.QUANTITY NOT BETWEEN T2.U_RWeightMin AND
> U_RWeightMax) AND T0.DOCENTRY =
> @list_of_cols_val_tab_del )
> BEGIN
> SELECT @Error = 1, @error_message = 'Quantity not in
> Min Max range'
> END
> END
>
> Regards
>
> Suda
Thanks Suda,
I have never edit a sp before, do I just open it and past the script in?
Thanks for your help
Login to SQL Server Management Studio. Start > Run ..SqlWb.exe
Under Database listing on the left hand window (Object explorer) Click the plus and Expand..go to Progammability....Stored Procedure..locate the SBO_SP_TransactionNotification Procedure here. Right mouse click and select modify.
You will a area with words "-- ADD YOUR CODE HERE".
Paste my code below it and Click the execute button on the Top tool Bar.
It would show "Command(s) completed successfully."
You can now close this window and continue with SBO.
Sorry my mistake, I changed the code but forgot to remove the variable
Use this one
IF @object_type = '13' AND @transaction_type = 'A'
BEGIN
IF EXISTS (SELECT T1.DOCENTRY FROM [DBO].[OINV] T0 INNER JOIN [DBO].[INV1] T1 ON T0.DOCENTRY = T1.DOCENTRY
INNER JOIN [DBO].[OITM] T2 ON T2.ITEMCODE = T1.ITEMCODE
WHERE (T1.QUANTITY NOT BETWEEN T2.U_RWeightMin AND T2.U_RWeightMax) AND T0.DOCENTRY = @list_of_cols_val_tab_del )
BEGIN
SELECT @Error = 1, @error_message = 'Quantity not in Min Max range'
END
END
> Login to SQL Server Management Studio. Start > Run
> ..SqlWb.exe
>
> Under Database listing on the left hand window
> (Object explorer) Click the plus and Expand..go to
> Progammability....Stored Procedure..locate the
> SBO_SP_TransactionNotification Procedure here. Right
> mouse click and select modify.
>
> You will a area with words "-- ADD YOUR CODE HERE".
>
> Paste my code below it and Click the execute button
> on the Top tool Bar.
>
> It would show "Command(s) completed successfully."
>
> You can now close this window and continue with SBO.
>
> Sorry my mistake, I changed the code but forgot to
> remove the variable
>
> Use this one
>
> IF @object_type = '13' AND @transaction_type = 'A'
> BEGIN
> IF EXISTS (SELECT T1.DOCENTRY [DBO].[OINV] T0 INNER
> JOIN [DBO].[INV1] T1 ON T0.DOCENTRY = T1.DOCENTRY
> INNER JOIN [DBO].[OITM] T2 ON T2.ITEMCODE =
> T1.ITEMCODE
> WHERE (T1.QUANTITY NOT BETWEEN T2.U_RWeightMin AND
> U_RWeightMax) AND T0.DOCENTRY =
> @list_of_cols_val_tab_del )
> BEGIN
> SELECT @Error = 1, @error_message = 'Quantity not in
> Min Max range'
> END
> END
Suda,
Thanks for the information; I appreciate your help.
I am still having a problem getting the sp to run; I am getting an error 170,"incorrect syntex near'.' on the third line of your sp.
Any ideas on how to correct?
thanks again
User | Count |
---|---|
98 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
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.