Skip to Content

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

Query Log

Hi, is there a possibility to get a log file of the queries?

I made a formatted search, but i always get an internal error. When I try it in sql manager with the values of the table it works.

so the only reason could be that something is wrong with my parameters.

the query is:

[code]

SELECT ' Rest' =

CASE WHEN ($[WOR1.U_abc_PBTM] * T1.PlannedQty) % ($[WOR1.U_abc_PTl]) = 0 THEN (SELECT 'Rest' = CASE WHEN ( $[WOR1.U_abC_PStL] - $[WOR1.U_abc_Pbtl] * $[WOR1.U_abc_PTl]) >= 500 THEN 0 ELSE (( $[WOR1.U_abc_PBTM] * T1.PlannedQty) / $[WOR1.U_abc_PTl]) * ($[WOR1.U_abC_PStL] - $[WOR1.U_abc_Pbtl] * $[WOR1.U_abc_PTl]) END FROM OWOR T1 WHERE DOCENTRY= $[WOR1.DocEntry])

ELSE (SELECT 'Rest' = CASE WHEN ( $[WOR1.U_abC_PStL] - $[WOR1.U_abc_Pbtl] * $[WOR1.U_abc_PTl]) >= 500 THEN 0 ELSE (( $[WOR1.U_abc_PBTM] * T1.PlannedQty) % $[WOR1.U_abc_PTl]) * ($[WOR1.U_abC_PStL] - $[WOR1.U_abc_Pbtl] * $[WOR1.U_abc_PTl]) END FROM OWOR T1 WHERE DOCENTRY= $[WOR1.DocEntry])

END

FROM OWOR T1

WHERE

T1.DOCENTRY= $[WOR1.DOCENTRY]

[/code]

Former Member
Former Member replied

hi,

replace your 'cast as double' with 'cast as decimal'. there is no double in sql.

and then the modulo operators are still not an integer.

only first line:

SELECT ' Rest' = CASE WHEN CAST((CAST(ISNULL(N'3.000000', 0) AS DECIMAL) * T1.PlannedQty) AS INT) % (CAST(ISNULL(N'3', 0) AS INT)) = 0 THEN [...]

that should work. remember to change and save the query with the parameters. not this one.

many of the CASTs are unnecessary but do not hurt (except you have performance problems)

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