cancel
Showing results for 
Search instead for 
Did you mean: 

SPT Not working when invoice is Cancelling

pvinod_kumar
Participant
0 Kudos

Hi Experts

i had a SPT which auto populate a UDF Data from Invoice to its related JE and its working fine when i Add a new document

But when i cancel the same document, this SPT is not working and does not auto populate the date from UDF to JE UDF

Pls help me to sort it out

Below attached is the SPT

Regards

IF @transaction_type in ('A','C','U') AND @Object_type = '18'
BEGIN
UPDATE D
	SET        D.U_TaxType = B.U_TaxType
	FROM            OPCH AS A INNER JOIN
                         PCH1 AS B ON A.DocEntry = B.DocEntry INNER JOIN
                         OJDT AS C ON A.TransId = C.TransId AND A.ObjType = C.TransType INNER JOIN
                         JDT1 AS D ON C.TransId = D.TransId
	WHERE B.AcctCode = D.Account and B.LineTotal = D.Debit AND A.DocEntry = @list_of_cols_val_tab_del AND A.DocType = 'S'
END
pvinod_kumar
Participant
0 Kudos

hi ranu

not clear what you said,,

Object type of invoice either add or cancel, both are 18,

can you pls help me to edit the spt

Regards

pvinod_kumar
Participant
0 Kudos

ok its fixed

i was the issue with because we had provide line total, when i removed it,, it find perfect

Regards

Accepted Solutions (1)

Accepted Solutions (1)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Did you check above TN?

pvinod_kumar
Participant
0 Kudos

yes its working fine

Answers (1)

Answers (1)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Try this,

IF @transaction_type in ('A','C','U') AND @Object_type = '18'

BEGIN

UPDATE D SET D.U_TaxType = B.U_TaxType

FROM OPCH AS A INNER JOIN PCH1 AS B ON A.DocEntry = B.DocEntry

INNER JOIN OJDT AS C ON A.TransId = C.TransId AND A.ObjType = C.TransType

INNER JOIN JDT1 AS D ON C.TransId = D.TransId WHERE B.AcctCode = D.Account

and (B.LineTotal = D.Debit OR B.LineTotal = D.Credit) AND A.DocEntry = @list_of_cols_val_tab_del AND A.DocType = 'S'

END

Regards,

Nagarajan