2006 Dec 06 11:11 AM
Hi,
I have a dialog program callable by a transaction. In this program there are
many tab strips with a database table for each tab strip. You can see, change
and delete the data of the database tables on each tab strip.
Now it should be possible, that only one user can change and delete data at
the same time. So I have thought about writing a value in the memory and read
it every time at the beginning of the program.
If one user is starting the program and there isn´t an entry in the memory, the
memory should be set now. If another user is starting the program now, there
should be an entry in the memory, that I can protect the tables for changing and
deleting.
I tried it like that:
DATA: user TYPE sy-uname.
IMPORT user FROM MEMORY ID 'user'.
IF user IS INITIAL.
user = sy-uname.
EXPORT user TO MEMORY ID 'user'.
CLEAR user.
ENDIF.
It is working, if You call the transaction at once. The username is stored in the
memory.
But when I now start the transaction in another mode the same time, I´m not
getting any entry for the field 'user' in the memory.
Any ideas? Or do You have any better ways how to protect the data?
Thank You very much!
Reward points guaranteed.
2006 Dec 06 11:40 AM
Hi,
use lock objects for your requirement
lockobject is created using se11
by default enqueue_<lock objectname>
dequeue_<lock objectname> are created
by SAP.
you can create at table level or row level lock.
CALL FUNCTION 'ENQUEUE_EZPPX0010A'
EXPORTING
MODE_ZPPDORD = 'E'
MANDT = SY-MANDT
WERKS = S_WERKS
AUFNR = X_LOCK_LEVEL
EXCEPTIONS
OTHERS = 1.
delete lock after each insertion
or use call function 'DEQUEUE_ALL'
CALL FUNCTION 'DEQUEUE_EZPPX0010A'
EXPORTING
MODE_ZPPDORD = 'E'
MANDT = SY-MANDT
WERKS = S_WERKS
AUFNR = X_LOCK_LEVEL
EXCEPTIONS
OTHERS = 1.
Regards
amole
REgards
amole
Hi,
use lock objects for your requirement
lockobject is created using se11
by default enqueue_<lock objectname>
dequeue_<lock objectname> are created
by SAP.
you can create at table level or row level lock.
CALL FUNCTION 'ENQUEUE_EZPPX0010A'
EXPORTING
MODE_ZPPDORD = 'E'
MANDT = SY-MANDT
WERKS = S_WERKS
AUFNR = X_LOCK_LEVEL
EXCEPTIONS
OTHERS = 1.
delete lock after each insertion
or use call function 'DEQUEUE_ALL'
CALL FUNCTION 'DEQUEUE_EZPPX0010A'
EXPORTING
MODE_ZPPDORD = 'E'
MANDT = SY-MANDT
WERKS = S_WERKS
AUFNR = X_LOCK_LEVEL
EXCEPTIONS
OTHERS = 1.
Regards
amole
REgards
amole
2006 Dec 06 11:15 AM
HI,
better use the sap lock concept to lock the database entries.
use ENQUE AND DEQUE function modules of the database.
you can generate these for table from the transaction SE11.
REgards,
2006 Dec 06 11:16 AM
Hi arna,
1. For such scenarios, using memory id is not the way.
2. Lock objects should be created via se11,
and used in the program,
to detect the locks.
regards,
amit m.
2006 Dec 06 11:19 AM
Thank You!
Can You tell me very to set the table lock in TA SE11?
Cheers
2006 Dec 06 11:27 AM
In t-code SE11 there is a radio button for Lock object select that and create a lock object for ur table.
Enter the primary and secondary tables there.
Ur lock name must start with EZ<name>
2006 Dec 06 11:19 AM
hi
you have to use lock objects for solving your purpose...
use the following links...
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21eef3446011d189700000e8322d00/content.htm
thanks
pavan
2006 Dec 06 11:26 AM
The better idea to implement SAP Standard Locking Mechanism to prevent data should be deleted from other users. If you are dealing with HR Module, then you can try using these FM's <b>BAPI_EMPLOYEE_ENQUEUE & BAPI_EMPLOYEE_DEQUEUE</b>.
To know more about this, please visit the below link.
<a href="http://help.sap.com/saphelp_nw04s/helpdata/en/c2/2d7037ecc92a7ee10000009b38f8cf/frameset.htm">Locking</a>
Regards,
Ramki.
2006 Dec 06 11:40 AM
Hi,
use lock objects for your requirement
lockobject is created using se11
by default enqueue_<lock objectname>
dequeue_<lock objectname> are created
by SAP.
you can create at table level or row level lock.
CALL FUNCTION 'ENQUEUE_EZPPX0010A'
EXPORTING
MODE_ZPPDORD = 'E'
MANDT = SY-MANDT
WERKS = S_WERKS
AUFNR = X_LOCK_LEVEL
EXCEPTIONS
OTHERS = 1.
delete lock after each insertion
or use call function 'DEQUEUE_ALL'
CALL FUNCTION 'DEQUEUE_EZPPX0010A'
EXPORTING
MODE_ZPPDORD = 'E'
MANDT = SY-MANDT
WERKS = S_WERKS
AUFNR = X_LOCK_LEVEL
EXCEPTIONS
OTHERS = 1.
Regards
amole
REgards
amole
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |