cancel
Showing results for 
Search instead for 
Did you mean: 

S.P

Former Member
0 Kudos
45

Hi

Cardcode exists is Sales Order but still it is allowing to add A/R Invoice

IF @transaction_type IN ('A','U') AND @object_type = '13'

BEGIN

if exists

(SELECT T1.CardCode

FROM OINV T0

INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode

INNER JOIN INV1 T2 ON T0.DocEntry = T2.DocEntry

Where T0.DocEntry=@list_of_cols_val_tab_del

and T2.BaseType=-1

and not exists

(SELECT T.DocEntry FROM RDR1 T WHERE T.BaseCard=T1.CardCode))

SELECT @error = 1, @error_message = 'A/R Invoice without Copy From Delivery not Permitted !'

What i require is if user is making A/R invoice directly of a Business Partner and that Business Partner has transaction in Sales Order , then user should not be able to make A/R Invoice. In the above S.P it is allowing.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member312729
Active Contributor
0 Kudos

Try this

IF @transaction_type IN ('A', 'u') AND @object_type = '13'
BEGIN
if exists
(SELECT T0.CardCode
FROM OINV T0
INNER JOIN INV1 T2 ON T0.DocEntry = T2.DocEntry
Where T0.DocEntry=@list_of_cols_val_tab_del
and T2.BaseType=-1 and T0.Cardcode in (Select distinct T5.CardCode from ORDR T5))
Begin
SELECT @error = 1, @error_message = 'A/R Invoice without Copy From Delivery not Permitted !'
End
End

Regards:

Balaji

Answers (1)

Answers (1)

Former Member
0 Kudos

Closed.