Getting user name on a query

Hi,
I was trying to get the user that is logged on in a query but I can't. I tried using $user, but this only works in a formatted search, in a form.
What I want to do is run a query where the user can see its active documents, based on the logged on user.
Is there any way to use $user in such a query?

Sergi, here is how to...:
1. save a query SELECT $[USER]
2. run it from Queries Manager -> you'll get error
3. go to Tools -> Queries -> User Queries -> run it.. wwau! it works!
HTH

Similar Messages

  • I want is that I get  user name!

    Hi,
    Below are my two annotated classes, namely, Requisition and User, that represent two tables requisitions and users. What I want is that I get
    to get username from users table in my requisition query instead of user id which is stored in the requisitions.request_by.
    Table field requisitions.request_by hold the ids of users ,ie, users.id values.
    Here are my tables:
         users
                   + id int(11)
                   username varchar(15)
                   password varchar(15)
                   role int(11)
                   last_login timestamp
         requisitions
                   id int(11)
                   post varchar(50)
                   + request_by int(11)
                   platform varchar(50)
                   experience_required int(11)
                   comments text
                   date_requested date
    Here is my Query for fetching requsition object in the RequisitionServiceimpl.java
         public List getRequisitions(User loggedInUser){
              Query queryRequsitions = em.createQuery("Select r FROM Requisition as r");
              List list = queryRequsitions.getResultList();          
              return list;     
    Below are my two annotated classes Requisition and User:
    import java.util.Date;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.PrimaryKeyJoinColumn;
    import javax.persistence.SecondaryTable;
    import javax.persistence.Table;
    import javax.persistence.JoinColumns;
    import javax.persistence.JoinColumn;
    @Table(name="requisitions")
    @SecondaryTable(name="users")
    @Entity
    public class Requisition {
         @Id
         private int id;
         private String post;
         @Column(name = "request_by")
         private int requestBy;
         private String platform;
         @Column(name = "experience_required")
         private int experienceRequired;
         private String comments;
         @Column(name = "date_requested")
         private Date dateRequested;
         // Name from users Table
         @Column(table="users", name="username")
         private String username;
         public int getId() {
              return id;
         public void setId(int id) {
              this.id = id;
         public String getPost() {
              return post;
         public void setPost(String post) {
              this.post = post;
         public int getRequestBy() {
              return requestBy;
         public void setRequestBy(int requestBy) {
              this.requestBy = requestBy;
         public String getPlatform() {
              return platform;
         public void setPlatform(String platform) {
              this.platform = platform;
         public int getExperienceRequired() {
              return experienceRequired;
         public void setExperienceRequired(int experienceRequired) {
              this.experienceRequired = experienceRequired;
         public String getComments() {
              return comments;
         public void setComments(String comments) {
              this.comments = comments;
         public Date getDateRequested() {
              return dateRequested;
         public void setDateRequested(Date dateRequested) {
              this.dateRequested = dateRequested;
    // Only Getter for Users Table field username
         public String getUsername() {
              return username;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.Table;
    @Table(name="users")
    @Entity
    public class User {
    @Id
    private Long id;
    @Column(name="username")
    private String name;
    private String password;
    private int role;
    public String getName() {
    return name;
    public void setName(String user) {
    this.name = user;
    public String getPassword() {
    return password;
    public void setPassword(String password) {
    this.password = password;
    public Long getId() {
    return id;
    public void setId(Long id) {
    this.id = id;
    public int getRole() {
    return role;
    public void setRole(int role){
    this.role = role;
    Thank you,
    Adil

    I made this changes to Requisition.java and now I can get user name
    import java.util.Date;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.JoinColumn;
    import javax.persistence.OneToOne;
    import javax.persistence.Table;
    @Table(name="requisitions")
    @Entity
    public class Requisition {
    @Id
    private int id;
    private String post;
    @Column(name = "request_by")
    private int requestBy;
    private String platform;
    @Column(name = "experience_required")
    private int experienceRequired;
    private String comments;
    @Column(name = "date_requested")
    private Date dateRequested;
    @OneToOne
    @JoinColumn( name="request_by", insertable=false, updatable=false)
    private User user;
    public int getId() {
    return id;
    public void setId(int id) {
    this.id = id;
    public String getPost() {
    return post;
    public void setPost(String post) {
    this.post = post;
    public int getRequestBy() {
    return requestBy;
    public void setRequestBy(int requestBy) {
    this.requestBy = requestBy;
    public String getPlatform() {
    return platform;
    public void setPlatform(String platform) {
    this.platform = platform;
    public int getExperienceRequired() {
    return experienceRequired;
    public void setExperienceRequired(int experienceRequired) {
    this.experienceRequired = experienceRequired;
    public String getComments() {
    return comments;
    public void setComments(String comments) {
    this.comments = comments;
    public Date getDateRequested() {
    return dateRequested;
    public void setDateRequested(Date dateRequested) {
    this.dateRequested = dateRequested;
    public User getUser() {
    return user;
    public void setUser(User user) {
    this.user = user;
    Edited by: adilsun on Jul 23, 2008 8:36 PM

  • Getting user name from sopa header

    How should get user name from soap header in my udf...?i searched in sdn,but not get exact solution...

    I din't get this with SRemoteUser
    1. i've enabled " Do Not Use SOAP Envolope"
    2.Enabled ASMA
    3.Variable Transport Binding .
    used the following code as well:
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey user = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/SOAP", "SRemoteUser");
    conf.get(user);
    But not value in it.. Correct me if iam wrong..

  • BAPI to get user name

    Hi ,
    Is there any BAPI to get the user name while importing employee number ?
    input parameter : employee number
    output parameter : user name
    Regards,
    Pavani
    With a little more effort you would have
    found CATSXT_GET_USER_ID_OF_PERNR in
    your system
    Edited by: Suresh Datti on Sep 1, 2009 2:42 PM

    For this  BAPI_USER_GET_DETAIL   input parameter is user name .i want to pass employee number and get user name .
    i am looking for BAPI not normal functional modules.if there are any BAPIs pls send .
    Regards,
    Pavani

  • Get User Names and Mail Ids present in Exchange Server

    Hello All,
    Can we get all the names and mail ids present in the exchange Server global address book?
    I tried one example but it is giving error.
    Exception in thread "main" javax.naming.CommunicationException: [LDAP: error
                code 2 - Protocol Error]; remaining name 's=satheesh'
    Code is given below:
    Hashtable env = new Hashtable(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, "ldap://mailserver:389");
    DirContext ctx = new InitialDirContext(env);
    Attributes answer = ctx.getAttributes("s=satheesh");
    Any example code to get user names and mail ids will be helpful.
    Thanks in advance.
    Regards,
    Satheesh A
    [email protected]

    Hi Satheesh,
    I am new to LDAP. I am facing the exact same problem as you mentioned. Did you solve your problem?
    Thanks for any help you can provide.
    Hello All,
    Can we get all the names and mail ids present in the
    exchange Server global address book?
    I tried one example but it is giving error.
    Exception in thread "main"
    read "main" javax.naming.CommunicationException:
    [LDAP: error
    code 2 - Protocol Error]; remaining name
    aining name 's=satheesh'
    Code is given below:
    Hashtable env = new Hashtable(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL,
    "ldap://mailserver:389");
    DirContext ctx = new InitialDirContext(env);
    Attributes answer = ctx.getAttributes("s=satheesh");
    Any example code to get user names and mail ids will
    be helpful.
    Thanks in advance.
    Regards,
    Satheesh A
    [email protected]

  • I using new ipad 32gb and i cant get user name and password how i configure it ? please give me solution

    im using new ipad 32gb and i cant get user name and password how i configure it ? please give me solution

    What do you mean 'can't get user name and password' ? What are you trying to do with your iPad and what happens when you do it ?

  • How to get User Name?

    Hi Guys,
    I want to retrieve the user names? Can you please tell me in which table SAP stores it?
    My SQL query will be as shown:
    SELECT SINGLE * FROM (TABLE NAME ???) INTO WORK AREA WHERE DBTAB-USERID EQ SYST-UNAME.
    Here I want the database table name where we store the user ID names.
    Thanks,
    Hemal

    Hi TCS Team,
    Please find attached code for your requirement.
    You can also get this from VIEW USSR_ADDR ( Given in one of the reply )
    CLEAR w_usr21.
    SELECT SINGLE *
    FROM usr21
    INTO w_usr21
    WHERE bname = sy-uname.
    CLEAR w_adcp.
    SELECT SINGLE *
    FROM adcp
    INTO w_adcp
    WHERE addrnumber = w_usr21-addrnumber
    AND   persnumber = w_usr21-persnumber.
    CLEAR w_name.
    SELECT SINGLE NAME_TEXT
    FROM adrp
    INTO w_name
    WHERE persnumber = w_usr21-persnumber.
    Thanks,
    Hemal Shah

  • Getting user name (at command line argument)

    At the beginning of my program I need to prompt for the user name and then follow this with a welcoming message. Please help as I have not yet learnt this in my studies!

    When prgramming java, and surely when learning it, alway use the documentation. You ken find it @ http://java.sun.com/j2se/1.3/docs.html To do input and output with the console you need the java.lang.System (Doc are @ http://java.sun.com/j2se/1.3/docs/api/java/lang/System.html ). The system object has an open inputstream called in wich reads the standard input, normally what users type on the console. So System.in.read() will get you a char that is typed on the console.
    In your case it might be easier to create a BufferedReader.
    BufferedReader input = new BufferedReader(System.in); will create a buffered reader that reads from the console. The advantage is that you can now use input.readLine() to read a complete line (until return key is pressed).
    Succes
    AVee

  • Get user name

    Hi I need Labview to programatically create a file in the C:\Documents and Settings\"Username"\Application Data\ folder but i do not not how to find the user name.  I tried the "Get permissions' function but that returned nothing for the owner and group
    My only other choice would be to use the temporary directory filepath and work backwords but that is not very clean
    thanks

    Hey,
    Please open and run attached VI, this should help.
    Christian
    Attachments:
    Username1.vi ‏18 KB

  • Getting user name or password incorrect message when trying to access email

    I keep getting an incorrect user name or password message whenever I try to get into my mail. Also, my mail has not been updating anything since Thursday. I have the 1st edition iPad

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Try this: Delete the account in Mail and then set it up again.
     Cheers, Tom

  • Get user name - web services throws error if a name has special character

    I am calling UserProfileService.asmx web service and using GetUserPropertyByAccountName. The method works for almost everyone except for those who has special characters in the Preferred Name. How do I fix this? We are having serious production issues and
    would like to know how to fix the issue.
    User: domain\aberg returns name as the name does not have any special characters. Arthur Berg
    User: domain\jobill returns following error because this use has a dash in the last name. Joe O-Bill
    User: domain\mobrien returns following error because this use has a dash in the last name. Mark O'Brien
    <?xml version="1.0" encoding="utf-16"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
    <soap:Fault>
    <faultcode>soap:Client</faultcode>
    <faultstring>A user with the account name DOMAIN\jobill could not be found. ---&gt; An error was encountered while retrieving the user profile.</faultstring>
    <detail>
    <ErrorCode xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService">UserCannotBeFound</ErrorCode>
    <ErrorMessage xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService">An error was encountered while retrieving the user profile.</ErrorMessage>
    </detail>
    </soap:Fault>
    </soap:Body>
    </soap:Envelope>
    I am using codeplex tool "web service studio 2.0" to verify this.

    I have NO clue what is going on. When I go to user profile from Central Admin the user account is domainxp.net\username. But when I pull up the user using address bar (say in edit form) I see domain\usename. Could this be confusing the workflow which is
    calling the web services?
    I ran the following powershell and after few minutes it starting to resolve the user name without any errors. I like to know what is going on here. Problem is solved for now but I wont be surprise if I see the same problem after doing a Full AD sync.
    $adUser = "domain\user"
    $siteCollection = "http://local.site/sales"
    Set-SPUser -Identity $adUser -Web $siteCollection -SyncFromAD
    Thanks
    Brooke

  • Getting user name, date and time into 1 field

    Hi All,
    I have to add a new field in a customising include of AUFK table. This field should have user name, date and time. How do I store all these values in a single field of the table? Please help.

    Ok Thanks all. Will try your suggestions. But there is one problem. As i have already mentioned that i will have to display this detail in one field of the table control, The format of display is: user name should be seen above and the date and time separated by space should be displayed below the name. How can i ultimately display this in the table control. Do i have to create 2 different fields (one for name and other for date and time) in the AUFK table or is there any other solution?
    Thanks

  • Getting column names for a Query resultList?

    For a Query created via EntityManager.createQuery("some qlString here"), where the query language string picks out individual properties (so select p.firstName, p.lastName from Person p), is there any way to get the property names of the things retrieved?
    I'm trying to allow an end user to define JPA queries by storing the query language string persistently, and then (after some rudimentary checking) create a Query from it, hosted (at this point) in a JTable. It would be nice if there were a way to wire up the items returned by the query such that the JTable columns were "titled" with something appropriate.
    Otherwise I have to either (a) parse the QL string (yuck yuck yuck) or (b) somewhat redundantly have the user specify the columns/properties/related objects that they think they're retrieving.
    Thanks,
    Laird

    Connection connection;
    DatabaseMetaData metadata = connection.getMetaData();
      String[] names = {"TABLE"};
      ResultSet tables = metadata.getTables(null,"%", "%", names);
      while (tables.next()) {
      String tableName = tables.getString("TABLE_NAME");
       ResultSet columns = metadata.getColumns(null, "%", tableName, "%");
    while (columns.next()) {
      String columnName = columns.getString("COLUMN_NAME");
        }

  • How to get user name as a calculated column in Analytic View or Calculation Graphical View?

    Hi Folks,
    I needed something like this. In the output, I needed a column which displays the SESSION USER who is seeing the results of the model.
    In Script , we can have something like this
    SELECT SESSION_USER FROM DUMMY
    How can I do the same using calculated columns in the model?
    Regards,
    Krishna Tangudu

    Hi Nick,
    Since you have said "Month Name", I am guessing you are interested in getting values such as "January", "February" and so on as opposed to 01, 02.... Is that right?
    If so, I don't think there exists a built-in function in HANA that could give you that. A calculated attribute with a case or if statement on the hard-coded descriptions (January, February...) for month values (01,02...) derived from the data column (BEZDT) is what I can think of.
    Thanks,
    Anooj

  • Getting table name from a query

    Hi, I'm trying to get the table name from my sql query
    My code is as follows;
    ResultSetMetaData metadata = rs.getMetaData();
    for (int i = 1; i < metadata.getColumnCount(); i++)
    System.out.println(metadata.getTableName(i));
    I just get a blank output. Yet my sql query executes and I can pull down the records, and grab the column names from the result sets.
    Any ideas on how I can get the table name for the columns. The reason being is on one of my querys I'm using join statements and i need to retrieve the table name for the column i'm displaying, as some tables have similar column names.
    Thanks in advance.

    Hi,
    What db are you using?
    I also get a blank output with ResultSetMetaData.getTableName because Oracle doesn't implement this method.
    Why do you not know the table name anyway?
    regards
    Nick

Maybe you are looking for

  • How to transfer only part of iTunes library?

    I have over 80GB of music (mainly classical) in my iTunes library and I am using it with my iPod classic. I am planning to buy now a new 16GB iPod nano and my question is how I can transfer only selected pieces of music (all library will not fit anyw

  • Problems with Paper Forms Barcode

    hi, i designed a PDF which has 2 pages. on this pages user enters data for 3 persons. name + adress i want to add a paper forms barcode for the whole document on the second page, but the barcode object shows me an error (in the right corner of object

  • Encryption issues 10.3.9 and 10.4.11 + Thomson router

    I have: yr 2000 iMac on 10.3.9 Dome 2001 iMac on 10.4.11 G4 PB on 10.5.8 MBP on 10.6.3 2 x Airport Express boxes connected to HIFI for music streaming I have a Thomson router model TG 858v7 s/w release 8.2.2.5 The router is new, this week. If I use a

  • Temporary text on billing document and delivery

    Dear all, I have the following question: Is it possible to add a temporary text on the billing doc and delivery doc? For example: 'Closed between Christmas & New year' thanks, Ton

  • Related to BPEL Correlation in Oracle soa suite 11g?

    When we are working with Correlations in BPEL where the correlation information will be saved in composite or DB ?