Adding Insert & Updated By User Info In table(more than one user)

Hi All,
I have bonus table(column empid,empnm,percentage,insertedby,updatedby) with logged user as user1.
Now i create a application in which at one page i added a report with form.My intention is that
when i insert a new record the insertedby & updatedby column shld be automatically added with APP_USER.
But after logged in with diff user say user2 the report shld have user1 in two columns.But now as user2
when i want to modify that record the updatedby column value should have user2.How can i achieve that?
If u have any further issue for not understanding kindly revert back to me.
Thanks in advance .
Bye,

The best thing to achive this is to use triggers - before or after insert or update. Assuming that your collumns, where you store the user information are named like:
user_created and
user_changed
you need two triggers:
1. for inserting new rows:
CREATE OR REPLACE TRIGGER trigger_name
BEFORE INSERT
ON your_table
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
:NEW.user_created := NVL (htmldb_application.g_user, USER);
:NEW.user_changed := NVL (htmldb_application.g_user, USER);
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
2. for updating rows:
CREATE OR REPLACE TRIGGER trigger_name
BEFORE UPDATE
ON your_table
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
:NEW.user_changed := NVL (htmldb_application.g_user, USER);
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
There are of course other methods where you can create simmilar processes managed by the application but the best was is to do it on the database level, using triggers.
Denes Kubicek

Similar Messages

  • How we can lock No more than one user can use the table  at a single time

    Hi Abapers,
    0)  which  function modules to lock & unlock a table.
    1) When you execute the program, we can check if there is any lock on this table. If yes, the user should be able to only view the table contents and not modify.
    2) If there is no lock, then lock the table and go into change mode.
    3) On exiting from the program, unlock the table using the function module.
    4) more than one user can't modify the table just display.
    Note: If there is any lock, display message saying table is locked.
    Plz help me for this requirement.
    Thanks
    Nani

    Hello Nani
    Have a look at the lock object EMMARAE (<i>Lock MARA and MARM/MAKT exclusively</i>) in transaction SE11.
    Inspect the F1 help for field <b>Lock mode</b>:
    DE ENQMODE
    Short Text
         Lock mode
    Definition
         Defines how to synchronize table record access by several users.
    The following modes exist:
         Exclusive lock
             The locked data can be read or processed by one user only. A request
             for another exclusive lock or for a shared lock is rejected.
         Shared lock
             Several users can read the same data at the same time, but as soon
             as a user edits the data, a second user can no longer access this
             data. Requests for further shared locks are accepted, even if they
             are issued by different users, but exclusive locks are rejected.
         Exclusive but not cumulative lock
             Exclusive locks can be requested by the same transaction more than
             once and handled successively, but an exclusive but not cumulative
             lock can only be requested once by a given transaction. All other
             lock requests are rejected.
    If you want to lock a standard table search whether the table is used in lock objects (<i>Where-Used-List</i>). If it is a customer table you have to create your own lock object (including two function modules: one for enqueuing and the other for dequeuing).
    The lock modules can be found in menu <b>GoTo -> Lock Modules</b>.
    Given these lock modules the logic should be quite clear after starting the program:
    1. Request lock -> if successful, continue in Change mode; -> if failed, continue in Display mode
    2. Before leaving the report remove lock (note: no problem if no lock has been set in the beginning).
    Regards
      Uwe

  • Error whiile updating more than one user

    If the resultset contains one value, my code works fine. I get an error when there are more than one users. any thoughts?
    try
    tcResultSet moResultSet= moUserUtility.findAllUsers(mhSearchCriteria);
    for (int i = 0; i < moResultSet.getRowCount(); i++)
    moResultSet.goToRow(i);
    Date dteCourseEndDate=moResultSet.getDate("USR_UDF_MYFIELD");
    int intUserKey = moResultSet.getIntValue("Users.Key");
    Calendar calCurrentDate = Calendar.getInstance();
    Date sampleCurrentDate= calCurrentDate.getTime();
    if(dteCourseEndDate.before(sampleCurrentDate))
    Hashtable<String,String> moUpdateUser = new Hashtable<String, String>();
    moUpdateUser.put("USR_UDF_MYotherFIELD", "");
    moUserUtility.updateUser(moResultSet, moUpdateUser);
    thanks
    Veena

    You will need to search based on the Users.Key or another unique value to get only a single set when you perform the update. So your first search is to get all the users that match your criteria, then you need to perform a second search for the individual user when you do the update.
    -Kevin

  • Load more than one user groups to system session variable GROUP from table

    hi, I found that the value of the system session variable GROUP can be assigned by setting a sql in initialization blocks.
    however, if there are some users with more than one user group.
    can this be done by table driven (using sql in initialization blocks) ?
    thanks !!

    Referencing GROUP session variable in initialization blocks for different types of authentication
    http://108obiee.blogspot.com/2009/10/referencing-group-session-variable-in.html
    Users are assigned to multiple groups from external table with semicolons, see example two and three from the post.
    Regards
    Goran
    http://108obiee.blogspot.com

  • Using Remote Desktop Admin app in more than one user account.

    Is possible to have the ARD admin app use the same database and settings over more than one user account?
    eg. I have ARD setup on my Mac as I am in charge of our organisations Macs. However if I am away for a few weeks, one of our other techs would be able to turn on my Mac, log in to a generic account, open ARD and it would be set up exactly as I have it in my user account.
    I know that I could manually set up ARD in the other account, but with the number of machines we have I would rather not have to re-enter all those admin passwords all over again, and then have to remember to update ARD in the other account everytime we get a new machine or make other changes.

    In theory, you could simply copy the com.apple.RemoteDesktop.plist into the preferences folder of the other user. Then they would simply have to know the Remote Desktop Password (which is probably stored in your KeyChain.)
    I've never tried this, but it seems like it would work.

  • How can I see if my program is for more than one user? We think we have bought in design for more users, but can not find out how to get in for more than one?

    How can I see if my program is for more than one user? We think we have bought in design for more users, but can not find out how to get in for more than one?

    If you bought a CC for team, you can log in at http://adobe.com and insert the e-mail that you gave at the moment at the purchase and than you can manage and see you product/plan/team.
    If I was not clear you can use the following link to help you solving your issue:
    Creative Cloud Help | Manage your Creative Cloud for teams membership
    If your not clear about this situation, contact with an agent of Adobe, by chat or phone. Use the following link to see the type of support you have on this matter:
    http://adobe.com/getsupport
    I think this will help you.
    Regards

  • More than one user "using an expression" in a BPM Task

    Hello,
    I want to send a notification step for multiple users. I see two options
    1. Choose one or more UME principals.
    2. Use an expression.
    However I have to send the notification for more than one user using an expression. I'm using this expression, 
    getPrincipal(DO_xyz)
    but this only works for one user. I need something like this
    getPrincipal(DO_xyz);  getPrincipal(DO_xyz2);  getPrincipal(DO_xyz3)
    But this is not possible. I can't use a group because all this information is dynamic and it's born within the process.
    Please, How can I solve this?
    Best Regards
    SU

    Hello Abhijeet,
    I've seen that I can use the getPrincipals adding in the XSD an string with 1..* cardinality. However I don't know how to map an attribute from the UITask to that new attribute in the XSD because in Web Dynpro I can't create an string with cardinality 1..*
    I've tried to create a node (1..*) with a String inside in the UI but I couldn't map it to the process context, it shows me an error that I cannot map a node to a String.
    Thanks
    Regards
    SU

  • More than one user accessing site

    Hi
    Is it possible for more than one user to be able to access and update site? I am going to be collaborating with a fellow Mac person and we want to work on the site together.
    Thanks
    DJH

    Yes. See this MacWorld article: Managing an iWeb site from multiple Macs.
    OT

  • More Than One User ID Possible?

    Is it possible to have more than one user ID on one account to enable other people in the same household to watch BT Sport?
    I houseshare with one other person and access to BT Broadband is included in my rent.  However, if I have to use the main user ID to access BT Sport the account holder, rightly, won't be too happy as his personal info could be viewed/used by me if I was so inclined, which I'm not, but if I was the main account holder I wouldn't want anyone, unrelated or related, having access to my account details.
    There are other previous posts on this subject but they aren't that recent and the situation could have changed in the interim.

    dale wrote:
    Could you not buy a chromecast for around £30 pounds and put that into your tv . I think than you only need the hub/wifi password for it to work .
    You still need to sign in to btsport before you stream it to the chromecast connected to the tv
    If you like a post, or want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side of the post.
    If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’.

  • Starttransaction for more than one user

    Hi,
    is there any FM, TCODE or customizing way
    to set an starttransaction for more than one user?
    I see the starttransaction in table ARR_DATEU under
    ID = START_TCD.
    Thanks.
    Regards, Dieter

    Hi Thomas,
    thanks for your answer.
    I Find (by debugging) FMs: NAVIGATION_GET_START_TCODE and NAVIGATION_SET_START_TCODE.
    Regards, Dieter

  • Can I put more than one user under one Apple ID account. I want to let other family members use imessage on their own Apple device. Or is there another way to get this end result?

    Can I put more than one user under one Apple ID account. I want to let other family members use imessage on their own Apple device. Or is there another way to get this end result?

    You can seach the net for solutions like this one http://appletvvpn.com/how-to-connect-apple-tv-2-to-vpn/ another idea is to use a PC as the control and fit that with a wireless card and set up a ad hoc wireless network that the Apple TV uses. 

  • How Do I Share My Database Between More Than One User Account on the Same Mac?

    How Do I Share My Database Between More Than One User Account on the Same Mac?

    How to use multiple iPhone, iPad, or iPod devices with one computer. The only way is for you to have a separate user account to log into on that computer.

  • Can a user facetime with more than one user at a time

    I can use facetime with Macbook and connect to another Macbook user on another WIFI network... I was wondering if one can facetime with more than one user at a time?

    ellis911 wrote:
    I can use facetime with Macbook and connect to another Macbook user on another WIFI network... I was wondering if one can facetime with more than one user at a time?
    Only if you have more than one device running FaceTime at your end.
    Mac Pro Quad Core (Early 2009) 2.93Ghz Mac OS X (10.6.5); MacBook Pro (13 inch, Mid 2009) 2.26GHz (10.6.5)
    LED Cinema Display; G4 PowerBook 1.67GHz (10.4.11); iBookSE 366MHz (10.3.9); External iSight; iPod4touch4.2.1

  • Can we start more than one user created database at the same time

    Hi.,
    Can we start/work more than one user created database at the same time ??
    --Shyam                                                                                                                                                                                       

    Hi Shyam,
    I really dont understand what you have asked?
    If your question is can we start more than one database at the same time then the answer to that is yes but provided to have enough resources on your server to support running of two or more different databases on the same machine.
    Ex Senior DBA

  • Adobe Form used by more than one user simultaneously

    Friends,
    I am working on an online interactive Adobe form using Web Dynpro ABAP.
    once the user enters the data and clicks the submit button, the data is sent to ztables.
    the scenario is that more than one user can possibly use the same form simultaneously. in that case, how can i maintain synchronization ie how to avoid multiple users from using the form at the same time, when the form is already being filled by one user already.
    I am guessing i have to do something with ADS for this.
    Any thoughts or ideas would be greatly appreciated.
    Thanks and Regards.

    Hi Bertrand,
    The purpose of allowing only one user is to ensure data consistency as you have guessed.
    Is there a program name or transaction code where i can look up the lock entries and see if i can apply them to my web dynpro application or the adobe form.
    I would greatly appreciate your help.
    Thanks and Regards.

Maybe you are looking for

  • Is there a way to import video/audio clips from Logitech webcam?

    I just purchased a used Logitech Quickcam Vision Pro for Mac. A Logitech driver is apparently not required. I connected it to a USB port on my mini. I couldn't find any way of downloading Photo Booth so I downloaded Funny Photographer (http://homepag

  • Disable particular row in a grid

    I displayed the table in a grid, and I want to disable the row if the field "Status" is equal to 1, how to do it? Ken

  • LSMW for Tcode - HRCMP0001

    Hi I am facing problem while creating LSMW recoring for Tode HRCMP0001. It is not taking the Personnel Number value in recording. Please let me know if there exists any Function Module for this transaction or any other Transaction exists for the same

  • MIRO 999 lines items

    Hi, if we post an invoice in MIRO that contain over than 999 lines items we have a message who block the save. so what is the path IMG with which i can make modification to have for any account (when i do simulate) one line item (so the total) ? i ho

  • Input sources grey out after action on MacOS

    Hello, I have a problem with japanese input sources (Hiragana and Katakana). When I launch Indesign, I can use this in text box. But if I open my flex panel, and do an action on it (click on button, select texteinput, change checkbox...), the input s