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

Shared memory and ABAP

Former Member
0 Likes
673

Dear developers,

I have some documentation on ABAP SHARED OBJECTS and I wonder how I could define shared memory objects at run time ( so I would need something like an API ) instead of using the SHMA transaction.

I actually also wonder what would happen if 2 users of the same shared object would call on one of its methods ? Can we have concurrent access ? How does the whole locking thing works ? Is it possible to implement waiting calls/locks ?

If you have any serious/technical documentation on semaphores/locks in SAP/ABAP I'd also be very interested.

Sincerely,

Olivier MATT

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
474

Hi matt,

This is vijay here.

if you r working on frequntly changed data then you must use this locking technique.

well jus go to se11 and make a lock object by starting initial......EZ....

EX: EZENMARA.

then u can fix the lock as shared or (exclusive,cumulative) or( exclusive, not cumulative)

you can also fix the lock parameters like specific fields.then jus save and activate.

and when you will make a program jus call the function module enqueue_ezenmara for locking and dequeue_ezenmara for unlocking and u can get rest in my program.

regards

vijay

rewards if answer is helpfull.

TABLES: MARA.

PARAMETER: MATNR LIKE MARA-MATNR.

CALL FUNCTION 'ENQUEUE_EZENMARA'

EXPORTING

MODE_MARA = 'S'

MANDT = SY-MANDT

  • MATNR =

X_MATNR = 'MATNR'

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = ' '

  • EXCEPTIONS

  • FOREIGN_LOCK = 1

  • SYSTEM_FAILURE = 2

  • OTHERS = 3

.

IF SY-SUBRC = 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

WRITE: 'TABLE IS LOCKED'.

ELSE.

SELECT * FROM MARA WHERE MATNR = MATNR.

WRITE:/ MARA-MATNR,MARA-ERNAM,MARA-MTART.

ENDSELECT.

ENDIF.

2 REPLIES 2
Read only

Former Member
0 Likes
475

Hi matt,

This is vijay here.

if you r working on frequntly changed data then you must use this locking technique.

well jus go to se11 and make a lock object by starting initial......EZ....

EX: EZENMARA.

then u can fix the lock as shared or (exclusive,cumulative) or( exclusive, not cumulative)

you can also fix the lock parameters like specific fields.then jus save and activate.

and when you will make a program jus call the function module enqueue_ezenmara for locking and dequeue_ezenmara for unlocking and u can get rest in my program.

regards

vijay

rewards if answer is helpfull.

TABLES: MARA.

PARAMETER: MATNR LIKE MARA-MATNR.

CALL FUNCTION 'ENQUEUE_EZENMARA'

EXPORTING

MODE_MARA = 'S'

MANDT = SY-MANDT

  • MATNR =

X_MATNR = 'MATNR'

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = ' '

  • EXCEPTIONS

  • FOREIGN_LOCK = 1

  • SYSTEM_FAILURE = 2

  • OTHERS = 3

.

IF SY-SUBRC = 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

WRITE: 'TABLE IS LOCKED'.

ELSE.

SELECT * FROM MARA WHERE MATNR = MATNR.

WRITE:/ MARA-MATNR,MARA-ERNAM,MARA-MTART.

ENDSELECT.

ENDIF.

Read only

0 Likes
474

Thanks.

But is it necessary to create such locks with a transaction. I mean that I need an API for creating/manipulating them.

I have also the same requirements for shared memory areas... Why does SAP only talks about transactions and doesnt seem to be providing APIs ?

If you have any information or material concerning these issues please let me know.

Sincerely,

Olivier MATT