Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

If clause in formatted search gives error

Hello Experts,

I am trying to use this query in formatted search but it gives this error :

IF $[OINV.CANCELED] = 'N'

(UPDATE JDT1 SET REF2 = 0 WHERE TRANSTYPE = 13 and BASEREF = $[OINV.DOCNUM];

UPDATE OJDT SET REF2 = 0 WHERE TRANSTYPE = 13 and BASEREF = $[OINV.DOCNUM];

SELECT 'UPDATED')

ELSE

SELECT 'CANNOT UPDATE'

Incorrect syntax near the keyword 'UPDATE'. (SWEI)

If I use this query, it works without problem :

IF $[OINV.CANCELED] = 'N'

SELECT 'UPDATED'

ELSE

SELECT 'CANNOT UPDATE'

I would like to hear your solutions if you have any experience about this kind of query.

Thanks in advance.

Kind Regards,

Onur Yildiz

Tags:
replied

I changed the query like this :

IF $[OINV.CANCELED] = 'N'

UPDATE JDT1 SET REF2 = 0 WHERE TRANSTYPE = 13 and BASEREF = $[OINV.DOCNUM]

IF $[OINV.CANCELED] = 'N'

UPDATE OJDT SET REF2 = 0 WHERE TRANSTYPE = 13 and BASEREF = $[OINV.DOCNUM]

IF $[OINV.CANCELED] = 'N'

SELECT 'UPDATED'

IF $[OINV.CANCELED] = 'Y'

SELECT 'CANNOT UPDATE'

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question