Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Virtual Variables?

Former Member
0 Likes
489

Hi Experts,

Culd u pls. clarify my doubts,

1- Wat is the meaning of Virtual Variables? How they r useful?

2- What is data locking? In What scenarios the data is locked?

ThanQ.

3 REPLIES 3
Read only

Former Member
0 Likes
460

Srinivas,

2.

Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.

SAP Provide three type of Lock objects.

- Read Lock(Shared Locked)

protects read access to an object. The read lock allows other transactions read access but not write access to

the locked area of the table

- Write Lock(exclusive lock)

protects write access to an object. The write lock allows other transactions neither read nor write access to

the locked area of the table.

- Enhanced write lock (exclusive lock without cumulating)

works like a write lock except that the enhanced write lock also protects from further accesses from the

same transaction.

You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.

Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.

Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.

Technicaly:

When you create a lock object System automatically creat two function module.

1. ENQUEUE_<Lockobject name>. to insert the object in a queue.

2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.

You have to use these function module in your program.

check this link for example.

http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm

Don't forget to reward if useful..

Read only

Former Member
0 Likes
460

virtual variables:

these make program safer and easier to understand and maintain.

lock objects:

WE synchronizes simultaneous access of the same data records by Several users with the concept of lock mechanism. In general the lock arguments will be the key fields of the table.

A lock mode defines how other users can access a locked record of the table. there are 4 types of lock modes. they are

1. shared lock denoted by S (read lock).

in this Several users (transactions) can access locked data at the same time in display mode.

2. Exclusive lock denoted by E (write lock),

protects the locked object against all types of locks from other transactions.

3. Exclusive but not cumulative lock denoted by X ,

Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not cumulative locks can be called only once from the same transaction. Each further lock request will be rejected.

4. Optimistic lock denoted by O

Optimistic locks initially behave like shared locks and can be converted into exclusive locks.

When interactive transactions are programmed, locks are set and released by calling function modules (see Function Modules for Lock Requests). These function modules are automatically generated from the definition of lock objects in the ABAP Dictionary.

Life-Span of SAP Locks

A lock remains set until you either call the corresponding DEQUEUE function module, or close the transaction with an implicit DEQUEUE_ALL.

Saved locks inherited by the update task are loaded back into the lock table when the system is started up.

WE CAN CREATE LOCK OBJECTS IN SE11 WITH PREFIX 'EZ'.

WHEN WE DEAL WITH LOCK OBJECTS WE COME ACROSS THESE TWO FUNCTION MODULES.

ENQUEUE_<LOCK OBJECT NAME>

DEQUEUE_<LOCK OBJECT NAME>

WE CAN WRITE OUR OWN CODE IN EDITOR BY CALLING THSES FUNCTION MODULES.

Read only

Former Member
0 Likes
460

ThanQ to all.