Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8800

Query Throws Random Errors?

$
0
0

Hello, can anyone tell me why SAP throws random errors when trying to execute below query in Query Manager?

 

SAP opens and asks the user for the correct parameters but errors on execution.

 

/*SELECT FROM [dbo].[OHEM] T0*/

DECLARE @FirstName AS NVARCHAR(50)

/* WHERE */

SET @FirstName = /* T0.firstName */ '[%0]'

 

/*SELECT FROM [dbo].[OHEM] T1*/

DECLARE @LastName AS NVARCHAR(50)

/* WHERE */

SET @LastName = /* T1.lastName */ '[%1]'

 

/*SELECT FROM [dbo].[OFPR] T2*/

DECLARE @StartDate AS date

/* WHERE */

SET @StartDate = /* T2.F_RefDate */ '[%2]'

 

/*SELECT FROM [dbo].[OFPR] T3*/

DECLARE @EndDate AS date

/* WHERE */

SET @EndDate = /* T3.T_RefDate */ '[%3]'

 

Select     (EMP.firstName + ' ' + EMP.lastName) As Name,

               BL.TRANSDATE As Date,

               SJ.JOBID As [WO#],

               BL.SUBJOBID As [Tool ID],

               BL.STOCKCODE As Pay,

               CASE When TIMETYPE = 0

                    Then ISNULL(QTY,0)

                    Else 0

               End As ST,

               CASE When TIMETYPE = 1

                    Then ISNULL(QTY,0)

                    Else 0

               End As OT,

               CASE When TIMETYPE = 2

                    Then ISNULL(QTY,0)

                    Else 0

               End As DT

From OHEM EMP

     Inner Join ENPRISE_JOBCOST_TEMPBATCHJOBLINES BL On EMP.empID = BL.EMPID

     Inner Join ENPRISE_JOBCOST_SUBJOB SJ On SJ.SUBJOBID = BL.SUBJOBID

Where firstName Like @FirstName + '%' And lastName Like @LastName + '%'

And BL.TRANSDATE Between Convert(Datetime,@StartDate) And Convert(Datetime,@EndDate)

Group By     EMP.firstName,

                    EMP.lastName,

                    BL.TRANSDATE,

                    SJ.JOBID,

                    BL.SUBJOBID,

                    BL.STOCKCODE,

                    TIMETYPE,

                    QTY,

                    BL.EMPID

Order By Name

 

Thanks,

Mike


Viewing all articles
Browse latest Browse all 8800

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>