cancel
Showing results for 
Search instead for 
Did you mean: 

How to run query based on user defaults

Former Member
0 Kudos

HI Experts,

Can I run queries based on their user default branch and their default price list please ?

so users don't have to enter these parameters manually when executing the query.

what would be these parameters called in SQL please?

thankyou in advance

Steven

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi  Both

Does it work on V9?? As I m getting the following error.

Select * from OUSR  where usercode= $[USER]

1). [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near 'USER'. 2). [Microsoft][SQL Server Native Client 11.0][SQL Server]Statement '' (SWEI) (s) could not be prepared.

Cheers

frank_wang6
Active Contributor
0 Kudos

It is not working in 9.0, but it will work in 9.1.

Frank

Former Member
0 Kudos

I m using v9.1 actually but i got the error message .. So there is no work around  then ??  I have seen someone suggested using  $[USER\] ?? But still it didn't work ...

frank_wang6
Active Contributor
0 Kudos

try

SELECT $[USER]

and see what to be returned by Query

If failed, what's your patch level on 9.1? Most likely, u will need to upgrade PL level.

Frank

frank_wang6
Active Contributor
0 Kudos

BTW, this will only work in FMS, so u can only get it on a form.

Former Member
0 Kudos

FMS ?? As is fashion management solution ?? I m still new to SAP abbreviations.

frank_wang6
Active Contributor
0 Kudos

formatted search

KennedyT21
Active Contributor
0 Kudos

Hi Steven,

Try this

SELECT T1.[CashAcct]  FROM OUSR T0 INNER JOIN OUDG T1 ON T0.DfltsGroup = T1.Code

WHERE T0.USERID =$[User]


Cheers

frank_wang6
Active Contributor
0 Kudos

$[USER] is the variable that can be used inside Query.

Frank