How to check if a user exists in the system ?

Dear Gurus,
I want to check whether a user ID exists in the system after logon by using VBA. If the user ID exists, then I will update the user's information with external data by using the method user.change.
When running below codes, error occurs and error msg is: "The persistent key for an business object instance of type USER has not been set. Cannot invoke method EXISTENCECHECK"
How can I do to check the user ID existence ?
Set oUser = oBAPICtrl.GetSapObject("user")
oUser.ExistenceCheck "MyUserID", return:=oReturn
Thanks and Regards,
Bao Yan

Mickey,
I'm afraid I never did get this to work properly. However, in the way of all bad/good (delete as appropriate) programmers eveywhere I worked around this problem. I was using this code in Banner.asp to change the view based on the user group so if a given session variable was set a user would see a different view. It works fine with no slow down on the page and you should be able to adapt it to what you need.
Hope this helps.
Neville
Note: Application variables are ones I have defined in config.xml.
Code follows:
<!--START:INC\common\getgroup.asp-->
<% 'NAH 29/03/2004 ' 'This check the to see if the current user has the group in their membership that has been defined as the group to provide an alternative view of the portal.' 'The group variable is defined in the config.xml as "ALTVIEWGROUP"'
'Do not do this is we have already matched the group'If Session("groupMatch") <> "1" and Session("groupMatch") <> "2" then
Dim pGroup
pGroup = Application("ALTVIEWGROUP") Set Session("groupMatch") = nothing
Dim Plumtree
Set Plumtree = Server.CreateObject("ADODB.Recordset") Plumtree.ActiveConnection = "Driver={SQL Server};Server=" & Application("DBSERVER") & ";Database=" & Application("PLUMTREEDB") & ";" Plumtree.Source = "SELECT GROUPID FROM " & Application("PLUMTREEDBUSER") & ".PTGROUPMEMBERSHIP WHERE (USERID = " & strUserID & ") AND (GROUPID = " & pGroup & ")" Plumtree.CursorType = 3 Plumtree.CursorLocation = 2 Plumtree.LockType = 1 Plumtree.Open()
'If there are records we should have a match otherwise set the session varible to no match.' If Plumtree.EOF then Session("groupMatch") = "2" Else 'By getting here the user should have the matching group but complete one final check to make sure' If cInt(Plumtree.Fields.Item("GROUPID").Value) = cInt(pGroup) then Session("groupMatch") = "1" Else Session("groupMatch") = "2" End If
End If
Plumtree.Close() Set Plumtree = Nothing
End if%><!--END:INC\common\getgroup.asp-->

Similar Messages

  • How to check whether a file exist in the program folder or not?

    Hi guys,
    how to check whether a file exist in the program folder or not? Let is say i recieve a file name from user then i want to know if the file is there not and act on that base.
    abdul

    Look at the class java.io.File and the .exists() method:
    http://java.sun.com/j2se/1.4/docs/api/java/io/File.html

  • How to check whether portal user exists or not using UM API.

    Hi Experts,
    Let us say i need to create an user account "PortalUser",i know how to create an user,setting first name,lastname,password for that.
    but here before creating the portal user, i need to check whether that user exists or not.If user already exists ,then i  need to skip the below for creating the user.
    IUserFactory userFact = UMFactory.getUserFactory();
    IGroupFactory groupFact = UMFactory.getGroupFactory();
    IRoleFactory roleFact = UMFactory.getRoleFactory();
    IUser tuser = userFact.getUserByLogonID("PortalUser");
    IUserMaint newUser = userFact.newUser("PortalUser");
    newUser.setFirstName("PortalUser");
    newUser.setLastName("Test");
    newUser.setEmail("PortalUser.Testatgmaildotcom");
    //Locale PortalLanguage = new Locale(Lang.toLowerCase(), "");
    Locale PortalLang=new Locale("en");
    newUser.setLocale(PortalLang);
    newUser.save();
    newUser.commit();
    IUserAccount userAcc = UMFactory.getUserAccountFactory().newUserAccount("PortalUser", newUser.getUniqueID());
    userAcc.setPassword("test1test$");
    userAcc.save();
    userAcc.commit();     
    Thanks in advance.
    Thanks
    Sony.

    Hi,
    Try this code,
    IUserFactory factory = UMFactory.getUserFactory();
    IUser user = factory.getUserByLogonID(userId);
    lastName = user.getLastName();
    firstName = user.getFirstName();
    refer this pdf,its very helpful
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/events/webinars-nw-rig/using%20the%20user%20management%20api%20with%20ep%20applications%20-%20webinar%20powerpoint.pdf
    Regards,
    Sunaina Reddy T

  • How to check if a constraint existed in the table and drop it?

    Hi all,
    I want to drop a constraint from a table. I do not know if this constraint already existed in the table. So I want to check if this exists first.
    Below is my query:
    DECLARE
    itemExists NUMBER;
    BEGIN
         itemExists := 0;
    SELECT COUNT(CONSTRAINT_NAME) INTO itemExists
    FROM ALL_CONSTRAINTS
    WHERE UPPER(CONSTRAINT_NAME) = UPPER('my_constraint');
    IF itemExists > 0 THEN
    ALTER TABLE my_table DROP CONSTRAINT my_constraint;
    END IF;
    END;
    Here is the error I got when I executed the above query:
    ORA-06550: line 11, column 5: PLS-00103: Encountered the symbol "ALTER" when expecting one of the following: ( begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge
    Please help me with this!
    Greatly appreciate!
    Khoi Le

    Yes, I also tried to put the pl-sql in the Execute Immediate. However, the error still remains
    EXECUTE IMMEDIATE 'DECLARE
    itemExists NUMBER;
    BEGIN
         itemExists := 0;
    SELECT COUNT(CONSTRAINT_NAME) INTO itemExists
    FROM ALL_CONSTRAINTS
    WHERE UPPER(CONSTRAINT_NAME) = UPPER('my_constraint');
    IF itemExists > 0 THEN
    ALTER TABLE my_table DROP CONSTRAINT my_constraint;
    END IF;
    END';
    I execute the above code via running the batch file.
    Here is the error after I ran the batch file:
    ORA-06550: line 11, column 5:
    PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
    ( begin case declare exit for goto if loop mod null pragma
    raise return select update while with <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> <<
    continue close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall merge pipe purge
    The symbol "lock was inserted before "ALTER" to continue.
    ORA-06550: line 11, column 53:
    PLS-00103: Encountered the symbol "DROP" when expecting one of the following:
    . , @ in <an identifier>
    <a double-quoted delimited-identifier> partition subpartition
    ORA-06512: at line 2117
    I can not manually drop it. I need to do this via running an update script file.
    Is there a different way to accomplish this?
    Thank you very much!

  • How to check whether transport path exist between two systems in sld??

    Hi,
         I have two systems namely 'A' and 'B' and created business systems for both of them.Then i created transport path between the two systems.How i check whether what i have done is right in SLD.

    <b>WRT to CMS</b>
    am not sure with this but u can try:
    1. Start CMS: http://<host>:<J2EE Engine http port>/webdynpro/dispatcher/sap.com/tcSLCMS~WebUI/Cms.
    2. Goto lansdscape configurator and check there
    Message was edited by:
            Prabhu  S

  • How to figure out if users loggin in the system in JSP??

    Hi, all
    I am developing a website system which consist of
    (Client Brower) <----> (JSP/Servlets) <--->(JavaBean)<----->(Database)
    model, and the system is used to sell the DVD online, but I am just confused of how can I find out if the user is logged in or not?
    Thanks to anyone who read and rely this.

    use session variable or cookies to track the user if he / she is logged r not

  • How to check if Message already exists in the queue and if message is processing currently

    Hi everyone
    I am new to Azure and worked on adding messages to the queue through workerrole1. Worker role 2 pulls them out from queue and processing them and de-queing them.
    Worker role1 runs method gets called after every 10 seconds and puts messages in queue
    CloudQueueMessage
    message = newCloudQueueMessage(oAzureWorker.WorkerInstanceOf
    + "_"+ oAzureWorker.AgentId.ToString()
    + "|"+ ExecutionId.ToString());
                                    queue.AddMessage(message);
    Worker role2 runs method gets called after every 10 seconds too and checks the queue like this
    foreach
    (CloudQueueMessagemessage
    inqueue.GetMessages(20,
    TimeSpan.FromMinutes(5)))
    // Process all (20) messages in less than 5 minutes, deleting each message after processing.
    // Process message
    queue.DeleteMessage(message);
    Following are my questions
    1) How do I check in worker role1 if the message is already in queue, Because I don't want to queue it back again if its not yet processed and is in the queue already
    2) How do I check in worker role1 if the message is currently processing. Because I don't want to queue it back again.
    3) How do I make sure that ALL the messages get processed in the order they are inserted. I know Queue is FIFO, but I know if the message gets delayed in processing another instance can pick it up, even if it gets picked up by another instance, I want to
    make sure that the order remains.
    Right now the instances of both these worker roles are 1, in the future when we increase them, I don't want them to queue the same messages multiple times or queue them if the message is already in process mode.

    Hi Sarah,
    I agree to the Frank's suggestion. Why you need to burden the worker role 1 to check if the message really sits on the queue or not? You can do this simply in your code before pushing it on queue instead querying queue.
    All you need to do on worker role 1 is - push the message on the queue and forget as the entire queue design in azure is designed from asynchronous processing.
    About worker role 2 - Use the GetMessage method which hides retrieved message's from other clients and hence makes sure that only one client is processing it at a time. If processing is successful - delete the message. if it is not - the message will be
    visible anyways after the mentioned time provided in the GetMessage method.
    I agree that when you will increase number of instances of your worker role 1 which might insert duplicates in the queue - in that case - you might need to introduce the shared entity (like database) and let all instances communicate through it to avoid
    the duplication of messages on queue. 
    Bhushan | http://www.passionatetechie.blogspot.com | http://twitter.com/BhushanGawale

  • How to check variants in programs existing in different systems ?

    Hi,
    i am using same program (coding might not b same ) in two different systems(fsd and bwd) .
    one program has two variant and other has only one, now when we execute the main program which is controlling the program in different systems then it shows dump erroe due to different variants or different output.
    we want to catch that dump error.
    Please provide us some code for that.
    Edited by: naincy on Oct 8, 2010 11:06 AM

    hi
    actually the dump error i am getting shows LOAD_PROGRAM_NOT_FOUND
    and CATCH_EXCEPTION is not working for that.
    i dont have to remove the errors , i just want to handle thm.

  • How to check which RFCs causing issues in the system and RFC response times

    Hi,
    We have an issue with the RFC response times in CRM and need investigstion. We need to know which Which RFCs causing issues and how we can solve the problems.
    Regards

    Hi,
    chek the below code
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_EXIST
    EXPORTING
    FILE = W_FILENAME
    RECEIVING
    RESULT = W_RESULT
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    WRONG_PARAMETER = 3
    NOT_SUPPORTED_BY_GUI = 4
    others = 5.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-* MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF W_RESULT IS INITIAL.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST
    EXPORTING
    DIRECTORY = W_FILENAME
    RECEIVING
    RESULT = W_RESULT
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    WRONG_PARAMETER = 3
    NOT_SUPPORTED_BY_GUI = 4
    OTHERS = 5.
    IF SY-SUBRC <> 0.
    ENDIF.
    ENDIF.
    IF W_RESULT = 'X'.
    RC = '1'.
    ELSE.
    RC = '0'.
    ENDIF.
    reward if helpful.
    Regards,
    nagaraj

  • Check if a user exists in AD before creating

    Hi Friends,
    We are implementing AD for authentication.Now the requirement is that whenever we create a user in application,we need to check whether the username exists in AD.If it doesnt exists we should not create the user. Please how to check if a username exists in AD.
    Thanks
    Sasi

    Hi Patrick,
    Thanks for the link.That's what I exactly needed.
    But when I tried to use APEX_LDAP.GET_USER_ATTRIBUTES procedure, I'm getting ORA-31202: DBMS_LDAP: LDAP client/server error: Invalid credentials. 80090308: LdapErr: DSID-0C090334,.
    I'm sure that the username and the password which I passed are valid and with the same credentials I can able to login to apex application which has LDAP authentication.
    So I tried without password,but got ORA-06502: PL/SQL: numeric or value error
    Could you please explain what exactly goes wrong..?
    Thanks
    Sasi

  • Please help me how to check a material does existed group code in system (w

    Hi all,
    Please help me...
    I have inputted quantity for  tx MC 94  but when I input them into  tx MC94, I met  a message " Structure  not yet maintained for  this conbination characterstics". Step by step to show a error message as below:
    Step 1: Launch MC 94
    step 2: Enter Planning
    Step 3: Enter  Prod.Code. Material (ex: enter material code :0101010260008, this code is existed  Prod.Code )
    Step 4: Click on "Inactive Version " button
    ==> A error message is showed.
    Please help me how to check a material does existed group code in system (which table to  check  it)?
    How to record the message" Structure  not yet maintained for  this conbination characterstics" to catch up it in my program?
    Thank in advance.

    Karenloria,
    1. Check in MC8C, which Infostructure is used for Planning type "Planning" or the one you are entering in the intial screen of MC94.
    2. Using transaction MC63 for the infostructure identified in step 1, check the planning hierarchy maintained. If this product is not maintined maintain using MC62.
    You can also check using SE16 transction the current infostructe records(Plan) for the table name = infostructure identified in step 1.
    Regards,
    Prasobh

  • JavaScript: How to check if a file exists.

    Hello Everybody,
    Can you tell me how to check if a file exists using JavaScript and Internet Explorer.
    Browsing on this website I could read about the command "f.exists()" and it was necessary to include "java.io.*".
    Should I use this same command and should I include the same files? Or are there other files and other commands?
    Thanks in advance.

    sorry ya. there is no command to check whether a file exists using javascript. The following code says the object name and value. But it can't say whether the file exists in the harddisk or .. Javascript cannot access database and system resources. If the file exists or not can be checked through the application (ASP, CFML, ..) you are using.

  • HT1451 Hi All, I have 2 users on my desktop, 1 i-tunes account and log-in but both users have different music contents i.e. one has the full iTunes library and the other only has some songs. How do i get both users to have the same music content?

    I Have 2 users on my computer and both access i-tunes using same password etc. however 1 library has the full content of music but the other one has only partial playlists. How do I get both users to have the same full library?

    The title of my initial post is a bit misleading. I already took a chance deleting one of the iPhones, hoping if I deleted the wrong one, I can still reauthorize it (all with the same Apple ID acct, so not subject to 90-day waiting period, right?) The iTunes database just updated itself, and it says I have 4 "devices" "in the Cloud", but 5 "computers" associated w my account. How can I find out what computers are associated? Isn't there a list I can see? I dont have a clue what computers they might be. If I use the  "Deauthorize All" option, is it a pain to add them all back in. I assume I would have to log in from each computer to reauthorize each one. Would I have to be running the newest OS or version of iTunes to reauthorize? I think I have a PowerBook G4 Titanium with an older OS and iTunes. I'd like to keep that authorized, if possible.

  • How can i obtain a user guide for the ipod nano 16GB 5th gen. with out printing it off the computor

    How can i obtain a user guide for the ipod nano 16GB 5th gen. without printing it off the computor.

    You can't, at least not the one provided by Apple.
    B-rock

  • I have a WD 2 tb hard drive that I want to use to back up my Mac Pro quad core.  How do I create a back up startup disk?  Also, when I used Time macine, it only backed up users and not the system or library folders.  Ideas?

    I have a WD 2 tb hard drive that I want to use to back up my Mac Pro quad core.  How do I create a back up startup disk?  Also, when I used Time macine, it only backed up users and not the system or library folders.  Ideas?

    Welcome to Apple Support Communities
    Time Machine should be enough to make a backup of your files. Also, it should back up all folders, so open System Preferences > Time Machine > Options, and make sure that there are no folders included in the excluded items list.
    If you want to create a bootable clone of your hard drive, you need to use an app like Carbon Copy Cloner or the Disk Utility's Restore feature > http://pondini.org/OSX/DU7.html

Maybe you are looking for