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

Insert entries into Ztable

Former Member
0 Likes
748

Dear all,

I have a customize program that will perform records insertion into Ztable.

Program will be executed into background with more than one job due to different variant.

My concerns:

1. Since the program running in background for different variant at the same time, and the program is doing the data insertion(for different company code) into same table(Ztable). Will in cause any record insertion failure?

2. How should i declare the lock?

Please comment.

1 ACCEPTED SOLUTION
Read only

andreas_mann3
Active Contributor
0 Likes
700

use fm ENQUEUE_E_TABLE:

example:

...

sptab-tabname = c_sperr.

sptab-varkey = sy-mandt.

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

tabname = sptab-tabname

varkey = sptab-varkey

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE x001(000) WITH ...

ENDIF.

hope that helps

Andreas

Dear all,

I have a customize program that will perform records insertion into Ztable.

Program will be executed into background with more than one job due to different variant.

My concerns:

1. Since the program running in background for different variant at the same time, and the program is doing the data insertion(for different company code) into same table(Ztable). Will in cause any record insertion failure?

2. How should i declare the lock?

Please comment.

4 REPLIES 4
Read only

former_member189629
Active Contributor
0 Likes
700

refer to Enque/Deque help

Read only

andreas_mann3
Active Contributor
0 Likes
701

use fm ENQUEUE_E_TABLE:

example:

...

sptab-tabname = c_sperr.

sptab-varkey = sy-mandt.

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

tabname = sptab-tabname

varkey = sptab-varkey

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE x001(000) WITH ...

ENDIF.

hope that helps

Andreas

Read only

0 Likes
700

Hi,

Thanks for your reply. However I'm not looking for a full table locking. For my case, same program running at the same time during the update into same Ztable, full table locking will cause rest of the job fail.

Thanks.

Read only

0 Likes
700

Write Do 9999 times ..enddo.

enque the table and once the insertion is done ,deque the table.

Ashok