cancel
Showing results for 
Search instead for 
Did you mean: 

Query Issue

Former Member
0 Kudos

Hello

I wrote the following query for purpose of returning open quotes for the following day for the person logged into SAP.

I'm having an issue with: T3.INTERNAL_K = $[user]

It keeps coming back with a "service contracts" error. can I not use this variable within this query? any suggestions on modify it?

I don't want the user to have to enter any variables

SELECT T0.[U_SalesEmployee] AS 'Sales Employee', T0.[U_Create] AS 'Created', T0.[U_NumLevel] AS '#Levels',

T0.[U_Customer] AS 'Customer', T0.[U_CardCode] AS 'CustId', T0.[U_NumAtCard] AS 'Cust Ref/PO', T0.[U_Type] AS 'Type',

T0.[U_Status] AS 'Status', T0.[U_SubEnd] AS 'Expires',T0.[U_CntctPrsn] AS 'Contact', T0.[U_TotalPrice] AS 'Total Price',

T0.[U_SubNum] AS 'Quote #' FROM [dbo].[@LBSISUBH] T0 (nolock)

join OCRD t1 on T0.U_CardCode=t1.CardCode

join OHEM t2 on t1.SlpCode=t2.salesPrson

join OUSR T3 on t2.userId=T3.USERID

WHERE T0.[U_Type] = 'Quote' and T0.U_Status = 'Open' and

T0.U_NumLevel > 0 and (convert(varchar, T0.[U_create], 1) = convert(varchar, getdate()-1, 1))

and T3.INTERNAL_K = $[user]

order by T0.U_SalesEmployee, T0.U_Type, T0.U_TotalPrice

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Have you tried to query OQUT table directly?

Thanks,

Gordon

Answers (3)

Answers (3)

former_member204969
Active Contributor
0 Kudos

The $[USER] reference is valid only in the context of a document, that is in an FMS. Starting from the query manager it gives syntactic error.

Edited by: István K#rös on May 10, 2010 4:51 PM

Former Member
0 Kudos

You may try some other system tables to find out if it is UDT related.

Former Member
0 Kudos

Gordon

What table is that?

I have no data in it

thanks

Mike

Former Member
0 Kudos

That table is for Sales Quotation.

Former Member
0 Kudos

Sorry Gordon...these quotes are part of a enhancement we are using coming out of table [@lbsisubh]