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

Transactionhandling / locks on table.

Former Member
0 Likes
1,104

Hi,

I've read some facts about transaction handling / Locking.

I have a table ZPRICECOND_TAB that needs to be updated every 4 h.

Table ZPRICECOND_TAB has:

Rows: 100.000

Fields: 15

Primary key: 3

Other: runnig sqlserver2000 on windows.

So now I think I need to make the following statement.

delete from ZPRICECOND_TAB. " empty this table

insert ZPRICECOND_TAB from table i_pricecond3100.

insert ZPRICECOND_TAB from table i_pricecond4100.

Q1: How do I do a proper transaction/locking on this table ?

Dirty reads are OK... but there must always be data in the table...locks/waiting are ok as well...

// Martin

1 ACCEPTED SOLUTION

Hi,

I've read some facts about transaction handling / Locking.

I have a table ZPRICECOND_TAB that needs to be updated every 4 h.

Table ZPRICECOND_TAB has:

Rows: 100.000

Fields: 15

Primary key: 3

Other: runnig sqlserver2000 on windows.

So now I think I need to make the following statement.

delete from ZPRICECOND_TAB. " empty this table

insert ZPRICECOND_TAB from table i_pricecond3100.

insert ZPRICECOND_TAB from table i_pricecond4100.

Q1: How do I do a proper transaction/locking on this table ?

Dirty reads are OK... but there must always be data in the table...locks/waiting are ok as well...

// Martin

5 REPLIES 5
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
983
Read only

Former Member
0 Likes
983

Hi,

Create Lock object on your Z table ZPRICECOND_TAB using transaction SE11. when you active this lock object, SAP creates two function modules to impose and delete locks. Call these function modules to impose and delete locks.

Read only

Former Member
Read only

andreas_mann3
Active Contributor
0 Likes
983

Hi,

or try that:

data sptab type rstable.
  sptab-TABNAME = 'ZPRICECOND_TAB '.
  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.

Andreas