Step 1. Go to TCODE-SE11, Provide the lock object name and Click on Create Button.
Step 2. Provide the Short text and click on the Tables Tab.
Step 3. Provide the table name and Select the Lock mode as Write Lock and Click on the Lock Parameter Tab.
Step 4. All the primary key fields of the given table are added under the Lock parameter section.
Activate the Lock Object.
Step 5. When the lock object is activated it creates two function modules ‘Enqueue & Dequeue’.
Navigate along the below shown path to get the generated function modules.
Step 6. FM names.
Step 7. Let’s use the generated function module in a program .
Go to TCODE- SE38, provide a report program name and click on create button.
Step 8. Call the Enqueue Function Module to lock the Single record.
Step 9. In the program PF Status Create the Application tool bar button as shown below.
Step 10. Activate the report. Open two different session at a time and run the same report.
Step 11. Provide the CARRID as ‘AA’ in both sessions.
Step 12. Run the first session and we have the out put. Execute the same report in second session,
now we have the error message given below as the same record is locked in first session.
Step 13. Now again run the same report in two different sessions and provide different inputs and execute it.
Step 14. Now no error message is there.
Step 15. Now again run the same report in two different session and provide the same input.
Run the program in first session.
Step 16. Now the record is locked. Now Unlock the Record By clicking on the Application toolbar button that is created in the program PF Status. Now run the Report in the Second session.
Step 17. The same record is shown in the second session without error.