cancel
Showing results for 
Search instead for 
Did you mean: 

How to Restrict adding AR-Delivery connecting to Sales Order

Former Member
0 Kudos

Good Day Experts,

I am newbie in SAP Business One, Please me help on this scenario:

I have created an Series Numbering in Sales Order (SO-BOM) No.17 and a User Define Field (ORDR_DwnPayment) with option w/DP and w/out DP (DP means DownPayment).

Now i need to restrict adding AR-Delivery that is copied from Sales Order with Series#17 (SO-BOM) if the UDF is "w/out DP".

I hope you can understand my english.

Thank You.

Richard

Accepted Solutions (1)

Accepted Solutions (1)

kvbalakumar
Active Contributor
0 Kudos

Hi Richard,

Try this in Demo database first before applying to Production database.

IF @Object_type = N'13' and @transaction_type in (N'A')
BEGIN 
 declare  @line6 int
 SELECT @line6 = (T1.LineNum + 1)
 From OINV T0 inner join INV1 T1 on T0.DocEntry = T1.DocEntry
 inner join RDR1 T2 on T1.BaseEntry = T2.DocEntry and T1.BaseLine = T2.LineNum and T1.BaseType = '17'
 inner join ORDR T3 on T2.DocEntry = T3.DocEntry
 Where T1.DocEntry = @list_of_cols_val_tab_del and T3.Series = '17'
 and T3.U_DwnPayment = 'w/out DP'
 Order by T1.LineNum
 If (not ISNULL(@line6, 0) = 0)
	BEGIN
		Set @error = 10
		Set @error_message = N'Line ' + CONVERT(nvarchar(4), @line6) + N' is not copied from Delivery and didnot have DownPayment!'
	END
 else
	begin
		Set @error = 0
	END
END

Regards,

Bala

Former Member
0 Kudos

Thank You...I have already solve the prob...thank you for your query....

Richard

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks for the reply, i try this query but still the AR- Delivery can add even the UDF from AR-Sales Order U_ORDR_DwnPayment is 'w/out DP'.

IF @Object_type = '15' and @transaction_type ='A'

BEGIN

IF EXISTS (SELECT * FROM ODLN T0 Inner Join DLN1 T1 ON T0.DOCENTRY=T1.DOCENTRY

Inner Join RDR1 T2 on T1.BaseEntry = T2.DocEntry and T1.BaseType = '17'

Inner join ORDR T3 on T2.DocEntry = T3.DocEntry

WHERE T3.Series=76 AND T3.U_ORDR_DwnPayment = 'w/out DP' AND T0.Docentry = @list_of_cols_val_tab_del )

BEGIN

SELECT @Error = 1, @error_message = 'Your SO-BOM is no DownPayment.'

END

END

Note:

T3.SERIES = 76 "This is SO-BOM Series from Sales Order.

Before adding the AR-Delivery the system must check if this DR is copied from AR-Sales Order with Series SO-BOM (#76), then check if the UDF from Sales Order U_ORDR_DwnPayment='w/out DP' then it will 'NOT' add the AR-Delivery.

Thanks,

Richard

Former Member
0 Kudos

Hi Richard........

Welcome to SAP Business One Forum.......

@your Query......

Please try....

If @object_type='15' and @transaction_type IN ('A','U')
BEGIN 
If Exists (Select T0.DocNum from ODLN T0 
Where T0.U_ORDR_DwnPayment = 'w/out DP' 
And T0.DocEntry = @list_of_cols_val_tab_del)
BEGIN
Select @error = -1,
@error_message = 'You can not add Delivery with 'w/out DP' '
End
End

Above is the Validation which you need to run in PostTransnotification......

This will restrict users to add the delievry if UDF value is equal to 'w/out DP'

Regards,

Rahul

Edited by: RAHUL MOUNDEKAR on Mar 28, 2011 12:21 PM